@devries-cameron20 / t3code-1 / commits / 3e47c1cabc
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(mobile): e2e landscape poses rotate for real on tablets and folds

agent-device names rotations relative to the device's natural orientation, which is landscape on the Pixel Tablet and an unfolded Fold, so "landscape-left" turned them portrait. The runner now asks for a shape and tries each rotation until the screen has it. It also prepares each platform's dev client before leasing, rides out longer worker drops, and skips the Duo poses by default until agent-device can fold Simlock's simulators. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 26, 2026 at 03:26 UTC 3e47c1cabc463145e485f1ee02e092832cd45c34
4 files changed +40 -11
scripts/mobile-e2e.ts
+13 -3
@@ -139,7 +139,10 @@ async function runPose(
139 async function main() {
140 const args = NodeProcess.argv.slice(2);
141 if (args.includes("--list")) {
142 - for (const pose of POSES) NodeProcess.stdout.write(`${pose.id}\t${pose.device}\n`);
142 + for (const pose of POSES)
143 + NodeProcess.stdout.write(
144 + `${pose.id}\t${pose.device}${pose.pending ? `\t(pending: ${pose.pending})` : ""}\n`,
145 + );
146 return;
147 }
148 const values = (flag: string) =>
@@ -150,7 +153,7 @@ async function main() {
153 const platforms = values("--platform");
154 const poses = POSES.filter(
155 (pose) =>
153 - (selected.length === 0 || selected.includes(pose.id)) &&
156 + (selected.length === 0 ? !pose.pending : selected.includes(pose.id)) &&
157 (platforms.length === 0 || platforms.includes(pose.platform)),
158 );
159 const concurrencyFlag = values("--concurrency")[0];
@@ -221,8 +224,15 @@ async function main() {
224 },
225 );
226 await waitForPort(metroPort, "Metro", 120_000);
224 - // Warm each platform's bundle once, instead of on every device at once.
227 + // Warm each platform's bundle once, instead of on every device at once, and have its dev
228 + // client cached before any lease: a cache miss builds, which can outlast a lease.
229 for (const platform of new Set(poses.map((pose) => pose.platform))) {
230 + log("e2e", `preparing the ${platform} dev client`);
231 + await run(
232 + NodeProcess.execPath,
233 + ["scripts/mobile-native-client.ts", "ensure", platform, "--prepare"],
234 + { cwd: REPO_ROOT, timeoutMs: 1_800_000 },
235 + );
236 log("e2e", `bundling for ${platform}`);
237 await run("curl", [
238 "-sf",
scripts/mobile-e2e/device.ts
+18 -2
@@ -105,9 +105,9 @@ export class Device {
105 try {
106 return await this.agentOnce(args, options);
107 } catch (error) {
108 - if (attempt >= 3 || !(error instanceof AgentDeviceError) || !TRANSIENT.test(error.message))
108 + if (attempt >= 5 || !(error instanceof AgentDeviceError) || !TRANSIENT.test(error.message))
109 throw error;
110 - await delay(3_000 * attempt);
110 + await delay(5_000 * attempt);
111 }
112 }
113 }
@@ -174,6 +174,22 @@ export class Device {
174 await this.acceptOpenPrompt();
175 }
176
177 + /**
178 + * agent-device names rotations relative to the device's natural orientation, which is
179 + * landscape on tablets and unfolded folds, so try each name until the screen has the shape.
180 + */
181 + async orient(shape: "landscape" | "portrait"): Promise<Snapshot> {
182 + let snapshot = await this.snapshot();
183 + for (const name of ["landscape-left", "portrait", "landscape-right"]) {
184 + const { width, height } = snapshot.viewport;
185 + if (width > height === (shape === "landscape")) return snapshot;
186 + await this.agent(["orientation", name]);
187 + await delay(2_000);
188 + snapshot = await this.snapshot();
189 + }
190 + return snapshot;
191 + }
192 +
193 async openUrl(url: string) {
194 await this.agent(["open", BUNDLE_ID, url]);
195 await this.acceptOpenPrompt();
scripts/mobile-e2e/journey.ts
+3 -6
@@ -137,9 +137,8 @@ export async function runJourney(
137 }
138 if (!threads) throw new Error("the app did not show the fixture threads after pairing");
139 // Rotated only once the app is up: a rotation during launch is lost.
140 - if (device.pose.landscape) await device.agent(["orientation", "landscape-left"]);
141 - await delay(device.pose.landscape ? 2_000 : 1_000);
142 - threads = await device.snapshot();
140 + await delay(1_000);
141 + threads = await device.orient(device.pose.landscape ? "landscape" : "portrait");
142 const tabs = tabBarRect(threads);
143 const wide = threads.viewport.width > threads.viewport.height;
144 await capture("threads", threads, [
@@ -270,9 +269,7 @@ export async function runJourney(
269 await capture("settings", await device.snapshot());
270
271 if (device.pose.form === "tablet" && !device.pose.fold) {
273 - await device.agent(["orientation", device.pose.landscape ? "portrait" : "landscape-left"]);
274 - await delay(2_000);
275 - await capture("rotated", await device.snapshot());
272 + await capture("rotated", await device.orient(device.pose.landscape ? "portrait" : "landscape"));
273 }
274 if (device.pose.fold) {
275 await device.agent(["fold", device.pose.fold === "open" ? "closed" : "open"]);
scripts/mobile-e2e/poses.ts
+6
@@ -9,6 +9,8 @@ export interface Pose {
9 readonly landscape?: boolean;
10 readonly fold?: "closed" | "open";
11 readonly textSize?: "accessibility-large";
12 + /** Why the pose is skipped unless named with --pose. */
13 + readonly pending?: string;
14 }
15
16 const pose = (value: Pose) => value;
@@ -35,6 +37,8 @@ export const POSES: ReadonlyArray<Pose> = [
37 form: "phone",
38 appearance: "light",
39 fold: "closed",
40 + pending:
41 + "agent-device fold refuses simulators outside the default device set, which Simlock uses",
42 }),
43 pose({
44 id: "iphone-duo-unfolded",
@@ -43,6 +47,8 @@ export const POSES: ReadonlyArray<Pose> = [
47 form: "tablet",
48 appearance: "dark",
49 fold: "open",
50 + pending:
51 + "agent-device fold refuses simulators outside the default device set, which Simlock uses",
52 }),
53 pose({
54 id: "ipad-13-portrait",