Fix flakey SchemaDialogView 'change text' JS test

Add a wait for the FormView autofocus timer (200ms) to complete before
typing, preventing a race condition where the autofocus moves focus away
from the target field on slow CI machines. This matches the pattern
already used by simulateValidData in the same test file.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave Page
2026-03-16 12:14:10 +05:30
committed by GitHub
co-authored by Claude Opus 4.6
parent 8f74b2e6d4
commit 7e39fc8477
@@ -101,6 +101,10 @@ describe('SchemaView', ()=>{
});
it('change text', async ()=>{
// Wait for autofocus timer (200ms in FormView) to complete
await act(async ()=>{
await new Promise(resolve => setTimeout(resolve, 500));
});
await user.type(ctrl.container.querySelector('[name="field2"]'), '2');
/* Error should come for field1 as it is empty and noEmpty true */
expect(ctrl.container.querySelector('[data-test="notifier-message"]')).toHaveTextContent('\'Field1\' cannot be empty.');