Skip to content

Commit f14cf6b

Browse files
authored
perf(test): speed up pairing access polling (#127047)
1 parent c60a266 commit f14cf6b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎ui/src/app/app-host-pairing-access.test.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { render, type TemplateResult } from "lit";
44
import { afterEach, describe, expect, it, vi } from "vitest";
55
import type { GatewayBrowserClient } from "../api/gateway.ts";
6+
import { waitForFast } from "../test-helpers/wait-for.ts";
67
import type { ApplicationRuntime } from "./bootstrap.ts";
78
import type { ApplicationContext, ApplicationGatewaySnapshot } from "./context.ts";
89
import "./app-host.ts";
@@ -121,7 +122,7 @@ function createPairingShell(params: {
121122
// replaces the eager loading shell with the full dialog.
122123
const renderPairingDialog = async () => {
123124
renderSidebar();
124-
return await vi.waitFor(() => {
125+
return await waitForFast(() => {
125126
render(shell.render(), container);
126127
const dialog = container.querySelector<HTMLElement>(
127128
'.device-pair-setup:not([aria-busy="true"])',
@@ -302,7 +303,7 @@ describe("application shell pairing access", () => {
302303

303304
button?.click();
304305

305-
await vi.waitFor(() => expect(button?.textContent?.trim()).toBe("Copy failed"));
306+
await waitForFast(() => expect(button?.textContent?.trim()).toBe("Copy failed"));
306307
expect(button?.getAttribute("aria-label")).toBe("Copy failed");
307308
expect(button?.querySelector("svg")).not.toBeNull();
308309
expect(writeText).toHaveBeenCalledWith("pair-mobile-secret");
@@ -328,7 +329,7 @@ describe("application shell pairing access", () => {
328329
});
329330

330331
renderSidebar();
331-
await vi.waitFor(() => {
332+
await waitForFast(() => {
332333
render(shell.render(), container);
333334
expect(container.querySelector('[role="timer"]')?.textContent).toContain("0:01");
334335
});

0 commit comments

Comments
 (0)