Conversation
57d3d71 to
6981fb3
Compare
There was a problem hiding this comment.
Pull request overview
Adds new cross-device (desktop authority + mobile supplicant) E2E coverage for the FxA device pairing flow, with platform-specific automation for Android (adb-driven Fenix debug build) and iOS (xcodebuild/XCUITest-driven Firefox iOS Simulator), plus developer docs for running/debugging locally.
Changes:
- Add Android pairing flow E2E specs and an adb-based “supplicant” driver (
AndroidSupplicant). - Add iOS pairing flow E2E specs that coordinate Marionette with an XCUITest run.
- Add a pairing-focused developer/debugging guide (
CLAUDE.md) for Android/iOS local runs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| packages/functional-tests/tests/pairing/pairingFlowiOS.spec.ts | New iOS Simulator/XCUITest-driven pairing E2E coverage coordinated with Marionette authority. |
| packages/functional-tests/tests/pairing/pairingFlowAndroid.spec.ts | New Android emulator/device pairing E2E coverage using adb-driven supplicant automation. |
| packages/functional-tests/tests/pairing/CLAUDE.md | Local run + debugging documentation for pairing tests across Android and iOS. |
| packages/functional-tests/lib/android-supplicant.ts | New adb-driven automation helper to drive the Android “supplicant” side of pairing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const FIREFOX_IOS_PROJECT_DIR = | ||
| process.env.FIREFOX_IOS_PROJECT_DIR || | ||
| '/Users/vijaybudham/Desktop/working2/firefox-ios'; | ||
| const IOS_DESTINATION = | ||
| process.env.IOS_DESTINATION || | ||
| 'platform=iOS Simulator,name=iPhone 16,OS=18.0'; |
| } else { | ||
| debug('No xctestrun found, falling back to xcodebuild test (will compile)'); | ||
| args = [ | ||
| 'test', | ||
| '-project', | ||
| path.join('firefox-ios', 'Client.xcodeproj'), | ||
| '-scheme', | ||
| 'Fennec', | ||
| '-destination', | ||
| IOS_DESTINATION, | ||
| '-testPlan', | ||
| 'SyncIntegrationTestPlan', | ||
| `-only-testing:${onlyTesting}`, | ||
| ]; | ||
| } |
| * The Sync Debug pairing hook is a local debug-only addition to Fenix | ||
| * (`SyncDebugFragment.setupPairingPreferences`). See | ||
| * `ai/docs/references/android-local-testing.md` for the app-side change and | ||
| * build instructions. |
| throw new Error( | ||
| `${this.pkg} is not installed. Build + install the Fenix debug build ` + | ||
| `with the Sync Debug pairing hook (see ai/docs/references/android-local-testing.md).` | ||
| ); |
| * Prerequisites: | ||
| * - FXA stack running (auth :9000, content :3030) and `yarn adb-reverse` run | ||
| * so the emulator's localhost reaches the host stack. | ||
| * - Android emulator booted and visible to `adb` (ANDROID_SERIAL to target). | ||
| * - Fenix debug build with the Sync Debug pairing hook installed | ||
| * (org.mozilla.fenix.debug). See ai/docs/references/android-local-testing.md. | ||
| * |
| // The supplicant registers its device asynchronously after finishing the | ||
| // OAuth webchannel login. This requires the fxawebchannel extension to | ||
| // inject on the local stack — the extension manifest must include | ||
| // http://localhost/* in its content_scripts matches (see | ||
| // ai/docs/references/android-local-testing.md, pairing prerequisites). |
45bdb0e to
534183c
Compare
| :9000. The Fenix client id is already in `packages/fxa-auth-server/config/dev.json`. | ||
|
|
||
| Build the Fenix debug app from a `mozilla-firefox/firefox` checkout; it has the | ||
| Sync Debug pairing hook (landed in Bug 2053454). The Android bootstrap is a |
There was a problem hiding this comment.
Is (landed in Bug 2053454) really relevant.
| First, bridge the ports so the device's `localhost` reaches your machine: | ||
| `yarn adb-reverse` (works over USB and on the emulator). Then override the FxA | ||
| server: in Fenix, Settings → Sync Debug → "Custom Mozilla account server", set to | ||
| `http://localhost:3030`. Writing the `pref_key_override_fxa_server` pref directly |
There was a problem hiding this comment.
How does one do this: " Writing the pref_key_override_fxa_server pref"
dschom
left a comment
There was a problem hiding this comment.
I'm still validating the iOS build and android build process, but everthing else seems about right. We can also file a follow up if someone has a specific issue. Thanks for the docs!
| Sync Debug pairing hook (landed in Bug 2053454). The Android bootstrap is a | ||
| one-time step: | ||
|
|
||
| ```bash |
There was a problem hiding this comment.
It'd be nice to add the git clone / checkout / pull commands here too.
|
|
||
| ### Using an emulator (Android Studio) | ||
|
|
||
| Create an AVD in Android Studio's Device Manager, or launch one from the SDK: |
There was a problem hiding this comment.
Is there a place we can install apks from?
| Docker isn't up). That gives you content-server on :3030 and auth-server on | ||
| :9000. The Fenix client id is already in `packages/fxa-auth-server/config/dev.json`. | ||
|
|
||
| Build the Fenix debug app from a `mozilla-firefox/firefox` checkout; it has the |
There was a problem hiding this comment.
It'd be nice to list the git commands. Or link to the repo.
| debugging. Turn it on once in Fenix (Settings → "Remote debugging via USB"), then | ||
| on desktop Firefox open `about:debugging` → This Firefox / Setup, connect to the | ||
| device, and Inspect the pairing tab. That gives you the full Firefox DevTools | ||
| against the live on-device page, which is where the console, network, and |
There was a problem hiding this comment.
Might be worth noting / explaining you can see the logs and web requests for the paring tab, but you can also see the logs / requests from Firefox itself by selecting the 'Multiprocess Toolbox' at the bottom of the page. This can be useful to sanity check other calls made by Firefox to our APIs or even other APIs like sync.
| The iOS supplicant is Firefox iOS, on a Simulator or a registered device. Same | ||
| ideas as Android, different tools: Xcode and Safari Web Inspector. | ||
|
|
||
| > Heads up: the iOS steps here come from earlier debugging notes and the |
There was a problem hiding this comment.
Is this stray ai stuff? To close FXA-13885 we will need to validate this all still works correctly.
| and cold-starting is more reliable than the on-screen field, which tends not to | ||
| stick. | ||
|
|
||
| There's one more catch for local runs. The built-in `fxawebchannel` extension |
There was a problem hiding this comment.
I think it'd be nice for FxA to maintain some APKs with patch in them. It saves everyone else from having to build the code which is kind of a hastle and probably uncessary in many cases.
There was a problem hiding this comment.
We could but probably better to defer for now. The building the code locally might be hastle first time but its pretty quick on subsequent calls.
|
|
||
| ### Trigger a pairing | ||
|
|
||
| 1. In a signed-in desktop Firefox (the authority), open the pairing page and show |
There was a problem hiding this comment.
Maybe provide a little more info about this for some one who is knew and doesn't know how to do this.
| `Invalid pairing configuration`: the `channel_id` and `channel_key` drop out of | ||
| the URL fragment before the React app reads `window.location.hash`. If you see it, | ||
| check the loaded URL's fragment in Safari Web Inspector first, then the app's URL | ||
| handling. |
There was a problem hiding this comment.
What do you do to address this? Is this intermittent, or is there some kind of work around or bug fix needed?
There was a problem hiding this comment.
This was stale note, its been fixed.
Because
This pull request
docs/pairing/README.md, a developer guide for exercising pairing by hand on an Android emulator or real device against a local FxA stack.fxawebchannellocalhost caveat.fxa-14161).Issue that this pull request solves
Closes: https://mozilla-hub.atlassian.net/browse/FXA-13884
Closes: https://mozilla-hub.atlassian.net/browse/FXA-13885
Checklist
Other information
fxa-14161.