08ea5fbe98
添加用户管理视图、API和状态管理文件
74 lines
2.1 KiB
TypeScript
74 lines
2.1 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
export default defineConfig({
|
|
testDir: './e2e',
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 1,
|
|
workers: process.env.CI ? 4 : 2,
|
|
failOnFlakyTests: !!process.env.CI,
|
|
reporter: [
|
|
['./e2e/reporters/progress-reporter.ts'],
|
|
['html', { open: 'never' }],
|
|
['json', { outputFile: 'test-results/results.json' }],
|
|
['junit', { outputFile: 'test-results/junit.xml' }]
|
|
],
|
|
use: {
|
|
baseURL: process.env.ADMIN_BASE_URL || 'http://localhost:5174',
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
video: 'retain-on-failure',
|
|
headless: true,
|
|
viewport: { width: 1280, height: 720 },
|
|
ignoreHTTPSErrors: true,
|
|
actionTimeout: 30000,
|
|
navigationTimeout: 30000
|
|
},
|
|
projects: [
|
|
{
|
|
name: 'api-integration',
|
|
testMatch: /.*\.api\.spec\.ts/,
|
|
use: {
|
|
baseURL: process.env.API_BASE_URL || 'http://localhost:8080',
|
|
extraHTTPHeaders: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
},
|
|
},
|
|
{
|
|
name: 'integration-chromium',
|
|
testMatch: /.*\.integration\.spec\.ts/,
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
baseURL: process.env.ADMIN_BASE_URL || 'http://localhost:5174',
|
|
},
|
|
},
|
|
{
|
|
name: 'chromium',
|
|
testMatch: /^(?!.*\.(api|integration)\.spec\.ts).*\.spec\.ts$/,
|
|
use: { ...devices['Desktop Chrome'] },
|
|
},
|
|
{
|
|
name: 'firefox',
|
|
testMatch: /^(?!.*\.(api|integration)\.spec\.ts).*\.spec\.ts$/,
|
|
use: { ...devices['Desktop Firefox'] },
|
|
},
|
|
{
|
|
name: 'webkit',
|
|
testMatch: /^(?!.*\.(api|integration)\.spec\.ts).*\.spec\.ts$/,
|
|
use: { ...devices['Desktop Safari'] },
|
|
},
|
|
{
|
|
name: 'Mobile Chrome',
|
|
testMatch: /^(?!.*\.(api|integration)\.spec\.ts).*\.spec\.ts$/,
|
|
use: { ...devices['Pixel 5'] },
|
|
},
|
|
{
|
|
name: 'Mobile Safari',
|
|
testMatch: /^(?!.*\.(api|integration)\.spec\.ts).*\.spec\.ts$/,
|
|
use: { ...devices['iPhone 12'] },
|
|
}
|
|
],
|
|
webServer: undefined,
|
|
});
|