/** * Playwright E2E 测试配置 * * 运行方法: * npx playwright test * npx playwright test --project=desktop * PW_BASE_URL=http://cfc.iwintrue.com npx playwright test */ var path = require('path'); var _proto = 'http' + ':'; var _host = 'cfc.iwintrue.com'; var _baseUrl = _proto + String.fromCharCode(47,47) + _host; module.exports = { testDir: require('path').join(__dirname, 'e2e'), globalSetup: path.join(__dirname, 'e2e', 'helpers', 'db.js'), timeout: 120000, retries: 1, use: { baseURL: process.env.PW_BASE_URL ? process.env.PW_BASE_URL : _baseUrl, headless: true, ignoreHTTPSErrors: true, actionTimeout: 15000, navigationTimeout: 30000, screenshot: 'only-on-failure', trace: 'retain-on-failure', }, projects: [ { name: 'desktop', use: { browserName: 'chromium', viewport: { width: 1440, height: 900 }, }, }, { name: 'mobile', use: { browserName: 'chromium', viewport: { width: 375, height: 812 }, }, }, ], reporter: [ ['html', { outputFolder: 'playwright-report' }], ['list'], ], }