t3-code-android-nightly/apps/web/test/browserSetup.ts
Julius Marminge 924d9c1fff
feat(projects): worktree layout commands run only once a person approves them (#42386)
Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 13:48:39 -08:00

26 lines
1.1 KiB
TypeScript

import { beforeEach } from "vite-plus/test";
import { commands } from "vite-plus/test/browser";
import { initializeI18n } from "../src/i18n/initializeI18n";
declare module "vite-plus/test/browser" {
interface BrowserCommands {
/** Defined in vite.config.ts. Moves Playwright's mouse off the page. */
resetPointer: () => Promise<void>;
/** Defined in vite.config.ts. Presses the primary button where the mouse is, without releasing. */
pointerDown: () => Promise<void>;
/** Defined in vite.config.ts. Releases the primary button. */
pointerUp: () => Promise<void>;
}
}
// Playwright's mouse outlives each test and each file, so whatever the next test mounts
// under its last position starts hovered. Registered here rather than in render() so tests
// that mount without it are covered too. Before each test, not after: a timed-out test keeps
// running and can move the mouse after its own afterEach.
beforeEach(async () => {
await commands.resetPointer();
});
// The app initializes GT at startup; components using its hooks need the same here.
initializeI18n(() => {});