Skip to content

Commit 4ba844a

Browse files
fix(scripts): iOS scenarios prepare the dev client before leasing a device
Co-Authored-By: Claude Fable 5.2 <[email protected]>
1 parent 6b47939 commit 4ba844a

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

‎docs/operations/scenarios.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ test(
178178
);
179179
```
180180

181-
`t3.project` and `t3.thread` are the same. `t3.open()` installs the dev client for the checkout's
182-
native fingerprint, loads it from Metro, and pairs it with the scenario's server. `device` is
181+
`t3.project` and `t3.thread` are the same. The run fetches or builds the dev client for the
182+
checkout's native fingerprint before it leases a device; `t3.open()` installs it, loads it from
183+
Metro, and pairs it with the scenario's server. `device` is
183184
e2e's [device fixture](https://e2e.com/docs/mobile#the-device-fixture) for system actions.
184185

185186
The run leases an iPhone 18 Pro from the Simlock pool, so it needs `SIMLOCK_AGENT_DEVICE_URL`

‎scripts/e2e.config.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ const simlock = (device: string): DeviceProvider => {
8686
const daemon = yield* connect(request.env);
8787
const client = createAgentDeviceClient(daemon);
8888
const platform = request.platform === "android" ? "android" : "ios";
89+
// A cache miss builds the dev client, which outlasts a test and can outlast a lease.
90+
request.log(`preparing the ${platform} dev client`);
91+
yield* run(
92+
resolved.node,
93+
["scripts/mobile-native-client.ts", "ensure", platform, "--prepare"],
94+
{
95+
cwd: APP_DIR,
96+
},
97+
);
8998
const scope = { tenant: "t3-scenarios", runId: `${request.runId}-${request.slot}` };
9099
// Simlock takes the lease id from the caller: 32 hex characters.
91100
const leaseId = (yield* (yield* SecureRandom.SecureRandom).uuidV4()).replaceAll("-", "");
@@ -121,7 +130,10 @@ const simlock = (device: string): DeviceProvider => {
121130
return {
122131
name: "simlock",
123132
acquire: (request) =>
124-
acquire(request).pipe(Effect.provide(NodeCrypto.layer), Effect.runPromise),
133+
acquire(request).pipe(
134+
Effect.provide([NodeCrypto.layer, NodeServices.layer]),
135+
Effect.runPromise,
136+
),
125137
release: (lease, context) =>
126138
connect(context.env).pipe(
127139
Effect.flatMap((daemon) =>

0 commit comments

Comments
 (0)