Make playwright an optional dependency in the main repo. Install with pnpm i @playwright/test

This commit is contained in:
wearrrrr 2024-10-21 03:09:39 -05:00
parent 793ac9a4bd
commit 2760770b3d
10 changed files with 57 additions and 33 deletions

23
tests/util/setupPage.ts Normal file
View file

@ -0,0 +1,23 @@
/* eslint-disable no-async-promise-executor */
import { expect, FrameLocator, Page } from "@playwright/test";
export function setupPage(page: Page, url: string): Promise<FrameLocator> {
return new Promise(async (resolve) => {
// Goto base url defined in config.
await page.goto("/");
await page.waitForSelector(".version > b");
const bar = page.locator(".bar");
const title = await page.locator(".version > b").textContent();
const frame = page.frameLocator("iframe");
expect(title).toBe("scramjet");
expect(bar).not.toBeNull();
await bar.fill(url);
await page.waitForTimeout(1000);
await bar.press("Enter");
resolve(frame);
});
}