This repository has been archived on 2025-04-22. You can view files and clone it, but cannot push or open issues or pull requests.
playwright-demo/tests/hlk/fixtures/base.js
rsgltzyd db0603dcfd
Some checks failed
Playwright Tests / test (push) Has been cancelled
init
2024-11-07 22:00:35 +08:00

39 lines
883 B
JavaScript

const { test: base, expect, devices } = require('@playwright/test');
const authFile = '.auth/hlk_admin.json';
const test = base.extend({
/**
* @type {import('@playwright/test').Page}
*/
touchPage: async ({ browser, baseURL }, use) => {
const context = await browser.newContext({
storageState: authFile,
});
const page = await context.newPage();
await page.goto(baseURL);
await use(page);
await page.close();
await context.close();
},
/**
* @type {import('@playwright/test').Page}
*/
h5Page: async ({ browser }, use) => {
const iPhone = devices['iPhone 11'];
const context = await browser.newContext({
...iPhone,
storageState: undefined,
});
const page = await context.newPage();
await page.goto(process.env.H5_BASE_URL);
await use(page);
},
});
module.exports = {
test,
expect,
};