const { test: base, expect, devices } = require('@playwright/test'); const path = require('path'); const authFile = path.resolve(__dirname, '../../.auth/admin.json'); const zhbAuthFile = path.join(__dirname, '../.auth/zhb_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); }, /** * @type {import('@playwright/test').Page} */ zhbPage: async ({ browser, baseURL }, use) => { const context = await browser.newContext({ storageState: zhbAuthFile, }); const page = await context.newPage(); await page.goto(baseURL); await use(page); await page.close(); await context.close(); }, }); module.exports = { test, expect, };