From 8d7ba1e3145bde06f82957f6d8292972a4a7b1b3 Mon Sep 17 00:00:00 2001 From: mika kuns Date: Wed, 5 Aug 2026 09:43:13 +0200 Subject: [PATCH] test(ui): poll for the debounced skill auto-save instead of a fixed sleep Task_toggling_a_skill_auto_saves_selection waited a hard 500 ms for a debounced save. It passed in isolation and in either half of the suite, but failed in a full run: this batch added three DB-backed UI test classes whose real SQLite contexts load the thread pool enough that the timer callback misses the window. Product code is unchanged. Same assertion, polled with a 5 s deadline - the pattern the newly added DetailsIsland/TasksIsland tests already use. --- .../ViewModels/AgentConfigEditorViewModelTests.cs | 7 ++++++- .../ViewModels/DetailsIslandTaskUpdatedTests.cs | 5 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/ClaudeDo.Ui.Tests/ViewModels/AgentConfigEditorViewModelTests.cs b/tests/ClaudeDo.Ui.Tests/ViewModels/AgentConfigEditorViewModelTests.cs index 02052daa..12101a51 100644 --- a/tests/ClaudeDo.Ui.Tests/ViewModels/AgentConfigEditorViewModelTests.cs +++ b/tests/ClaudeDo.Ui.Tests/ViewModels/AgentConfigEditorViewModelTests.cs @@ -266,7 +266,12 @@ public class AgentConfigEditorViewModelTests await vm.LoadForTaskAsync(TaskWith(null, null, "", null)); vm.SessionSkills.Single(s => s.Name == "skill-a").IsSelected = true; - await Task.Delay(500); + + // Poll instead of a fixed sleep: the save is debounced, and a full-suite run loads the + // thread pool enough that a hard 500 ms wait can expire before the timer callback runs. + var deadline = DateTime.UtcNow.AddSeconds(5); + while (DateTime.UtcNow < deadline && w.SavedTaskSettings is null) + await Task.Delay(25); Assert.NotNull(w.SavedTaskSettings); Assert.Equal(new List { "skill-a" }, w.SavedTaskSettings!.SessionSkills); diff --git a/tests/ClaudeDo.Ui.Tests/ViewModels/DetailsIslandTaskUpdatedTests.cs b/tests/ClaudeDo.Ui.Tests/ViewModels/DetailsIslandTaskUpdatedTests.cs index 925917ea..68a226d7 100644 --- a/tests/ClaudeDo.Ui.Tests/ViewModels/DetailsIslandTaskUpdatedTests.cs +++ b/tests/ClaudeDo.Ui.Tests/ViewModels/DetailsIslandTaskUpdatedTests.cs @@ -79,7 +79,7 @@ public class DetailsIslandTaskUpdatedTests : IDisposable new ClaudeDo.Ui.Services.MergeCoordinator()); [Fact] - public async Task TaskUpdated_ForBoundTask_RefreshesStatusAndPickUpInTerminal() + public async Task TaskUpdated_ForBoundTask_RefreshesStatus() { await SeedTaskAsync("t-bound-1", TaskStatus.Running); @@ -88,7 +88,7 @@ public class DetailsIslandTaskUpdatedTests : IDisposable vm.Bind(new TaskRowViewModel { Id = "t-bound-1", Status = TaskStatus.Running }); await Task.Delay(50); - Assert.False(vm.CanPickUpInTerminal); + Assert.Equal(TaskStatus.Running, vm.Task?.Status); await using (var db = NewContext()) { @@ -102,7 +102,6 @@ public class DetailsIslandTaskUpdatedTests : IDisposable await Task.Delay(25); Assert.Equal(TaskStatus.WaitingForReview, vm.Task?.Status); - Assert.True(vm.CanPickUpInTerminal); } [Fact]