feat: 添加面包屑导航组件并优化页面布局

refactor: 重构页面结构和导航逻辑

fix: 修复移动端菜单导航和滚动行为

perf: 优化图片加载性能和资源请求

test: 添加端到端测试和性能测试用例

docs: 更新.gitignore文件

chore: 更新依赖和配置

style: 优化代码格式和类型安全

ci: 调整Playwright测试超时时间

build: 更新Next.js配置和构建选项
This commit is contained in:
张翔
2026-02-28 09:09:04 +08:00
parent 9d01e0982f
commit 9451814ca4
60 changed files with 4078 additions and 148 deletions
+207
View File
@@ -0,0 +1,207 @@
import { test, expect } from '../../fixtures/base.fixture';
test.describe('Smoke Tests - All Major Pages', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/');
});
test('Home page loads successfully', async ({ homePage }) => {
await homePage.waitForLoadState('load');
const title = await homePage.getTitle();
expect(title).toContain('睿新致远');
});
test('About page loads successfully', async ({ aboutPage }) => {
await aboutPage.navigateToAbout();
await aboutPage.waitForLoadState('load');
await expect.poll(async () => await aboutPage.verifyBreadcrumb(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await aboutPage.verifyPageHeader(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await aboutPage.verifyValuesSection(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await aboutPage.verifyMilestonesSection(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await aboutPage.verifyContactSection(), {
timeout: 10000,
}).toBeTruthy();
});
test('Cases page loads successfully', async ({ casesPage }) => {
await casesPage.navigateToCases();
await casesPage.waitForLoadState('load');
await expect.poll(async () => await casesPage.verifyBreadcrumb(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await casesPage.verifyPageHeader(), {
timeout: 10000,
}).toBeTruthy();
const caseCount = await casesPage.getCaseCount();
expect(caseCount).toBeGreaterThan(0);
await expect.poll(async () => await casesPage.verifyCTASection(), {
timeout: 10000,
}).toBeTruthy();
});
test('Services page loads successfully', async ({ servicesPage }) => {
await servicesPage.navigateToServices();
await servicesPage.waitForLoadState('load');
await expect.poll(async () => await servicesPage.verifyBreadcrumb(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await servicesPage.verifyPageHeader(), {
timeout: 10000,
}).toBeTruthy();
const serviceCount = await servicesPage.getServiceCount();
expect(serviceCount).toBeGreaterThan(0);
await expect.poll(async () => await servicesPage.verifyCTASection(), {
timeout: 10000,
}).toBeTruthy();
});
test('Products page loads successfully', async ({ productsPage }) => {
await productsPage.navigateToProducts();
await productsPage.waitForLoadState('load');
await expect.poll(async () => await productsPage.verifyBreadcrumb(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await productsPage.verifyPageHeader(), {
timeout: 10000,
}).toBeTruthy();
const productCount = await productsPage.getProductCount();
expect(productCount).toBeGreaterThan(0);
await expect.poll(async () => await productsPage.verifyCTASection(), {
timeout: 10000,
}).toBeTruthy();
});
test('Solutions page loads successfully', async ({ solutionsPage }) => {
await solutionsPage.navigateToSolutions();
await solutionsPage.waitForLoadState('load');
await expect.poll(async () => await solutionsPage.verifyBreadcrumb(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await solutionsPage.verifyPageHeader(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await solutionsPage.verifyAllModules(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await solutionsPage.verifyCTASection(), {
timeout: 10000,
}).toBeTruthy();
});
test('News page loads successfully', async ({ newsPage }) => {
await newsPage.navigateToNews();
await newsPage.waitForLoadState('load');
await expect.poll(async () => await newsPage.verifyBreadcrumb(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await newsPage.verifyPageHeader(), {
timeout: 10000,
}).toBeTruthy();
const newsCount = await newsPage.getNewsCount();
expect(newsCount).toBeGreaterThan(0);
});
test('Contact page loads successfully', async ({ contactPage }) => {
await contactPage.navigateToContact();
await contactPage.waitForLoadState('load');
await expect.poll(async () => await contactPage.verifyBreadcrumb(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await contactPage.verifyPageHeader(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await contactPage.verifyContactForm(), {
timeout: 10000,
}).toBeTruthy();
await expect.poll(async () => await contactPage.verifyContactInfo(), {
timeout: 10000,
}).toBeTruthy();
});
test('Navigation between pages works', async ({ page, aboutPage, casesPage, servicesPage }) => {
await aboutPage.navigateToAbout();
await aboutPage.waitForLoadState('load');
const aboutURL = await aboutPage.getCurrentURL();
expect(aboutURL).toContain('/about');
await casesPage.navigateToCases();
await casesPage.waitForLoadState('load');
const casesURL = await casesPage.getCurrentURL();
expect(casesURL).toContain('/cases');
await servicesPage.navigateToServices();
await servicesPage.waitForLoadState('load');
const servicesURL = await servicesPage.getCurrentURL();
expect(servicesURL).toContain('/services');
});
test('Breadcrumb navigation works correctly', async ({ page, aboutPage, casesPage }) => {
await aboutPage.navigateToAbout();
await aboutPage.waitForLoadState('load');
const breadcrumbLinks = page.locator('nav[aria-label="breadcrumb"] a');
const linkCount = await breadcrumbLinks.count();
expect(linkCount).toBeGreaterThan(0);
await casesPage.navigateToCases();
await casesPage.waitForLoadState('load');
const breadcrumbText = await page.locator('nav[aria-label="breadcrumb"]').textContent();
expect(breadcrumbText).toContain('成功案例');
});
test('All pages have consistent navigation', async ({ page }) => {
const pages = ['/about', '/cases', '/services', '/products', '/solutions', '/news', '/contact'];
for (const pagePath of pages) {
await page.goto(pagePath);
await page.waitForLoadState('load');
const header = page.locator('header');
await expect.poll(async () => await header.isVisible(), {
timeout: 10000,
}).toBeTruthy();
const breadcrumb = page.locator('nav[aria-label="breadcrumb"]');
await expect.poll(async () => await breadcrumb.isVisible(), {
timeout: 10000,
}).toBeTruthy();
}
});
});