Objective
What to automate
Run the failing test with trace, diagnose the race, and replace the eager read with a web-first assertion.
Preconditions and test data
Preconditions
- Use a fresh isolated Practice Lab browser context.
- Open the fixture identified by FX-WAIT-001.
Test data
starter: examples/debugging/hidden-race.spec.ts
Expected result
The trace proves the assertion ran before the delayed update; the repaired test waits on the final text.
Progressive hints
Hint 1
Open the action timeline in Trace Viewer.
Hint 2
Compare the assertion timestamp with the DOM snapshot.
Hint 3
Use expect(locator).toHaveText instead of reading textContent immediately.
I’ve tried it — show solution
- Open the action timeline in Trace Viewer.
- Compare the assertion timestamp with the DOM snapshot.
- Use expect(locator).toHaveText instead of reading textContent immediately.
The deliberately failing starter is in examples/debugging/hidden-race.spec.ts inside the TypeScript starter ZIP.