55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
// @ts-check
|
|
const {defineConfig, devices} = require('@playwright/test');
|
|
|
|
/**
|
|
* @see https://playwright.dev/docs/test-configuration
|
|
*/
|
|
module.exports = defineConfig({
|
|
testDir: './tests/e2e',
|
|
/* 测试超时时间 */
|
|
timeout: 60 * 60 * 1000, // 1小时
|
|
/* 每个测试的预期状态 */
|
|
expect: {
|
|
/**
|
|
* 断言超时时间
|
|
*/
|
|
timeout: 30000
|
|
},
|
|
/* 测试运行并发数 */
|
|
fullyParallel: false,
|
|
forbidOnly: !!process.env.CI,
|
|
/* 失败重试次数 */
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: 1,
|
|
/* 测试报告相关 */
|
|
reporter: 'html',
|
|
/* 共享设置 */
|
|
use: {
|
|
/* 基础URL */
|
|
baseURL: process.env.BASE_URL,
|
|
|
|
/* 收集测试追踪信息 */
|
|
trace: 'on-first-retry',
|
|
/* 自动截图 */
|
|
screenshot: 'only-on-failure',
|
|
/* 录制视频 */
|
|
video: 'retain-on-failure',
|
|
headless: false,
|
|
viewport: { width: 1920, height: 1080 },
|
|
},
|
|
|
|
/* 配置不同的浏览器项目 */
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: {...devices['Desktop Chrome']},
|
|
},
|
|
],
|
|
|
|
/* 本地开发服务器配置 */
|
|
// webServer: {
|
|
// command: 'npm run start',
|
|
// port: 3000,
|
|
// reuseExistingServer: !process.env.CI,
|
|
// },
|
|
});
|