diff --git a/apps/mobile/src/components/ComposerToolbar.tsx b/apps/mobile/src/components/ComposerToolbar.tsx index 36ed505d27cd0..a901d6fa60b50 100644 --- a/apps/mobile/src/components/ComposerToolbar.tsx +++ b/apps/mobile/src/components/ComposerToolbar.tsx @@ -376,6 +376,7 @@ export function ComposerToolbarButton(props: { { + const project = await t3.project("demo"); + const { threadId } = await t3.thread({ project, title: "Latched keys", messages: ["hello"] }); + await t3.open(); + await screen.getByText("Latched keys", { exact: false }).first().waitFor({ timeout: 120_000 }); + + const environment = await runPromise( + environmentId(`http://${MOBILE.host}:${MOBILE.serverPort}`), + ); + await device.openLink(`t3code-dev://threads/${environment}/${threadId}/terminal`, { + app: "com.t3tools.t3code.dev", + }); + await device.alert("accept").catch(() => {}); + + // The keyboard toolbar shows with the software keyboard; ctrl starts past its right edge. + const esc = screen.getByRole("button", "esc"); + await esc.waitFor({ timeout: 60_000 }); + const box = await esc.boundingBox(); + const x = (box?.x ?? 0) + (box?.width ?? 0); + const y = (box?.y ?? 0) + (box?.height ?? 0) / 2; + // A slow drag, so the scroller stops with ctrl in view instead of flinging to its end. + await screen.swipe({ from: { x, y }, to: { x: x - 150, y }, duration: 1_500 }); + const ctrl = screen.getByRole("button", "ctrl"); + await ctrl.waitFor(); + await ctrl.tap(); + await app.screenshot("ctrl-latched"); + await expect(ctrl).toBeSelected(); + + await ctrl.tap(); + await expect(ctrl).not.toBeSelected(); + }, +);