Skip to content

Commit 98c0b1d

Browse files
authored
test: migrate test app to expo dev client (#881)
* test: migrate test app to expo dev client * docs: align test app device targeting * docs: clarify dev client setup tradeoffs * docs: remove stale sdk reference
1 parent 24cb2b6 commit 98c0b1d

7 files changed

Lines changed: 171 additions & 55 deletions

File tree

CONTRIBUTING.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,23 @@ pnpm exec vitest run src/compat/maestro/__tests__/replay-flow.test.ts src/compat
8282
Run the Expo test-app flow on iOS:
8383

8484
```bash
85-
pnpm test-app:start
86-
pnpm ad --session test-app-maestro open "Expo Go" exp://127.0.0.1:8081 --platform ios --device "iPhone 17 Pro"
85+
pnpm test-app:ios -- --device "iPhone 17 Pro"
86+
pnpm ad --session test-app-maestro open "Agent Device Tester" --platform ios --device "iPhone 17 Pro"
8787
pnpm ad --session test-app-maestro wait "Agent Device Tester" 30000 --platform ios --device "iPhone 17 Pro"
8888
pnpm test-app:maestro:ios -- --session test-app-maestro -- --device "iPhone 17 Pro"
8989
```
9090

91-
Use `pnpm test-app:maestro:android` for Android, passing the same extra
92-
`agent-device` flags after `--`.
91+
`pnpm test-app:ios` keeps Metro in the foreground after launching the app. Leave
92+
that terminal running and run the `agent-device` and Maestro commands from a
93+
separate terminal.
94+
95+
When targeting a specific Android emulator or device, build and install the
96+
development client on that same target before running Maestro:
97+
98+
```bash
99+
pnpm test-app:android -- --device "$ANDROID_DEVICE"
100+
pnpm test-app:maestro:android -- --session test-app-maestro -- --device "$ANDROID_DEVICE"
101+
```
93102

94103
## Guidelines
95104

examples/test-app/README.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,29 @@ These are the main case families this app can support without adding more screen
4545

4646
## Run locally
4747

48+
This fixture uses an Expo development build, not Expo Go. Expo's development-build
49+
workflow installs `expo-dev-client`, builds the native app with `expo run:ios` or
50+
`expo run:android`, and then serves JavaScript from Metro with `expo start`.
51+
The app declares `@expo/dom-webview` directly to keep Expo's development runtime
52+
on the SDK 56 native module; Android verification failed when the dev client
53+
resolved an older transitive copy.
54+
4855
From the repo root:
4956

5057
```bash
5158
pnpm test-app:install
52-
pnpm test-app:ios
59+
pnpm test-app:ios -- --device "iPhone 17 Pro"
5360
```
5461

62+
`expo run:*` keeps Metro in the foreground after launching the app. Leave that
63+
terminal running, then use a separate terminal for `agent-device` or Maestro
64+
commands.
65+
5566
Or on Android:
5667

5768
```bash
5869
pnpm test-app:install
59-
pnpm test-app:android
70+
pnpm test-app:android -- --device "$ANDROID_DEVICE"
6071
```
6172

6273
If you prefer to work from inside the app folder:
@@ -75,7 +86,10 @@ pnpm install --ignore-workspace
7586
pnpm android
7687
```
7788

78-
Once the app is running, use `agent-device` against `Agent Device Tester` like any other target app.
89+
After the first native build is installed, use `pnpm test-app:start` when you only
90+
need to restart Metro for JavaScript or TypeScript changes. Once the app is
91+
running, use `agent-device` against `Agent Device Tester` like any other target
92+
app.
7993

8094
## Local Agent Device suites
8195

@@ -102,13 +116,13 @@ underlying command directly so global flags stay before replay inputs:
102116
node bin/agent-device.mjs test examples/test-app/replays \
103117
--platform ios \
104118
--device "iPhone 17 Pro" \
105-
--env APP_TARGET=dev.expo.easagentdevice \
119+
--env APP_TARGET=com.callstack.agentdevicelab \
106120
--env APP_URL=<project-url> \
107121
--artifacts-dir .tmp/test-app-replay/ios
108122
```
109123

110-
Use `APP_TARGET=com.callstack.agentdevicelab` when the standalone fixture app is
111-
installed instead of an Expo development shell.
124+
Omit `APP_URL` when the installed development build can discover the local Metro
125+
server from its launcher.
112126

113127
The Maestro prototype suite lives in `examples/test-app/maestro` and runs through
114128
`agent-device replay --maestro`:
@@ -118,11 +132,11 @@ pnpm test-app:maestro:ios -- --open "Agent Device Tester"
118132
pnpm test-app:maestro:android -- --open "Agent Device Tester"
119133
```
120134

121-
When running through Expo Go, start the project first and pass the shell that is already showing
122-
the app, for example:
135+
When the development build is already open and connected to Metro, omit
136+
`--open` and run the suite against the existing session:
123137

124138
```bash
125-
pnpm test-app:maestro:ios -- --open "Expo Go"
139+
pnpm test-app:maestro:ios
126140
```
127141

128142
The suite intentionally covers the compat layer syntax used by public Maestro suites:

examples/test-app/maestro/checkout-form.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
appId: host.exp.Exponent
1+
appId: com.callstack.agentdevicelab
22
env:
33
CHECKOUT_NAME: Ada Lovelace
44
CHECKOUT_EMAIL: ada@example.com

examples/test-app/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44
"private": true,
55
"main": "expo-router/entry",
66
"scripts": {
7-
"start": "expo start",
8-
"ios": "expo start --ios",
9-
"android": "expo start --android",
7+
"start": "expo start --dev-client",
8+
"ios": "expo run:ios",
9+
"android": "expo run:android",
1010
"typecheck": "tsc --noEmit"
1111
},
1212
"dependencies": {
13+
"@expo/dom-webview": "~56.0.5",
1314
"@expo/metro-runtime": "~56.0.15",
1415
"expo": "~56.0.12",
1516
"expo-constants": "56.0.18",
17+
"expo-dev-client": "~56.0.20",
1618
"expo-linking": "56.0.14",
1719
"expo-router": "~56.2.11",
1820
"expo-status-bar": "~56.0.4",

0 commit comments

Comments
 (0)