This repository has been archived on 2025-04-22. You can view files and clone it, but cannot push or open issues or pull requests.
hlk_autotest/tests/pages/customer/customerAnalysisPage.ts
LingandRX 6517e4192c feat: 初始化慧来客自动化测试项目
- 添加项目配置文件和环境变量设置
- 创建测试用例目录结构和命名规范
- 实现基础测试 fixture 和页面对象模型
- 添加示例测试用例和数据生成器
- 配置 playwright 和 gitignore 文件
2024-12-22 19:18:27 +08:00

37 lines
1.1 KiB
TypeScript

import { Page } from 'playwright';
export class CustomerAnalysisPage {
page: Page;
subPages: { name: string; url?: string[] }[];
/**
* 顾客分析页面
* @param {import("@playwright/test").Page} page
*/
constructor(page: Page) {
this.page = page;
this.subPages = [{ name: '项目余量分析' }, { name: '套餐消耗升单分析' }, { name: '顾客项目分析' }];
}
/**
* 跳转到子页面
* @param {string} subPageName
* - 项目余量分析
* - 套餐消耗升单分析
* - 顾客项目分析
*/
gotoSubPage = async (subPageName: string) => {
if (!this.subPages.some(({ name }) => name === subPageName)) {
throw new Error(`${subPageName} is not a valid sub page name`);
}
const $dropDown = this.page
.locator('.top_tab .tab_item', {
hasText: '顾客分析',
})
.locator('.ant-dropdown-link');
await $dropDown.click();
await this.page.getByRole('menuitem', { name: subPageName }).click();
};
}