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);
|
||||
|
||||
Reference in New Issue
Block a user