File size: 844 Bytes
bee6636 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
/* eslint-disable no-async-promise-executor */
import { expect, FrameLocator, Page } from "@playwright/test";
import { registerInspect } from "./inspectConsole";
export async function setupPage(page: Page, url: string): Promise<FrameLocator> {
// Hack to disable HTTP cache.
await page.route("**", route => route.continue());
// 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");
registerInspect(page);
return frame;
} |