下面是我的代码。当应用程序提供服务并开始测试时,它使用我传入的 BASE_URL await page.goto(BASE_URL)。我想为我的所有请求使用另一条路线。
describe("Screenshots - PLAYWRIGHT", () => {
it("Takes screenshots for multiple browsers", async () => {
for (const browserType of ["chromium", "firefox", "webkit"]) {
const browser = await playwright[browserType].launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto(BASE_URL);
await page.waitForLoadState("networkidle");
await page.screenshot({ path: `screenshots/example-${browserType}.png` });
await browser.close();
}
});
});