feat(e2e): 添加完整的E2E测试框架和测试用例
添加Playwright测试框架配置和基础页面对象 实现冒烟测试用例覆盖首页和联系页面核心功能 更新导航组件以支持滚动高亮功能 添加BackButton组件统一返回按钮行为 配置Woodpecker CI集成和测试报告生成
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
export interface TestData {
|
||||
name: string;
|
||||
email: string;
|
||||
phone?: string;
|
||||
company?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface ContactFormData extends TestData {
|
||||
subject?: string;
|
||||
}
|
||||
|
||||
export interface NavigationItem {
|
||||
label: string;
|
||||
href: string;
|
||||
expectedUrl?: string;
|
||||
}
|
||||
|
||||
export interface PerformanceMetrics {
|
||||
loadTime: number;
|
||||
firstContentfulPaint: number;
|
||||
largestContentfulPaint: number;
|
||||
timeToInteractive: number;
|
||||
cumulativeLayoutShift: number;
|
||||
firstInputDelay: number;
|
||||
}
|
||||
|
||||
export interface PerformanceThresholds {
|
||||
loadTime: number;
|
||||
firstContentfulPaint: number;
|
||||
largestContentfulPaint: number;
|
||||
timeToInteractive: number;
|
||||
cumulativeLayoutShift: number;
|
||||
firstInputDelay: number;
|
||||
}
|
||||
|
||||
export interface DeviceConfig {
|
||||
name: string;
|
||||
viewport: { width: number; height: number };
|
||||
userAgent?: string;
|
||||
isMobile: boolean;
|
||||
}
|
||||
|
||||
export interface TestResult {
|
||||
test: string;
|
||||
status: 'passed' | 'failed' | 'skipped';
|
||||
duration: number;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface AccessibilityViolation {
|
||||
id: string;
|
||||
impact: 'critical' | 'serious' | 'moderate' | 'minor';
|
||||
description: string;
|
||||
help: string;
|
||||
helpUrl: string;
|
||||
nodes: any[];
|
||||
}
|
||||
|
||||
export interface VisualRegressionResult {
|
||||
baseline: string;
|
||||
current: string;
|
||||
diff?: string;
|
||||
mismatchedPixels: number;
|
||||
passed: boolean;
|
||||
}
|
||||
|
||||
export interface PageElement {
|
||||
selector: string;
|
||||
text?: string;
|
||||
visible?: boolean;
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export interface TestConfig {
|
||||
baseURL: string;
|
||||
timeout: number;
|
||||
retries: number;
|
||||
headless: boolean;
|
||||
screenshotOnFailure: boolean;
|
||||
traceOnFailure: boolean;
|
||||
videoOnFailure: boolean;
|
||||
}
|
||||
|
||||
export interface TestCase {
|
||||
name: string;
|
||||
description: string;
|
||||
tags: string[];
|
||||
priority: 'critical' | 'high' | 'medium' | 'low';
|
||||
dependencies?: string[];
|
||||
}
|
||||
|
||||
export interface TestSuite {
|
||||
name: string;
|
||||
description: string;
|
||||
tests: TestCase[];
|
||||
}
|
||||
|
||||
export interface ApiResponse {
|
||||
status: number;
|
||||
data: any;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface ErrorDetails {
|
||||
message: string;
|
||||
stack?: string;
|
||||
code?: string;
|
||||
}
|
||||
|
||||
export interface TestEnvironment {
|
||||
name: string;
|
||||
url: string;
|
||||
isProduction: boolean;
|
||||
browser: string;
|
||||
version: string;
|
||||
}
|
||||
Reference in New Issue
Block a user