- 更新 CI/CD 子域名反向代理配置 - 调整 Nginx 静态文件服务器配置 - 更新 CONTEXT.md 领域共享语言文档 - 添加 CLAUDE.md 代理工作指南 - 更新 Playwright E2E 测试配置
101 lines
2.5 KiB
TypeScript
101 lines
2.5 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
export default defineConfig({
|
|
testDir: './',
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: process.env.CI ? 1 : undefined,
|
|
reporter: [
|
|
['html', { open: 'never' }],
|
|
['list', { printSteps: true }],
|
|
],
|
|
snapshotDir: './visual-snapshots',
|
|
snapshotPathTemplate: '{snapshotDir}/{projectName}/{testFilePath}/{arg}-{projectName}{ext}',
|
|
use: {
|
|
baseURL: process.env.E2E_BASE_URL || 'http://localhost:3000',
|
|
trace: 'on-first-retry',
|
|
screenshot: 'only-on-failure',
|
|
ignoreHTTPSErrors: true,
|
|
actionTimeout: 15000,
|
|
navigationTimeout: 30000,
|
|
},
|
|
expect: {
|
|
toHaveScreenshot: {
|
|
maxDiffPixels: 200,
|
|
maxDiffPixelRatio: 0.005,
|
|
threshold: 0.3,
|
|
animations: 'disabled',
|
|
caret: 'hide',
|
|
scale: 'device',
|
|
timeout: 20000,
|
|
},
|
|
timeout: 15000,
|
|
},
|
|
projects: [
|
|
{
|
|
name: 'visual-chromium-desktop',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
viewport: { width: 1280, height: 800 },
|
|
},
|
|
testMatch: 'visual-regression.spec.ts',
|
|
},
|
|
{
|
|
name: 'visual-chromium-tablet',
|
|
use: {
|
|
...devices['iPad Pro 11'],
|
|
viewport: { width: 834, height: 1194 },
|
|
},
|
|
testMatch: 'visual-regression.spec.ts',
|
|
},
|
|
{
|
|
name: 'visual-chromium-mobile',
|
|
use: {
|
|
...devices['iPhone 14'],
|
|
viewport: { width: 390, height: 844 },
|
|
isMobile: true,
|
|
hasTouch: true,
|
|
},
|
|
testMatch: 'visual-regression.spec.ts',
|
|
},
|
|
{
|
|
name: 'visual-firefox-desktop',
|
|
use: {
|
|
...devices['Desktop Firefox'],
|
|
viewport: { width: 1280, height: 800 },
|
|
},
|
|
testMatch: 'visual-regression.spec.ts',
|
|
},
|
|
{
|
|
name: 'visual-webkit-desktop',
|
|
use: {
|
|
...devices['Desktop Safari'],
|
|
viewport: { width: 1280, height: 800 },
|
|
},
|
|
testMatch: 'visual-regression.spec.ts',
|
|
},
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
testIgnore: 'visual-regression.spec.ts',
|
|
},
|
|
{
|
|
name: 'firefox',
|
|
use: { ...devices['Desktop Firefox'] },
|
|
testIgnore: 'visual-regression.spec.ts',
|
|
},
|
|
{
|
|
name: 'webkit',
|
|
use: { ...devices['Desktop Safari'] },
|
|
testIgnore: 'visual-regression.spec.ts',
|
|
},
|
|
],
|
|
webServer: {
|
|
command: 'npm run preview',
|
|
url: 'http://localhost:3000',
|
|
reuseExistingServer: true,
|
|
timeout: 120000,
|
|
},
|
|
});
|