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('睿新致遠'); } }); });