fix: optimize playwright config with increased timeouts and retries

This commit is contained in:
张翔
2026-03-20 07:55:29 +08:00
parent ce41fe7e26
commit 61f0c980cc
+22 -8
View File
@@ -2,21 +2,28 @@ import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './e2e',
fullyParallel: true,
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
retries: process.env.CI ? 2 : 1,
workers: process.env.CI ? 1 : 1,
reporter: [
['html'],
['junit', { outputFile: 'test-results/junit.xml' }],
['html', { outputFolder: 'playwright-report' }],
['json', { outputFile: 'test-results/results.json' }],
['list']
],
timeout: 60000,
expect: {
timeout: 10000
},
use: {
baseURL: 'http://localhost:4173',
baseURL: 'http://localhost:5173',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
headless: true,
actionTimeout: 15000,
navigationTimeout: 30000,
},
projects: [
@@ -25,4 +32,11 @@ export default defineConfig({
use: { ...devices['Desktop Chrome'] },
},
],
});
webServer: {
command: 'npm run dev',
url: 'http://localhost:5173',
reuseExistingServer: !process.env.CI,
timeout: 120000,
},
});