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.
This commit is contained in:
@@ -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<string> { "skill-a" }, w.SavedTaskSettings!.SessionSkills);
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user