Objective
What to automate
Diagnose the event ordering with trace/video/console evidence and register the handler before the click.
Preconditions and test data
Preconditions
- Use a fresh isolated Practice Lab browser context.
- Open the fixture identified by FX-DIALOG-001.
Test data
starter: examples/debugging/unhandled-dialog.spec.ts
Expected result
The diagnosis identifies late handler registration; the repaired test handles the confirm before triggering it.
Progressive hints
Hint 1
Inspect the trace action that triggered the dialog.
Hint 2
Check whether the dialog listener existed before click.
Hint 3
Register page.once(dialog) first, then click and assert the accepted result.
I’ve tried it — show solution
- Inspect the trace action that triggered the dialog.
- Check whether the dialog listener existed before click.
- Register page.once(dialog) first, then click and assert the accepted result.
The deliberately failing starter is in examples/debugging/unhandled-dialog.spec.ts inside the TypeScript starter ZIP.