|
15 | 15 | * npx playwright test keyboard-paste --project=remote-agent |
16 | 16 | */ |
17 | 17 | import { test, expect, type Page } from "@playwright/test"; |
18 | | -import { |
19 | | - callJsonRpc, |
20 | | - getDeviceHost, |
21 | | - goToSession, |
22 | | - restartAppViaSSH, |
23 | | - sshExec, |
24 | | -} from "../helpers"; |
| 18 | +import { callJsonRpc, getDeviceHost, goToSession, restartAppViaSSH, sshExec } from "../helpers"; |
25 | 19 | import { |
26 | 20 | createRemoteAgent, |
27 | 21 | KEY, |
@@ -97,10 +91,7 @@ async function pasteText(page: Page, layoutId: string, text: string): Promise<Ma |
97 | 91 | * key codes in order (other key_press events between them are ignored — paste |
98 | 92 | * with shift modifier produces interleaved shift/key press events). |
99 | 93 | */ |
100 | | -async function waitForKeyPresses( |
101 | | - expected: number[], |
102 | | - timeoutMs = 5000, |
103 | | -): Promise<RAKeyboardEvent[]> { |
| 94 | +async function waitForKeyPresses(expected: number[], timeoutMs = 5000): Promise<RAKeyboardEvent[]> { |
104 | 95 | const deadline = Date.now() + timeoutMs; |
105 | 96 | let lastPresses: number[] = []; |
106 | 97 | while (Date.now() < deadline) { |
@@ -171,9 +162,12 @@ test.describe.configure({ mode: "serial" }); |
171 | 162 | let sharedPage: Page; |
172 | 163 |
|
173 | 164 | test.beforeAll(async ({ browser }) => { |
| 165 | + test.skip(!agent, "JETKVM_REMOTE_HOST not set"); |
174 | 166 | test.setTimeout(60_000); |
175 | | - sharedPage = await browser.newPage(); |
| 167 | + |
176 | 168 | await Promise.all([agent!.ensureDeployed(), ensureNoPasswordViaAPI()]); |
| 169 | + |
| 170 | + sharedPage = await browser.newPage(); |
177 | 171 | await goToSession(sharedPage); |
178 | 172 | await agent!.waitForInputDevices(["keyboard", "absolute_mouse", "relative_mouse"], 30000); |
179 | 173 | }); |
|
0 commit comments