Files
novalon-website/e2e/src/pages/SolutionsPage.ts
T
张翔 9451814ca4 feat: 添加面包屑导航组件并优化页面布局
refactor: 重构页面结构和导航逻辑

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

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

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

docs: 更新.gitignore文件

chore: 更新依赖和配置

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

ci: 调整Playwright测试超时时间

build: 更新Next.js配置和构建选项
2026-02-28 09:09:04 +08:00

83 lines
2.2 KiB
TypeScript

import { Page, Locator } from '@playwright/test';
import { BasePage } from './BasePage';
export class SolutionsPage 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 modules(): Locator {
return this.page.locator('div[class*="from-[#FFFBF5]"], div[class*="from-white"]');
}
get consultingModule(): Locator {
return this.page.locator('div:has(h2:has-text("数字化转型咨询"))').first();
}
get technologyModule(): Locator {
return this.page.locator('div:has(h2:has-text("信息技术解决方案"))').first();
}
get partnershipModule(): Locator {
return this.page.locator('div:has(h2:has-text("长期陪跑服务"))').first();
}
get ctaSection(): Locator {
return this.page.locator('div:has(h2:has-text("准备开始您的数字化转型之旅"))').first();
}
async navigateToSolutions(): Promise<void> {
await this.navigate('/solutions');
}
async verifyBreadcrumb(): Promise<boolean> {
return await this.breadcrumb.isVisible();
}
async verifyPageHeader(): Promise<boolean> {
const header = await this.pageHeader.textContent();
return header?.includes('三种角色') || false;
}
async verifyAllModules(): Promise<boolean> {
const count = await this.page.locator('section, div:has(h2:has-text("模块"))').count();
return count >= 3;
}
async scrollToConsultingModule(): Promise<void> {
await this.scrollToElement(this.consultingModule);
}
async scrollToTechnologyModule(): Promise<void> {
await this.scrollToElement(this.technologyModule);
}
async scrollToPartnershipModule(): Promise<void> {
await this.scrollToElement(this.partnershipModule);
}
async verifyCTASection(): Promise<boolean> {
return await this.ctaSection.isVisible();
}
async scrollToCTASection(): Promise<void> {
await this.scrollToElement(this.ctaSection);
}
async getModuleTitles(): Promise<string[]> {
const titles = this.modules.locator('h2');
return await titles.allTextContents();
}
}