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/marketing/marketingPage.ts
LingandRX 6517e4192c feat: 初始化慧来客自动化测试项目
- 添加项目配置文件和环境变量设置
- 创建测试用例目录结构和命名规范
- 实现基础测试 fixture 和页面对象模型
- 添加示例测试用例和数据生成器
- 配置 playwright 和 gitignore 文件
2024-12-22 19:18:27 +08:00

84 lines
2.7 KiB
TypeScript

import { type Page } from '@playwright/test';
export class MarketingPage {
page: Page;
mallSubPages: string[];
strategySubPages: string[];
enterpriseWechatSubPages: string[];
toolSettingSubPages: string[];
constructor(page: Page) {
this.page = page;
this.mallSubPages = ['个性状态', '上架好物', '商城订单', '商城设置', '品牌推广'];
this.strategySubPages = ['抢购', '团购', '邀客系统', '会员权益', '积分', '推广收益', '优惠券', '直播系统'];
this.enterpriseWechatSubPages = ['营销获客', '顾客管理', '多渠道触达', '内容营销库', '多维度数据统计'];
this.toolSettingSubPages = ['微信平台'];
}
/**
* 进入子页面
* @param moduleName 页面名称
* - 个性状态
* - 上架好物
* - 商城订单
* - 商城设置
* - 品牌推广
*/
gotoMallSubPage = async (moduleName: string) => {
const subReportPage = this.mallSubPages.find(e => e === moduleName);
if (!subReportPage) {
throw new Error(`${moduleName}页面不存在`);
}
await this.page.getByText(subReportPage, { exact: true }).click();
};
/**
* 进入营销策略子页面
* @param moduleName 页面名称
* - 抢购
* - 团购
* - 邀客系统
* - 会员权益
* - 积分
* - 推广收益
* - 优惠券
* - 直播系统
*/
gotoStrategySubPage = async (moduleName: string) => {
const subReportPage = this.strategySubPages.find(e => e === moduleName);
if (!subReportPage) {
throw new Error(`${moduleName}页面不存在`);
}
await this.page.getByText(subReportPage, { exact: true }).click();
};
/**
* 进入企业微信子页面
* @param moduleName 页面名称
* - 营销获客
* - 顾客管理
* - 多渠道触达
* - 内容营销库
* - 多维度数据统计
*/
gotoEnterpriseWechatSubPage = async (moduleName: string) => {
const subReportPage = this.enterpriseWechatSubPages.find(e => e === moduleName);
if (!subReportPage) {
throw new Error(`${moduleName}页面不存在`);
}
await this.page.getByText(subReportPage, { exact: true }).click();
};
/**
* 进入工具设置
* @param moduleName 页面名称
* - 微信平台
*/
gotoToolSettingSubPage = async (moduleName: string) => {
const subReportPage = this.toolSettingSubPages.find(e => e === moduleName);
if (!subReportPage) {
throw new Error(`${moduleName}页面不存在`);
}
await this.page.getByText(subReportPage, { exact: true }).click();
};
}