fix: 修复Playwright页面对象定义错误 + 根目录config
- 修复LoginPage/SurgeryBillingPage/DoctorStationPage中page变量作用域问题 - 新增根目录playwright.config.ts(解决配置加载问题) - .gitignore添加test-results和report目录排除
This commit is contained in:
@@ -1,18 +1,7 @@
|
||||
import { Page, expect } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* 手术计费页面对象模型
|
||||
* 覆盖:手术计费、耗材签发、防重复提交
|
||||
*/
|
||||
export class SurgeryBillingPage {
|
||||
readonly page: Page;
|
||||
readonly surgeryList = page.locator('el-table, .el-table');
|
||||
readonly generateBtn = page.locator('button:has-text("生成"), button:has-text("生成收费项")');
|
||||
readonly addBtn = page.locator('button:has-text("新增")');
|
||||
readonly saveBtn = page.locator('button:has-text("保存"), button:has-text("提交")');
|
||||
readonly signBtn = page.locator('button:has-text("签发")');
|
||||
readonly successMessage = page.locator('.el-message--success');
|
||||
readonly errorMessage = page.locator('.el-message--error');
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
@@ -23,14 +12,10 @@ export class SurgeryBillingPage {
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async generateCharges() {
|
||||
await this.generateBtn.click();
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async rapidClickGenerate(times: number = 5) {
|
||||
const btn = this.page.locator('button:has-text("生成"), button:has-text("新增")');
|
||||
for (let i = 0; i < times; i++) {
|
||||
await this.generateBtn.click().catch(() => {});
|
||||
await btn.click().catch(() => {});
|
||||
}
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
@@ -44,6 +29,6 @@ export class SurgeryBillingPage {
|
||||
}
|
||||
|
||||
async expectSaveSuccess() {
|
||||
await expect(this.successMessage).toBeVisible({ timeout: 10000 });
|
||||
await expect(this.page.locator('.el-message--success')).toBeVisible({ timeout: 10000 });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user