fix(functional-tests): capture the Sync browser in the test trace - #21363
Draft
fxa-agent[bot] wants to merge 1 commit into
Draft
fxa-agent[bot] wants to merge 1 commit into
fxa-agent[bot] wants to merge 1 commit into
Conversation
## Because - A failed Sync test recorded a white page in `trace.zip`. The trace held only an `about:blank` tab that the test never used. - The fixtures closed the Sync browser with `browser.close()`. Playwright saves a context's trace only on `context.close()`, so the Sync trace was lost. - The separate `syncTrace.zip` hid the problem, but it gave two traces per failure and left out setup and teardown. ## This pull request - Adds `closeSyncBrowser()` in `lib/fixtures/standard.ts`. It closes the Sync context before the browser, so Playwright merges the Sync trace into the normal `trace.zip`. - Removes `handleSyncPagesTraceStop`, `getTracePath`, `findRootPackageJson` and `isRootPackageJson` from `lib/fixtures/standard.ts`. Failed Sync tests no longer write `syncTrace.zip`. - Changes the `testAccountTracker` fixture to depend on `context`, not `page`. `TestAccountTracker` reads the first page of the context only when a JWT helper needs it, so Sync tests do not open a blank tab. - Replaces the Sync trace section in the functional-tests `README.md` with a short note. ## Issue that this pull request solves Closes:
vbudhram
approved these changes
Oct 1, 2026
vbudhram
left a comment
Contributor
There was a problem hiding this comment.
Didn't test this, but its better than what we have now
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Because
trace.zip. The trace held only anabout:blanktab that the test never used.browser.close(). Playwright saves a context's trace only oncontext.close(), so the Sync trace was lost.syncTrace.ziphid the problem, but it gave two traces per failure and left out setup and teardown.This pull request
closeSyncBrowser()inlib/fixtures/standard.ts. It closes the Sync context before the browser, so Playwright merges the Sync trace into the normaltrace.zip.handleSyncPagesTraceStop,getTracePath,findRootPackageJsonandisRootPackageJsonfromlib/fixtures/standard.ts. Failed Sync tests no longer writesyncTrace.zip.testAccountTrackerfixture to depend oncontext, notpage.TestAccountTrackerreads the first page of the context only when a JWT helper needs it, so Sync tests do not open a blank tab.README.mdwith a short note.Issue that this pull request solves
Closes:
Checklist
Put an
xin the boxes that applyHow to review (Optional)
lib/fixtures/standard.ts, thenlib/testAccountTracker.ts.TestAccountTrackernow usecontext.pages()[0]. In a standard test that page is thepagefixture. No spec calls these helpers today.One reviewer call: is it acceptable that CI artifacts no longer contain
syncTrace.zip?Screenshots (Optional)
The attached image is the last screencast frame from the new
trace.zipof a failed Sync test. It shows the Sync page, not a white page.Other information (Optional)
I ran a scratch Sync spec that fails on purpose and then read its
trace.zip. On main, the only tab in the trace is the blank one, the trace has no Sync page requests, andsyncTrace.zipexists. With this change, the only tab is the Sync page, its requests are in the trace, and nosyncTrace.zipis written. The suite has no committed test for this, because a spec cannot read its own trace.signinCached.spec.ts(local): passed.signIn.spec.ts"signin with email with leading/trailing whitespace on the email" (local): passed.npx tsc --noEmitin functional-tests gives the same 2originalEmailerrors intestAccountTracker.tsthat it gives on main. ESLint passes.Playwright still records the main test context, which now has no page. In the trace viewer, that context shows actions but no screencast.