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(); }; }