- 修复LoginPage/SurgeryBillingPage/DoctorStationPage中page变量作用域问题 - 新增根目录playwright.config.ts(解决配置加载问题) - .gitignore添加test-results和report目录排除
35 lines
956 B
TypeScript
35 lines
956 B
TypeScript
import { Page, expect } from '@playwright/test';
|
|
|
|
export class SurgeryBillingPage {
|
|
readonly page: Page;
|
|
|
|
constructor(page: Page) {
|
|
this.page = page;
|
|
}
|
|
|
|
async goto() {
|
|
await this.page.goto('/operatingroom');
|
|
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 btn.click().catch(() => {});
|
|
}
|
|
await this.page.waitForLoadState('networkidle');
|
|
}
|
|
|
|
async getDialogCount(): Promise<number> {
|
|
return await this.page.locator('.el-dialog, .el-message-box').count();
|
|
}
|
|
|
|
async expectNoLocationIdError() {
|
|
await expect(this.page.locator('text=发放库房为空')).toHaveCount(0, { timeout: 5000 });
|
|
}
|
|
|
|
async expectSaveSuccess() {
|
|
await expect(this.page.locator('.el-message--success')).toBeVisible({ timeout: 10000 });
|
|
}
|
|
}
|