Skip to content

fix(functional-tests): fix failing stage tests#20539

Merged
vbudhram merged 1 commit intomainfrom
fix-stage-tests
May 8, 2026
Merged

fix(functional-tests): fix failing stage tests#20539
vbudhram merged 1 commit intomainfrom
fix-stage-tests

Conversation

@vbudhram
Copy link
Copy Markdown
Contributor

@vbudhram vbudhram commented May 7, 2026

Because

  • The "Continue on the choice screen dispatches pair_preferences" stage smoke test was failing reliably with Target page, context or browser has been closed.
  • Firefox's chrome handler synchronously navigates the tab to about:preferences#sync when it sees the WebChannelMessageToChrome dispatch, tearing the page down before any page.evaluate reply (or console round-trip) can reach Playwright. There is no observable side effect in the page for the has-mobile path that survives the teardown.
  • The dispatch is already covered by unit tests in packages/fxa-settings/src/pages/Pair/Index/index.test.tsx with the WebChannel mocked. The functional test added flake without unique coverage.

This pull request

  • Updates pairChoice.spec.ts so the Continue-button smoke test selects needs-mobile, clicks Continue, and asserts the in-page download view (#pair-header-mobile) appears. Same handleChoiceSubmit handler, no race against tab teardown.
  • Renames the test to "Continue advances to the download view when no mobile is selected".

Issue that this pull request solves

Checklist

  • 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.

Other information

How to test:

cd packages/functional-tests
CI_WAF_TOKEN= yarn test-stage --grep "Pair entry flow" --reporter=list

Because:
- The "Continue dispatches pair_preferences" smoke test was racing
  Firefox's chrome handler, which navigates the tab to about:preferences
  synchronously when it sees the WebChannel dispatch and tore the page
  down before page.evaluate's reply could reach Playwright. The
  has-mobile and needs-mobile choices share the same submit handler;
  the latter has an in-page view transition we can observe directly,
  and the unit tests in fxa-settings already cover the WebChannel
  dispatch with mocks.

This commit:
- Updates pairChoice.spec.ts to select needs-mobile, click Continue,
  and assert the download view's heading appears.
Copilot AI review requested due to automatic review settings May 7, 2026 17:44
@vbudhram vbudhram requested a review from a team as a code owner May 7, 2026 17:44
@vbudhram vbudhram changed the title fix(functional-tests): assert pair Continue via download view transition fix(functional-tests): fix failing stage tests May 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the Pair entry flow smoke test in packages/functional-tests to avoid a reliable Playwright failure caused by Firefox tearing down the tab after a WebChannel dispatch, by asserting an in-page view transition instead of observing the WebChannel event.

Changes:

  • Updates the “Continue” smoke test to select the needs-mobile path and assert the download view (#pair-header-mobile) becomes visible.
  • Removes the page-side event listener/promise that attempted to capture WebChannelMessageToChrome dispatches.
  • Renames the test to reflect the new behavior under test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

});

test('Continue on the choice screen dispatches pair_preferences', async ({
test('Continue advances to the download view when no mobile is selected', async ({
@vbudhram vbudhram merged commit cde599a into main May 8, 2026
24 checks passed
@vbudhram vbudhram deleted the fix-stage-tests branch May 8, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants