- 添加项目配置文件和环境变量设置 - 创建测试用例目录结构和命名规范 - 实现基础测试 fixture 和页面对象模型 - 添加示例测试用例和数据生成器 - 配置 playwright 和 gitignore 文件
67 lines
2.5 KiB
TypeScript
67 lines
2.5 KiB
TypeScript
import { test as base, expect as baseExpect } from '@playwright/test';
|
|
import {
|
|
ReportPage,
|
|
PerformanceSummaryReportPage,
|
|
SpendingSummaryReportPage,
|
|
PerformanceDetailReportPage,
|
|
CardBalanceChangeReportPage,
|
|
ItemSalesConsumptionAccessReportPage,
|
|
SalesCostSummaryReportPage,
|
|
CustomerConsumptionAnalysisReportPage,
|
|
} from '@/pages/report';
|
|
|
|
type MyFixture = {
|
|
reportPage: ReportPage;
|
|
performanceSummaryReportPage: PerformanceSummaryReportPage;
|
|
spendingSummaryReportPage: SpendingSummaryReportPage;
|
|
performanceDetailReportPage: PerformanceDetailReportPage;
|
|
cardBalanceChangeReportPage: CardBalanceChangeReportPage;
|
|
itemSalesConsumptionAccessReportPage: ItemSalesConsumptionAccessReportPage;
|
|
salesCostSummaryReportPage: SalesCostSummaryReportPage;
|
|
customerConsumptionAnalysisReportPage: CustomerConsumptionAnalysisReportPage;
|
|
};
|
|
|
|
export const test = base.extend<MyFixture>({
|
|
reportPage: async ({ page }, use) => {
|
|
const reportPage = new ReportPage(page);
|
|
await use(reportPage);
|
|
},
|
|
|
|
performanceSummaryReportPage: async ({ page }, use) => {
|
|
const performanceSummaryReportPage = new PerformanceSummaryReportPage(page);
|
|
await use(performanceSummaryReportPage);
|
|
},
|
|
|
|
performanceDetailReportPage: async ({ page }, use) => {
|
|
const performanceDetailReportPage = new PerformanceDetailReportPage(page);
|
|
await use(performanceDetailReportPage);
|
|
},
|
|
|
|
cardBalanceChangeReportPage: async ({ page }, use) => {
|
|
const cardBalanceChangeReportPage = new CardBalanceChangeReportPage(page);
|
|
await use(cardBalanceChangeReportPage);
|
|
},
|
|
|
|
spendingSummaryReportPage: async ({ page }, use) => {
|
|
const spendingSummaryReportPage = new SpendingSummaryReportPage(page);
|
|
await use(spendingSummaryReportPage);
|
|
},
|
|
|
|
itemSalesConsumptionAccessReportPage: async ({ page }, use) => {
|
|
const itemSalesConsumptionAccessReportPage = new ItemSalesConsumptionAccessReportPage(page);
|
|
await use(itemSalesConsumptionAccessReportPage);
|
|
},
|
|
|
|
salesCostSummaryReportPage: async ({ page }, use) => {
|
|
const salesCostSummaryReportPage = new SalesCostSummaryReportPage(page);
|
|
await use(salesCostSummaryReportPage);
|
|
},
|
|
|
|
customerConsumptionAnalysisReportPage: async ({ page }, use) => {
|
|
const customerConsumptionAnalysisReportPage = new CustomerConsumptionAnalysisReportPage(page);
|
|
await use(customerConsumptionAnalysisReportPage);
|
|
},
|
|
});
|
|
|
|
export const expect = baseExpect.extend({});
|