feat(e2e): 添加完整的E2E测试框架和测试用例

添加Playwright测试框架配置和基础页面对象
实现冒烟测试用例覆盖首页和联系页面核心功能
更新导航组件以支持滚动高亮功能
添加BackButton组件统一返回按钮行为
配置Woodpecker CI集成和测试报告生成
This commit is contained in:
张翔
2026-02-27 10:30:33 +08:00
parent 4a616fe96e
commit 5d5b7feb0a
50 changed files with 6765 additions and 46 deletions
+21
View File
@@ -0,0 +1,21 @@
import { test, expect } from '@playwright/test';
test('检查联系页面完整DOM', async ({ page }) => {
await page.goto('/contact');
await page.waitForLoadState('networkidle');
const contactCard = page.locator('[class*="card"]').filter({ hasText: '联系方式' }).first();
const contactCardHTML = await contactCard.innerHTML();
console.log('联系卡片HTML:', contactCardHTML.substring(0, 500));
const contactCardChildren = await contactCard.locator('div').all();
console.log('联系卡片子元素数量:', contactCardChildren.length);
for (let i = 0; i < contactCardChildren.length; i++) {
const child = contactCardChildren[i];
const className = await child.evaluate(el => el.className);
const text = await child.textContent();
console.log(`子元素 ${i}: ${className.substring(0, 50)} - ${text?.substring(0, 50)}`);
}
});