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; } async goto() { await this.page.goto('/doctorstation'); await this.page.waitForLoadState('networkidle'); } async expandCategory(index: number = 0) { const item = this.categoryItems.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.waitForLoadState('networkidle'); } }