Skip to content

Commit 7076f2f

Browse files
committed
E2E tests
1 parent 9ce1170 commit 7076f2f

2 files changed

Lines changed: 486 additions & 0 deletions

File tree

ui/e2e/helpers.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,3 +1350,34 @@ declare global {
13501350
};
13511351
}
13521352
}
1353+
1354+
/** Navigate to the device session page and wait for connectivity. */
1355+
export async function goToSession(page: Page) {
1356+
await page.goto("/");
1357+
await waitForWebRTCReady(page);
1358+
}
1359+
1360+
/** Navigate to the keyboard settings page. */
1361+
export async function goToKeyboardSettings(page: Page) {
1362+
await page.goto("/settings/keyboard");
1363+
await page.waitForLoadState("networkidle");
1364+
}
1365+
1366+
/** Get the list of layouts via JSON-RPC. */
1367+
export async function getLayouts(page: Page) {
1368+
return callJsonRpc(page, "getKeyboardLayouts") as Promise<
1369+
Array<{ id: string; name: string; builtin: boolean }>
1370+
>;
1371+
}
1372+
1373+
/** Get a specific layout's full data via JSON-RPC. */
1374+
export async function getLayoutData(page: Page, id: string) {
1375+
return callJsonRpc(page, "getKeyboardLayoutData", { id }) as Promise<{
1376+
id: string;
1377+
name: string;
1378+
keys: Array<{ scancode: number; legends: Record<string, string> }>;
1379+
charMap: Record<string, unknown>;
1380+
boardW: number;
1381+
boardH: number;
1382+
}>;
1383+
}

0 commit comments

Comments
 (0)