-
Notifications
You must be signed in to change notification settings - Fork 474
ci(e2e): [Experiment] replace maestro with touchpress in the expo native e2e #9679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| --- | ||
| --- |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| /* eslint-disable turbo/no-undeclared-env-vars */ | ||
|
|
||
| import { defineConfig } from '@playwright/test'; | ||
| import type { TouchpressOptions } from 'touchpress'; | ||
|
|
||
| const deviceName = process.env.E2E_DEVICE_NAME; | ||
|
|
||
| export default defineConfig<TouchpressOptions>({ | ||
| testDir: './tests/expo-native', | ||
| forbidOnly: !!process.env.CI, | ||
| // A spec that needs its retry every run is a bug, not a flake. One absorbs | ||
| // emulator and simulator noise, and no more. | ||
| retries: process.env.CI ? 1 : 0, | ||
| // One device, so one worker. | ||
| workers: 1, | ||
| // The heaviest spec signs in twice through the native AuthView. | ||
| timeout: 300_000, | ||
| expect: { timeout: 15_000 }, | ||
| reporter: process.env.CI | ||
| ? [['list'], ['html', { open: 'never', outputFolder: './tests/expo-native/playwright-report' }]] | ||
| : 'list', | ||
| outputDir: './tests/expo-native/test-results', | ||
|
|
||
| use: { | ||
| app: 'com.clerk.exponativebuildfixture', | ||
| // Matches 'signed in' and 'signed out' but not 'loading', so the gate holds | ||
| // until clerk-js has finished initialising rather than until the element | ||
| // merely exists. That is what the old warmup flow bought: on a cold CI | ||
| // emulator clerk-js can take past a minute, and waiting for it here charges | ||
| // the time to launchTimeout instead of to the first assertion that runs. | ||
| readyWhen: { text: 'signed' }, | ||
| actionTimeout: 20_000, | ||
| // Every spec clears state and relaunches itself, and that has to happen | ||
| // inside the test rather than in the fixture that would precede it. | ||
| // The per-test relaunch would only add a launch nothing reads. | ||
| relaunch: 'per-worker', | ||
| // CI boots a fresh device per job; a claim left by a killed run must not | ||
| // fail the next one. | ||
| onDeviceInUse: 'reclaim', | ||
| // A cold Release build on a CI emulator can take a minute to first paint. | ||
| launchTimeout: 120_000, | ||
| // Unset means the one booted device, which is what both CI jobs give us and | ||
| // what avoids agent-device's AVD-name-with-spaces translation entirely. | ||
| deviceName, | ||
| }, | ||
|
|
||
| projects: [ | ||
| { | ||
| name: 'setup-ios', | ||
| testMatch: /preflight\.setup\.ts/, | ||
| use: { platform: 'ios' }, | ||
| }, | ||
| { | ||
| name: 'setup-android', | ||
| testMatch: /preflight\.setup\.ts/, | ||
| use: { platform: 'android' }, | ||
| }, | ||
| { | ||
| name: 'ios', | ||
| dependencies: ['setup-ios'], | ||
| testIgnore: /preflight\.setup\.ts/, | ||
| use: { platform: 'ios' }, | ||
| }, | ||
| { | ||
| name: 'android', | ||
| dependencies: ['setup-android'], | ||
| testIgnore: /preflight\.setup\.ts/, | ||
| use: { platform: 'android' }, | ||
| }, | ||
| ], | ||
| }); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| *.png | ||
| test-results/ | ||
| playwright-report/ |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # Expo native e2e | ||
|
|
||
| Drives the `@clerk/expo` native components (`AuthView`, `UserButton`, | ||
| `UserProfileView`) on a real simulator or emulator, through | ||
| [touchpress](https://github.com/wobsoriano/touchpress) on the Playwright runner. | ||
| Every spec asserts across the native-to-JS bridge: a sign-in completed by the | ||
| native SDK has to show up in `useAuth()`, and a JS sign-out has to reach the | ||
| native side. | ||
|
|
||
| The app under test is the fixture in `integration/templates/expo-native`. | ||
|
|
||
| ## Running it | ||
|
|
||
| You need a booted device, the fixture installed on it, and a test user. | ||
|
|
||
| ```sh | ||
| # iOS | ||
| xcrun simctl install booted \ | ||
| integration/templates/expo-native/ios/build/Build/Products/Release-iphonesimulator/ClerkExpoNativeBuildFixture.app | ||
|
|
||
| # Android | ||
| adb install -r integration/templates/expo-native/android/app/build/outputs/apk/release/app-release.apk | ||
| ``` | ||
|
|
||
| ```sh | ||
| export CLERK_TEST_EMAIL=... CLERK_TEST_PASSWORD=... | ||
| pnpm test:integration:expo-native --project=ios | ||
| pnpm test:integration:expo-native --project=android | ||
| ``` | ||
|
|
||
| One booted device per platform. The config names no device, so it takes the one | ||
| that is booted; set `E2E_DEVICE_NAME` if you keep several running. `preflight` | ||
| fails in about a second when nothing is booted, rather than once per spec. | ||
|
|
||
| ## Writing a spec | ||
|
|
||
| `flows.ts` holds what every spec shares: `openApp`, `signInWithEmailPassword`, | ||
| `expectSignedIn`, `expectSignedOut`, and `tapControl`. Import `test` and `expect` | ||
| from there rather than from `touchpress`, so the spec gets the `control` fixture. | ||
|
|
||
| Selectors are English text and accessibility labels, because clerk-android ships | ||
| no test identifiers and both native SDKs localize every string. The devices have | ||
| to run the `en` locale. | ||
|
|
||
| Two rules the tree enforces, both explained where they are implemented: | ||
|
|
||
| - Match whole strings on anything near an icon or a heading. `getByText` is a | ||
| substring match, and `'Security'` also finds the image labelled | ||
| `icon-security`. | ||
| - Tap Clerk's own buttons through `tapControl`, which is a whole-string text tap. | ||
| Jetpack Compose puts the label on a container beside an unlabeled button, and | ||
| touchpress retargets onto it. The report shows that as `retarget to @eNN`. | ||
|
|
||
| Clearing state, going back, and typing into a focused field are `device` | ||
| methods. `clearState` relaunches and waits for the ready gate itself, and | ||
| `clearKeychain` is separate because the simulator keychain belongs to every app | ||
| on it, so `openApp` calls it first. | ||
|
|
||
| ## When a spec fails | ||
|
|
||
| The failure message carries the locator, what was expected, the names closest to | ||
| it on screen, and the whole accessibility tree. Read that before changing a | ||
| selector, and never add a sleep. CI uploads the HTML report, which carries a | ||
| screenshot and a tree listing per failed test, as `expo-native-e2e-<platform>`. |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: clerk/javascript
Length of output: 196
🏁 Script executed:
Repository: clerk/javascript
Length of output: 6236
🏁 Script executed (no clone):
Length of output: 221
🏁 Script executed:
Repository: clerk/javascript
Length of output: 6182
🏁 Script executed (no clone):
Length of output: 221
Sensitive Data Exposure (CWE-312): Cleartext Storage of Sensitive Information
Reachability: Internal · Exploitability: Moderate
Do not redact ZIP archives as text.
The scrubber does not inspect compressed ZIP members. A recorded
CLERK_TEST_PASSWORDremains in the uploaded trace. Exclude ZIP files until a format-aware scrubber can unpack, redact, and rebuild them, or configure the reporter to prevent password recording.🤖 Prompt for AI Agents