mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-16 07:30:02 -04:00
Make playwright an optional dependency in the main repo. Install with pnpm i @playwright/test
This commit is contained in:
parent
793ac9a4bd
commit
2760770b3d
10 changed files with 57 additions and 33 deletions
23
tests/util/setupPage.ts
Normal file
23
tests/util/setupPage.ts
Normal 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);
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue