GeezerVison is showing github.com — chore(mobile): e2e poses for current devices, Duo and landscape fixes · pingdotgg/t3code@911091b
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: scripts/mobile-e2e/device.ts +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -65,7 +65,7 @@ export class AgentDeviceError extends Error {} | 65 | 65 |
| 66 | 66 | // A shared pool's workers drop off the gateway and stall under load for seconds at a time. | 67 | 67 | const TRANSIENT = | 68 | | - /Remote daemon is unavailable|not connected to the gateway|still finishing a previous command|Invalid daemon response|Daemon request timed out/i; | | 68 | + /Remote daemon is unavailable|not connected to the gateway|still finishing a previous command|Invalid daemon response|Daemon request timed out|no worker connected/i; | 69 | 69 |
| 70 | 70 | export class Device { | 71 | 71 | readonly pose: Pose; | @@ -172,7 +172,6 @@ export class Device { | 172 | 172 | { timeoutMs: 180_000 }, | 173 | 173 | ); | 174 | 174 | await this.acceptOpenPrompt(); | 175 | | - if (this.pose.landscape) await this.agent(["orientation", "landscape-left"]); | 176 | 175 | } | 177 | 176 |
| 178 | 177 | async openUrl(url: string) { | |
Collapse file Copy file name to clipboardExpand all lines: scripts/mobile-e2e/journey.ts +22-4Lines changed: 22 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -71,9 +71,19 @@ export async function runJourney( | 71 | 71 | steps: StepResult[], | 72 | 72 | ): Promise<void> { | 73 | 73 | const phone = device.pose.form === "phone"; | 74 | | - const tap = (node: SnapshotNode | undefined, label: string) => { | 75 | | - if (!node?.ref) throw new Error(`no ${label} to tap`); | 76 | | - return device.agent(["press", `@${node.ref}`]); | | 74 | + const tap = async (node: SnapshotNode | undefined, label: string) => { | | 75 | + if (!node?.ref || !node.rect) throw new Error(`no ${label} to tap`); | | 76 | + // agent-device refuses refs it considers covered, such as on the unfolded Duo's inner | | 77 | + // display; the element's centre still takes the tap. | | 78 | + await device | | 79 | + .agent(["press", `@${node.ref}`]) | | 80 | + .catch(() => | | 81 | + device.agent([ | | 82 | + "press", | | 83 | + String(Math.round(node.rect!.x + node.rect!.width / 2)), | | 84 | + String(Math.round(node.rect!.y + node.rect!.height / 2)), | | 85 | + ]), | | 86 | + ); | 77 | 87 | }; | 78 | 88 |
| 79 | 89 | /** Screenshot and check the settled screen, and record it as a step. */ | @@ -126,10 +136,18 @@ export async function runJourney( | 126 | 136 | .catch(() => null); | 127 | 137 | } | 128 | 138 | if (!threads) throw new Error("the app did not show the fixture threads after pairing"); | 129 | | - await delay(1_000); | | 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); | 130 | 142 | threads = await device.snapshot(); | 131 | 143 | const tabs = tabBarRect(threads); | | 144 | + const wide = threads.viewport.width > threads.viewport.height; | 132 | 145 | await capture("threads", threads, [ | | 146 | + check( | | 147 | + device.pose.landscape ? "in landscape" : "in portrait", | | 148 | + wide === Boolean(device.pose.landscape), | | 149 | + `${Math.round(threads.viewport.width)}×${Math.round(threads.viewport.height)}`, | | 150 | + ), | 133 | 151 | check("thread list visible", threadRow(threads) !== undefined, "fixture threads"), | 134 | 152 | ...(phone ? [check("tab bar visible", inside(tabs, threads), describeRect(tabs))] : []), | 135 | 153 | ]); | |
Collapse file Copy file name to clipboardExpand all lines: scripts/mobile-e2e/poses.ts +32-28Lines changed: 32 additions & 28 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@ export interface Pose { | 5 | 5 | readonly device: string; | 6 | 6 | readonly form: "phone" | "tablet"; | 7 | 7 | readonly appearance: "light" | "dark"; | 8 | | - /** Phones are portrait-only; tablets also run rotated. */ | | 8 | + /** Phones are portrait-locked; tablets and an unfolded Fold can start rotated. */ | 9 | 9 | readonly landscape?: boolean; | 10 | 10 | readonly fold?: "closed" | "open"; | 11 | 11 | readonly textSize?: "accessibility-large"; | @@ -22,79 +22,83 @@ export const POSES: ReadonlyArray<Pose> = [ | 22 | 22 | appearance: "light", | 23 | 23 | }), | 24 | 24 | pose({ | 25 | | - id: "iphone-13-mini-dark", | | 25 | + id: "iphone-18-pro-dark", | 26 | 26 | platform: "ios", | 27 | | - device: "iPhone 13 mini", | | 27 | + device: "iPhone 18 Pro", | 28 | 28 | form: "phone", | 29 | 29 | appearance: "dark", | 30 | 30 | }), | 31 | 31 | pose({ | 32 | | - id: "iphone-17-pro", | | 32 | + id: "iphone-duo-folded", | 33 | 33 | platform: "ios", | 34 | | - device: "iPhone 17 Pro", | | 34 | + device: "iPhone Duo", | 35 | 35 | form: "phone", | 36 | 36 | appearance: "light", | | 37 | + fold: "closed", | 37 | 38 | }), | 38 | 39 | pose({ | 39 | | - id: "iphone-17-pro-max-large-text", | | 40 | + id: "iphone-duo-unfolded", | 40 | 41 | platform: "ios", | 41 | | - device: "iPhone 17 Pro Max", | 42 | | - form: "phone", | | 42 | + device: "iPhone Duo", | | 43 | + form: "tablet", | 43 | 44 | appearance: "dark", | 44 | | - textSize: "accessibility-large", | | 45 | + fold: "open", | 45 | 46 | }), | 46 | 47 | pose({ | 47 | | - id: "ipad-mini", | | 48 | + id: "ipad-13-portrait", | 48 | 49 | platform: "ios", | 49 | | - device: "iPad mini (A17 Pro)", | | 50 | + device: "iPad Pro 13-inch (M5)", | 50 | 51 | form: "tablet", | 51 | 52 | appearance: "light", | 52 | 53 | }), | 53 | 54 | pose({ | 54 | | - id: "ipad-pro-13-landscape", | | 55 | + id: "ipad-13-landscape-large-text", | 55 | 56 | platform: "ios", | 56 | 57 | device: "iPad Pro 13-inch (M5)", | 57 | 58 | form: "tablet", | 58 | 59 | appearance: "dark", | 59 | 60 | landscape: true, | | 61 | + textSize: "accessibility-large", | 60 | 62 | }), | 61 | 63 | pose({ | 62 | | - id: "pixel-9", | | 64 | + id: "pixel-10-pro-large-text", | 63 | 65 | platform: "android", | 64 | | - device: "Pixel 9", | | 66 | + device: "Pixel 10 Pro", | 65 | 67 | form: "phone", | 66 | 68 | appearance: "light", | | 69 | + textSize: "accessibility-large", | 67 | 70 | }), | 68 | 71 | pose({ | 69 | | - id: "small-phone-dark", | | 72 | + id: "pixel-fold-folded-dark", | 70 | 73 | platform: "android", | 71 | | - device: "Small Phone", | | 74 | + device: "Pixel 10 Pro Fold", | 72 | 75 | form: "phone", | 73 | 76 | appearance: "dark", | | 77 | + fold: "closed", | 74 | 78 | }), | 75 | 79 | pose({ | 76 | | - id: "pixel-9-large-text", | | 80 | + id: "pixel-fold-unfolded", | 77 | 81 | platform: "android", | 78 | | - device: "Pixel 9", | 79 | | - form: "phone", | | 82 | + device: "Pixel 10 Pro Fold", | | 83 | + form: "tablet", | 80 | 84 | appearance: "light", | 81 | | - textSize: "accessibility-large", | | 85 | + fold: "open", | 82 | 86 | }), | 83 | 87 | pose({ | 84 | | - id: "pixel-fold-closed", | | 88 | + id: "pixel-fold-unfolded-landscape", | 85 | 89 | platform: "android", | 86 | | - device: "Pixel 9 Pro Fold", | 87 | | - form: "phone", | 88 | | - appearance: "light", | 89 | | - fold: "closed", | | 90 | + device: "Pixel 10 Pro Fold", | | 91 | + form: "tablet", | | 92 | + appearance: "dark", | | 93 | + fold: "open", | | 94 | + landscape: true, | 90 | 95 | }), | 91 | 96 | pose({ | 92 | | - id: "pixel-fold-open", | | 97 | + id: "pixel-tablet-portrait", | 93 | 98 | platform: "android", | 94 | | - device: "Pixel 9 Pro Fold", | | 99 | + device: "Pixel Tablet", | 95 | 100 | form: "tablet", | 96 | 101 | appearance: "dark", | 97 | | - fold: "open", | 98 | 102 | }), | 99 | 103 | pose({ | 100 | 104 | id: "pixel-tablet-landscape", | |
|