feat: add E2E test examples using shared layer
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { PerformanceMonitor } from '../../test-framework/shared/utils/performance/PerformanceMonitor';
|
||||
import { performanceThresholds } from '../../test-framework/shared/config/test-data';
|
||||
|
||||
test.describe('性能测试', () => {
|
||||
test('首页加载时间应该小于阈值', async ({ page }) => {
|
||||
const monitor = new PerformanceMonitor(page);
|
||||
await page.goto('/');
|
||||
|
||||
const metrics = await monitor.measurePageLoad();
|
||||
|
||||
expect(metrics.loadTime).toBeLessThan(performanceThresholds.loadTime);
|
||||
});
|
||||
|
||||
test('DOM内容加载时间应该小于阈值', async ({ page }) => {
|
||||
const monitor = new PerformanceMonitor(page);
|
||||
await page.goto('/');
|
||||
|
||||
const metrics = await monitor.measurePageLoad();
|
||||
|
||||
expect(metrics.domContentLoaded).toBeLessThan(performanceThresholds.domContentLoaded);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user