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 { await this.navigate('/solutions'); } async verifyBreadcrumb(): Promise { return await this.breadcrumb.isVisible(); } async verifyPageHeader(): Promise { const header = await this.pageHeader.textContent(); return header?.includes('三种角色') || false; } async verifyAllModules(): Promise { const count = await this.page.locator('section, div:has(h2:has-text("模块"))').count(); return count >= 3; } async scrollToConsultingModule(): Promise { await this.scrollToElement(this.consultingModule); } async scrollToTechnologyModule(): Promise { await this.scrollToElement(this.technologyModule); } async scrollToPartnershipModule(): Promise { await this.scrollToElement(this.partnershipModule); } async verifyCTASection(): Promise { return await this.ctaSection.isVisible(); } async scrollToCTASection(): Promise { await this.scrollToElement(this.ctaSection); } async getModuleTitles(): Promise { const titles = this.modules.locator('h2'); return await titles.allTextContents(); } }