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
2024-12-22 21:12:43 +08:00

36 lines
1.0 KiB
TypeScript

import { Page } from 'playwright';
export class CustomerAnalysisPage {
page: Page;
subPages: { name: string; url?: string[] }[];
/**
* 顾客分析页面
*/
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();
};
}