style(theme): 更新网站主题色彩方案与字体配置
- 调整主色调从 #1C1C1C 至 #1A1A1A,优化视觉层次 - 更新背景色系为暖白色调 (#FAFAF7, #F5F4F0 等) - 配置中文字体栈,添加 serif 字体支持 - 优化文本颜色梯度,提升可读性 - 调整边框颜色,统一水墨风格 - 添加 Google Search Console 验证码配置项 - 新增桌面应用架构专家代理配置文件 - 重构 E2E 测试等待策略,提升稳定性 - 添加回归测试脚本,增强质量保障
This commit is contained in:
@@ -59,12 +59,12 @@ test.describe('网站全面测试验收', () => {
|
||||
expect(count).toBeGreaterThan(0);
|
||||
|
||||
await navLinks.nth(0).click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForURL(/\/.+/, { timeout: 10000 });
|
||||
});
|
||||
|
||||
test('联系我们页面没有显示公司电话', async ({ page }) => {
|
||||
await page.goto('/contact');
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.goto('/contact', { waitUntil: 'load' });
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
const contactInfoSection = page.locator('[data-testid="contact-info"]');
|
||||
if (await contactInfoSection.isVisible()) {
|
||||
@@ -75,8 +75,9 @@ test.describe('网站全面测试验收', () => {
|
||||
});
|
||||
|
||||
test('联系我们页面表单正常显示', async ({ page }) => {
|
||||
await page.goto('/contact');
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.goto('/contact', { waitUntil: 'load' });
|
||||
// 等待 React 客户端渲染完成
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
await expect(page.locator('[data-testid="name-input"]')).toBeVisible();
|
||||
await expect(page.locator('[data-testid="phone-input"]')).toBeVisible();
|
||||
@@ -94,8 +95,8 @@ test.describe('网站全面测试验收', () => {
|
||||
});
|
||||
|
||||
test('关于我们页面没有显示公司电话', async ({ page }) => {
|
||||
await page.goto('/about');
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.goto('/about', { waitUntil: 'load' });
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
const contactTexts = page.locator('text=/联系我们|联系方式|Contact/');
|
||||
const contactCount = await contactTexts.count();
|
||||
@@ -130,14 +131,13 @@ test.describe('网站全面测试验收', () => {
|
||||
const contactLink = page.locator('text=联系我们').first();
|
||||
if (await contactLink.isVisible()) {
|
||||
await contactLink.click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
expect(page.url()).toContain('/contact');
|
||||
await page.waitForURL(/\/contact/, { timeout: 10000 });
|
||||
}
|
||||
|
||||
const homeLink = page.locator('text=首页').first();
|
||||
if (await homeLink.isVisible()) {
|
||||
await homeLink.click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForURL(/\//, { timeout: 10000 });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -148,31 +148,33 @@ test.describe('网站全面测试验收', () => {
|
||||
const privacyLink = footer.locator('a:has-text("隐私政策")');
|
||||
if (await privacyLink.isVisible()) {
|
||||
await privacyLink.click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
expect(page.url()).toContain('/privacy');
|
||||
await page.waitForURL(/\/privacy/, { timeout: 10000 });
|
||||
|
||||
await page.goBack();
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForURL(/\//, { timeout: 10000 });
|
||||
}
|
||||
|
||||
const termsLink = footer.locator('a:has-text("服务条款")');
|
||||
if (await termsLink.isVisible()) {
|
||||
await termsLink.click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
expect(page.url()).toContain('/terms');
|
||||
await page.waitForURL(/\/terms/, { timeout: 10000 });
|
||||
}
|
||||
});
|
||||
|
||||
test('表单验证功能正常', async ({ page }) => {
|
||||
await page.goto('/contact');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.goto('/contact', { waitUntil: 'load' });
|
||||
// 等待 React 客户端渲染完成
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
const submitButton = page.locator('[data-testid="submit-button"]');
|
||||
await expect(submitButton).toBeVisible({ timeout: 10000 });
|
||||
await submitButton.click();
|
||||
|
||||
const errorMessages = page.locator('text=/至少需要2个字符|请输入|必填|required/');
|
||||
|
||||
// 等待 Zod 验证错误渲染
|
||||
const errorMessages = page.locator('[data-testid="error-message"]');
|
||||
await expect(errorMessages.first()).toBeVisible({ timeout: 10000 });
|
||||
|
||||
const errorCount = await errorMessages.count();
|
||||
|
||||
expect(errorCount).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
@@ -190,14 +192,45 @@ test.describe('网站全面测试验收', () => {
|
||||
});
|
||||
|
||||
test('无障碍访问正常', async ({ page }) => {
|
||||
const accessibilitySnapshot = await page.accessibility.snapshot();
|
||||
expect(accessibilitySnapshot).toBeDefined();
|
||||
expect(accessibilitySnapshot).not.toBeNull();
|
||||
const htmlLang = await page.locator('html').getAttribute('lang');
|
||||
expect(htmlLang).toBe('zh-CN');
|
||||
|
||||
const skipLink = page.locator('[data-skip-to-content]');
|
||||
await expect(skipLink).toBeVisible();
|
||||
expect(await skipLink.textContent()).toContain('跳转到主要内容');
|
||||
await expect(skipLink).toHaveAttribute('href', '#main-content');
|
||||
|
||||
const main = page.locator('main[id="main-content"]');
|
||||
await expect(main).toBeVisible();
|
||||
await expect(main).toHaveAttribute('role', 'main');
|
||||
await expect(main).toHaveAttribute('aria-label', '页面主体内容');
|
||||
|
||||
const images = page.locator('img');
|
||||
const imgCount = await images.count();
|
||||
let imagesWithoutAlt = 0;
|
||||
for (let i = 0; i < imgCount; i++) {
|
||||
const alt = await images.nth(i).getAttribute('alt');
|
||||
if (!alt) imagesWithoutAlt++;
|
||||
}
|
||||
expect(imagesWithoutAlt).toBe(0);
|
||||
|
||||
const header = page.locator('header');
|
||||
await expect(header).toBeVisible();
|
||||
|
||||
const desktopNav = page.locator('[data-testid="desktop-navigation"]');
|
||||
await expect(desktopNav).toHaveAttribute('aria-label', '主导航');
|
||||
|
||||
const footer = page.locator('[data-testid="footer"]');
|
||||
await expect(footer).toHaveAttribute('role', 'contentinfo');
|
||||
|
||||
const focusableElements = page.locator('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
||||
const focusCount = await focusableElements.count();
|
||||
expect(focusCount).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('联系我们页面没有返回按钮覆盖logo', async ({ page }) => {
|
||||
await page.goto('/contact');
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.goto('/contact', { waitUntil: 'load' });
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
const logoSelectors = [
|
||||
'header img[alt*="睿新致远"]',
|
||||
@@ -240,4 +273,4 @@ test.describe('网站全面测试验收', () => {
|
||||
expect(logoCenterY).toBeLessThan(headerBox.y + headerBox.height);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user