refactor/google-analytics #16
@@ -71,11 +71,8 @@ test.describe('网站全面测试验收', () => {
|
||||
await page.goto('/about');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const contactSection = page.locator('text=/联系我们/').locator('..').locator('..');
|
||||
if (await contactSection.isVisible()) {
|
||||
const phoneText = contactSection.locator('text=/联系电话|028-88888888/');
|
||||
expect(await phoneText.count()).toBe(0);
|
||||
}
|
||||
const phoneElements = page.locator('text=/电话|028-|1[3-9]\\d{9}/');
|
||||
expect(await phoneElements.count()).toBe(0);
|
||||
});
|
||||
|
||||
test('响应式设计正常工作', async ({ page }) => {
|
||||
@@ -120,12 +117,14 @@ test.describe('网站全面测试验收', () => {
|
||||
await page.goto('/contact');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const submitButton = page.locator('button[type="submit"]');
|
||||
await submitButton.click();
|
||||
|
||||
const nameInput = page.locator('input[name="name"]');
|
||||
const errorMessage = nameInput.locator('..').locator('text=/至少需要2个字符/');
|
||||
await expect(errorMessage).toBeVisible();
|
||||
await nameInput.fill('a');
|
||||
await nameInput.blur();
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const errorMessage = page.locator('text=至少需要2个字符').first();
|
||||
await expect(errorMessage).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
test('页面加载性能良好', async ({ page }) => {
|
||||
@@ -142,8 +141,15 @@ test.describe('网站全面测试验收', () => {
|
||||
});
|
||||
|
||||
test('无障碍访问正常', async ({ page }) => {
|
||||
const accessibilityIssues = await page.accessibility.snapshot();
|
||||
expect(accessibilityIssues).toBeDefined();
|
||||
const mainHeading = page.locator('h1');
|
||||
await expect(mainHeading).toBeVisible();
|
||||
|
||||
const nav = page.locator('nav').first();
|
||||
await expect(nav).toBeVisible();
|
||||
|
||||
const buttons = page.locator('button');
|
||||
const buttonCount = await buttons.count();
|
||||
expect(buttonCount).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('联系我们页面没有返回按钮覆盖logo', async ({ page }) => {
|
||||
|
||||
@@ -110,7 +110,7 @@ function HeaderContent() {
|
||||
>
|
||||
<Image
|
||||
src={headerTheme === 'dark' ? '/logo-white.svg' : '/logo.svg'}
|
||||
alt={COMPANY_INFO.name}
|
||||
alt={COMPANY_INFO.shortName}
|
||||
width={128}
|
||||
height={32}
|
||||
className="transition-transform duration-200 group-hover:scale-105"
|
||||
|
||||
Reference in New Issue
Block a user