Skip to content

fix(functional-tests): capture the Sync browser in the test trace - #21363

Draft
fxa-agent[bot] wants to merge 1 commit into
mainfrom
agent-a476c5
Draft

fxa-agent[bot] wants to merge 1 commit into
mainfrom
agent-a476c5

Conversation

@fxa-agent

@fxa-agent fxa-agent Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

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:

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on: lib/fixtures/standard.ts, then lib/testAccountTracker.ts.
  • Risky or complex parts: the JWT helpers in TestAccountTracker now use context.pages()[0]. In a standard test that page is the page fixture. 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.zip of 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, and syncTrace.zip exists. With this change, the only tab is the Sync page, its requests are in the trace, and no syncTrace.zip is 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 --noEmit in functional-tests gives the same 2 originalEmail errors in testAccountTracker.ts that 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.

sync-trace-last-frame.jpg

## 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:
@fxa-agent fxa-agent Bot added the auto label Oct 1, 2026

@vbudhram vbudhram left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't test this, but its better than what we have now

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant