test(e2e): add GA4 tracking, mobile, user journey tests and update visual baselines

- Add GA4 event tracking E2E tests (4 cases: page view, form submit, button click, product page)
- Add mobile-specific E2E tests (16 cases: navigation, form, product browsing)
- Add user journey tests (UJ-01: homepage to contact, UJ-02: product discovery)
- Fix E2E test selectors and assertions for consistency
- Update visual regression baselines across all browsers (chromium/firefox/webkit)
- Update Playwright config for new test files
This commit is contained in:
2026-07-31 20:24:57 +08:00
parent dd088a5ee1
commit 3e629bd9ee
27 changed files with 964 additions and 58 deletions
+4 -4
View File
@@ -13,7 +13,7 @@ import { test, expect } from '@playwright/test';
test.setTimeout(60000);
// ==================== 1. 404 页面测试 ====================
test.describe('404 页面 - 未找到页面', () => {
test.describe('404 页面 - 未找到页面', { tag: '@regression' }, () => {
test('访问不存在的页面显示 404', async ({ page }) => {
await page.goto('/this-page-does-not-exist', { waitUntil: 'domcontentloaded', timeout: 30000 });
@@ -68,7 +68,7 @@ test.describe('404 页面 - 未找到页面', () => {
});
// ==================== 2. 错误边界测试 ====================
test.describe('错误边界 - 应用级错误处理', () => {
test.describe('错误边界 - 应用级错误处理', { tag: '@regression' }, () => {
test('错误页面包含重试按钮', async ({ page }) => {
// 通过直接访问错误页面组件路径模拟错误状态
@@ -95,7 +95,7 @@ test.describe('错误边界 - 应用级错误处理', () => {
});
// ==================== 3. 加载状态测试 ====================
test.describe('加载状态 - 页面过渡', () => {
test.describe('加载状态 - 页面过渡', { tag: '@regression' }, () => {
test('页面加载时显示主要内容', async ({ page }) => {
await page.goto('/', { waitUntil: 'domcontentloaded', timeout: 30000 });
@@ -139,7 +139,7 @@ test.describe('加载状态 - 页面过渡', () => {
});
// ==================== 4. 无效路由与特殊字符测试 ====================
test.describe('无效路由 - 边界 URL 处理', () => {
test.describe('无效路由 - 边界 URL 处理', { tag: '@regression' }, () => {
test('带特殊字符的路由不崩溃', async ({ page }) => {
const specialPaths = [