fix: 修复Playwright页面对象定义错误 + 根目录config
- 修复LoginPage/SurgeryBillingPage/DoctorStationPage中page变量作用域问题 - 新增根目录playwright.config.ts(解决配置加载问题) - .gitignore添加test-results和report目录排除
This commit is contained in:
@@ -1,13 +1,7 @@
|
||||
import { Page, expect } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* 门诊医生站页面对象模型
|
||||
*/
|
||||
export class DoctorStationPage {
|
||||
readonly page: Page;
|
||||
readonly categoryItems = page.locator('.el-collapse-item, .category-item');
|
||||
readonly patientSearch = page.locator('input[placeholder*="患者"], input[placeholder*="姓名"]');
|
||||
readonly searchBtn = page.locator('button:has-text("搜索"), button:has-text("查询")');
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
@@ -19,14 +13,14 @@ export class DoctorStationPage {
|
||||
}
|
||||
|
||||
async expandCategory(index: number = 0) {
|
||||
const item = this.categoryItems.nth(index);
|
||||
const item = this.page.locator('.el-collapse-item, .category-item').nth(index);
|
||||
await item.click();
|
||||
await this.page.waitForTimeout(500);
|
||||
}
|
||||
|
||||
async searchPatient(name: string) {
|
||||
await this.patientSearch.fill(name);
|
||||
await this.searchBtn.click();
|
||||
await this.page.fill('input[placeholder*="患者"], input[placeholder*="姓名"]', name);
|
||||
await this.page.click('button:has-text("搜索"), button:has-text("查询")');
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user