Files
张翔 adb3e8f734 test: 新增User Journey和UAT测试用例覆盖dogfood测试流程
- 新增5个User Journey测试(UJ-014~UJ-018):页面标题验证、新闻筛选流程、品牌名一致性
- 新增19个UAT测试(UAT-053增强、UAT-130~142):标题无重复公司名、简体品牌名、结构化数据
- 新增Playwright验证测试用于修复效果确认
2026-05-03 09:15:42 +08:00

102 lines
4.0 KiB
TypeScript

import { test, expect } from '@playwright/test';
test.describe('Page title verification after fixes', () => {
test('about page title has no duplicate company name', async ({ page }) => {
await page.goto('http://localhost:3000/about');
await page.waitForLoadState('networkidle');
const title = await page.title();
expect(title).toBe('关于我们 - 睿新致远 | 四川睿新致远科技有限公司');
expect(title.match(/睿新致远/g)?.length).toBeLessThanOrEqual(2);
});
test('contact page title has no duplicate company name', async ({ page }) => {
await page.goto('http://localhost:3000/contact');
await page.waitForLoadState('networkidle');
const title = await page.title();
expect(title).toBe('联系我们 - 睿新致远 | 四川睿新致远科技有限公司');
});
test('team page title uses displayName', async ({ page }) => {
await page.goto('http://localhost:3000/team');
await page.waitForLoadState('networkidle');
const title = await page.title();
expect(title).toContain('睿新致远');
expect(title).not.toContain('睿新致遠');
});
test('news page title uses displayName', async ({ page }) => {
await page.goto('http://localhost:3000/news');
await page.waitForLoadState('networkidle');
const title = await page.title();
expect(title).toBe('新闻动态 - 睿新致远 | 四川睿新致远科技有限公司');
});
test('products page title uses displayName', async ({ page }) => {
await page.goto('http://localhost:3000/products');
await page.waitForLoadState('networkidle');
const title = await page.title();
expect(title).toBe('产品 - 睿新致远 | 四川睿新致远科技有限公司');
});
test('services page title uses displayName', async ({ page }) => {
await page.goto('http://localhost:3000/services');
await page.waitForLoadState('networkidle');
const title = await page.title();
expect(title).toBe('服务 - 睿新致远 | 四川睿新致远科技有限公司');
});
test('solutions page title uses displayName', async ({ page }) => {
await page.goto('http://localhost:3000/solutions');
await page.waitForLoadState('networkidle');
const title = await page.title();
expect(title).toBe('解决方案 - 睿新致远 | 四川睿新致远科技有限公司');
});
test('privacy page title uses displayName', async ({ page }) => {
await page.goto('http://localhost:3000/privacy');
await page.waitForLoadState('networkidle');
const title = await page.title();
expect(title).toBe('隐私政策 - 睿新致远 | 四川睿新致远科技有限公司');
});
test('terms page title uses displayName', async ({ page }) => {
await page.goto('http://localhost:3000/terms');
await page.waitForLoadState('networkidle');
const title = await page.title();
expect(title).toBe('服务条款 - 睿新致远 | 四川睿新致远科技有限公司');
});
test('news category filter works correctly', async ({ page }) => {
await page.goto('http://localhost:3000/news');
await page.waitForLoadState('networkidle');
const allNews = page.locator('a[href*="/news/"]');
const initialCount = await allNews.count();
expect(initialCount).toBe(2);
const companyNewsBtn = page.locator('button:has-text("公司新闻")');
await companyNewsBtn.click();
await page.waitForTimeout(500);
const filteredCount = await allNews.count();
expect(filteredCount).toBe(1);
const productNewsBtn = page.locator('button:has-text("产品发布")');
await productNewsBtn.click();
await page.waitForTimeout(500);
const productFilteredCount = await allNews.count();
expect(productFilteredCount).toBe(1);
});
test('hero section still uses shortName for visual branding', async ({ page }) => {
await page.goto('http://localhost:3000');
await page.waitForLoadState('networkidle');
const heroText = page.locator('.font-brand').first();
if (await heroText.isVisible()) {
const text = await heroText.textContent();
expect(text).toContain('睿新致遠');
}
});
});