feat: add test tier configuration and tiered playwright config
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
export interface TestTierConfig {
|
||||
name: string;
|
||||
description: string;
|
||||
testMatch: string | RegExp;
|
||||
timeout: number;
|
||||
retries: number;
|
||||
workers: number | string;
|
||||
fullyParallel: boolean;
|
||||
failFast: boolean;
|
||||
}
|
||||
|
||||
export const TEST_TIERS: Record<string, TestTierConfig> = {
|
||||
fast: {
|
||||
name: '快速层',
|
||||
description: '冒烟测试、API测试、基础功能验证',
|
||||
testMatch: /.*\.smoke\.spec\.ts$|.*\.api\.spec\.ts$/,
|
||||
timeout: 30000,
|
||||
retries: 1,
|
||||
workers: process.env.CI ? 6 : '75%',
|
||||
fullyParallel: true,
|
||||
failFast: true,
|
||||
},
|
||||
standard: {
|
||||
name: '标准层',
|
||||
description: '功能测试、响应式测试、移动端核心功能',
|
||||
testMatch: /.*(admin|navigation|responsive|mobile).*\.spec\.ts$/,
|
||||
timeout: 60000,
|
||||
retries: 2,
|
||||
workers: process.env.CI ? 4 : '50%',
|
||||
fullyParallel: true,
|
||||
failFast: false,
|
||||
},
|
||||
deep: {
|
||||
name: '深度层',
|
||||
description: '视觉回归、性能测试、完整回归测试',
|
||||
testMatch: /.*(visual|performance|regression).*\.spec\.ts$/,
|
||||
timeout: 120000,
|
||||
retries: 3,
|
||||
workers: process.env.CI ? 2 : '25%',
|
||||
fullyParallel: false,
|
||||
failFast: false,
|
||||
},
|
||||
};
|
||||
|
||||
export function getTestTier(tierName: string): TestTierConfig {
|
||||
return TEST_TIERS[tierName] || TEST_TIERS.standard;
|
||||
}
|
||||
Reference in New Issue
Block a user