- 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
54 lines
2.0 KiB
TypeScript
54 lines
2.0 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
||
|
||
test.describe('Footer ICP/Police BeiAn Visibility', { tag: '@regression' }, () => {
|
||
test('desktop: ICP and police bei an should be visible', async ({ page }) => {
|
||
await page.setViewportSize({ width: 1440, height: 900 });
|
||
await page.goto('/');
|
||
await page.waitForLoadState('networkidle');
|
||
|
||
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
|
||
await page.waitForTimeout(500);
|
||
|
||
const icp = page.getByText(/蜀ICP备/);
|
||
const police = page.getByText(/川公网安备/);
|
||
|
||
await expect(icp).toBeVisible();
|
||
await expect(police).toBeVisible();
|
||
|
||
const icpBox = await icp.boundingBox();
|
||
const policeBox = await police.boundingBox();
|
||
|
||
console.log('桌面端 ICP位置:', icpBox);
|
||
console.log('桌面端 公安备案位置:', policeBox);
|
||
});
|
||
|
||
test('mobile: ICP and police bei an should be visible above tab bar', async ({ page }) => {
|
||
await page.setViewportSize({ width: 390, height: 844 });
|
||
await page.goto('/');
|
||
await page.waitForLoadState('networkidle');
|
||
|
||
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
|
||
await page.waitForTimeout(500);
|
||
|
||
const icp = page.getByText(/蜀ICP备/);
|
||
const police = page.getByText(/川公网安备/);
|
||
|
||
await expect(icp).toBeVisible();
|
||
await expect(police).toBeVisible();
|
||
|
||
const icpBox = await icp.boundingBox();
|
||
const policeBox = await police.boundingBox();
|
||
const viewport = page.viewportSize();
|
||
|
||
console.log('移动端 ICP位置:', icpBox);
|
||
console.log('移动端 公安备案位置:', policeBox);
|
||
console.log('移动端 视口高度:', viewport.height);
|
||
|
||
// 确保备案信息在视口内(底部tab bar高度约64px + safe area)
|
||
const tabBarEstimatedBottom = viewport.height;
|
||
if (icpBox) {
|
||
console.log('ICP底部距离视口底部:', tabBarEstimatedBottom - (icpBox.y + icpBox.height));
|
||
}
|
||
});
|
||
});
|