diff --git a/frontend/src/lib/shared/discussion/PersonMentionEditor.svelte.spec.ts b/frontend/src/lib/shared/discussion/PersonMentionEditor.svelte.spec.ts index b8e33739..164e9b32 100644 --- a/frontend/src/lib/shared/discussion/PersonMentionEditor.svelte.spec.ts +++ b/frontend/src/lib/shared/discussion/PersonMentionEditor.svelte.spec.ts @@ -283,7 +283,15 @@ describe('PersonMentionEditor — AC-2/3: search input drives fetch', () => { const fetchesBeforeClear = fetchMock.mock.calls.length; - await userEvent.clear(page.getByRole('searchbox')); + // `fill('')` atomically sets the input value in a single input event — + // same rationale as the `fill('Walter')` call above. `userEvent.clear` + // deletes per-keystroke, so intermediate values 'Au'/'A' transit through + // the bound `searchQuery` and each schedules a debounced fetch. Under + // CI-runner jitter, if two consecutive keystrokes land more than + // SEARCH_DEBOUNCE_MS (150 ms) apart, an intermediate timer fires before + // the input reaches '' and adds a phantom call — unrelated to the + // contract under test, which is "empty query => no fetch". + await page.getByRole('searchbox').fill(''); // Negative assertion: wait past the debounce window to confirm no // trailing fetch was scheduled. Removing this wait would mask a