9451814ca4
refactor: 重构页面结构和导航逻辑 fix: 修复移动端菜单导航和滚动行为 perf: 优化图片加载性能和资源请求 test: 添加端到端测试和性能测试用例 docs: 更新.gitignore文件 chore: 更新依赖和配置 style: 优化代码格式和类型安全 ci: 调整Playwright测试超时时间 build: 更新Next.js配置和构建选项
78 lines
1.9 KiB
TypeScript
78 lines
1.9 KiB
TypeScript
import { Page, Locator } from '@playwright/test';
|
|
import { BasePage } from './BasePage';
|
|
|
|
export class AboutPage extends BasePage {
|
|
readonly page: Page;
|
|
|
|
constructor(page: Page) {
|
|
super(page);
|
|
this.page = page;
|
|
}
|
|
|
|
get breadcrumb(): Locator {
|
|
return this.page.locator('nav[aria-label="breadcrumb"]');
|
|
}
|
|
|
|
get pageHeader(): Locator {
|
|
return this.page.locator('h1');
|
|
}
|
|
|
|
get valuesSection(): Locator {
|
|
return this.page.locator('div:has(h2:has-text("核心价值观"))').first();
|
|
}
|
|
|
|
get milestonesSection(): Locator {
|
|
return this.page.locator('div:has(h2:has-text("发展历程"))').first();
|
|
}
|
|
|
|
get contactSection(): Locator {
|
|
return this.page.locator('div:has(h2:has-text("联系我们"))').first();
|
|
}
|
|
|
|
get statCards(): Locator {
|
|
return this.page.locator('[class*="text-3xl"][class*="text-[#C41E3A]"]');
|
|
}
|
|
|
|
async navigateToAbout(): Promise<void> {
|
|
await this.navigate('/about');
|
|
}
|
|
|
|
async verifyBreadcrumb(): Promise<boolean> {
|
|
return await this.breadcrumb.isVisible();
|
|
}
|
|
|
|
async verifyPageHeader(): Promise<boolean> {
|
|
const header = await this.pageHeader.textContent();
|
|
return header?.includes('关于我们') || false;
|
|
}
|
|
|
|
async verifyValuesSection(): Promise<boolean> {
|
|
return await this.valuesSection.isVisible();
|
|
}
|
|
|
|
async verifyMilestonesSection(): Promise<boolean> {
|
|
return await this.milestonesSection.isVisible();
|
|
}
|
|
|
|
async verifyContactSection(): Promise<boolean> {
|
|
return await this.contactSection.isVisible();
|
|
}
|
|
|
|
async getStatValues(): Promise<string[]> {
|
|
const stats = await this.statCards.allTextContents();
|
|
return stats;
|
|
}
|
|
|
|
async scrollToValuesSection(): Promise<void> {
|
|
await this.scrollToElement(this.valuesSection);
|
|
}
|
|
|
|
async scrollToMilestonesSection(): Promise<void> {
|
|
await this.scrollToElement(this.milestonesSection);
|
|
}
|
|
|
|
async scrollToContactSection(): Promise<void> {
|
|
await this.scrollToElement(this.contactSection);
|
|
}
|
|
}
|