fix: resolve flaky playwright tests with event-driven waits#3310
fix: resolve flaky playwright tests with event-driven waits#3310marandaneto merged 5 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 No Changeset FoundThis PR doesn't include a changeset. A changeset (and the release label) is required to release a new version. How to add a changesetRun this command and follow the prompts: pnpm changesetRemember: Never use |
|
|
Size Change: 0 B Total Size: 6.65 MB ℹ️ View Unchanged
|
… assertions - retry-queue 'retries and stops after success': set 90s test timeout (exponential backoff can take 40s+ worst case), use successSeen flag instead of counting requests, and verify stability with a simple toPass poll (no inner waitForTimeout) - mouse move tests: relax allPositions to >= 1 since rrweb can merge all moves into a single position entry under CI load
Problem
Several Playwright tests were flaky in CI due to timing races caused by fixed
waitForTimeoutcalls and test timeouts too short for exponential backoff. The affected tests:Changes
All fixes replace fixed timeouts with event-driven waits and relax brittle assertions:
retry-queue.spec.ts
successSeenflag set in the route handler instead of polling request count — directly waits for the event we care about. Verify stability after success with a simpletoPasspoll (no innerwaitForTimeout).session-recording.spec.ts & lazy-session-recording.spec.ts
allPositions.lengthassertion from>= 2to>= 1, and only assert the last position is further right when multiple positions are captured.surveys/core-display-logic.spec.ts
lastSeenSurveyDateto localStorage asynchronously after rendering the survey. Usedpage.waitForFunction()to wait for the value to be written in the browser context before reading it.Release info Sub-libraries affected
Libraries affected
None — test-only changes.
Checklist