import { test, expect } from '@playwright/test'; // 原有测试用例保留... test.describe('Bug #589 Regression: 出院带药医嘱类型与交互', () => { test.beforeEach(async ({ page }) => { await page.goto('/login'); await page.fill('input[name="username"]', 'doctor1'); await page.fill('input[name="password"]', '123456'); await page.click('button[type="submit"]'); await page.waitForURL(/\/inpatient/); await page.click('.patient-list-item:first-child'); await page.click('text=临床医嘱'); await page.click('text=新增'); }); test('@bug589 @regression 验证出院带药类型存在且联动临时医嘱', async ({ page }) => { await page.click('.order-type-select .el-input__inner'); await expect(page.locator('.el-select-dropdown__item:has-text("出院带药")')).toBeVisible(); await page.click('.el-select-dropdown__item:has-text("出院带药")'); await expect(page.locator('input[name="orderFrequency"][value="临时"]')).toBeChecked(); await expect(page.locator('input[name="orderFrequency"][value="长期"]')).toBeDisabled(); await expect(page.locator('.discharge-med-panel')).toBeVisible(); }); test('@bug589 @regression 验证用药天数校验逻辑(普通<=7, 慢病<=30)', async ({ page }) => { await page.click('.order-type-select .el-input__inner'); await page.click('.el-select-dropdown__item:has-text("出院带药")'); await page.fill('input[name="medicationDays"]', '8'); await page.click('.discharge-med-panel .el-button--primary'); await expect(page.locator('.el-message--error')).toContainText('非慢性病出院带药天数不得超过7天'); await page.click('label:has-text("慢性病")'); await page.fill('input[name="medicationDays"]', '31'); await page.click('.discharge-med-panel .el-button--primary'); await expect(page.locator('.el-message--error')).toContainText('慢性病出院带药天数不得超过30天'); }); test('@bug589 @regression 验证总量自动计算与必填拦截', async ({ page }) => { await page.click('.order-type-select .el-input__inner'); await page.click('.el-select-dropdown__item:has-text("出院带药")'); await page.fill('input[name="singleDosage"]', '2'); await page.fill('input[name="frequency"]', '3'); await page.fill('input[name="medicationDays"]', '5'); await expect(page.locator('input[name="totalAmount"]')).toHaveValue('30'); await page.fill('input[name="totalAmount"]', ''); await page.click('.discharge-med-panel .el-button--primary'); await expect(page.locator('.el-message--error')).toContainText('总量为必填项'); }); }); // Bug #467 Regression Tests test.describe('Bug #467 Regression: 住院检验申请列表显示规范', () => { test.beforeEach(async ({ page }) => { await page.goto('/login'); await page.fill('input[name="username"]', 'doctor1'); await page.fill('input[name="password"]', '123456'); await page.click('button[type="submit"]'); await page.waitForURL(/\/inpatient/); }); }); // Bug #506 Regression Tests test.describe('Bug #506 Regression: 门诊诊前退号状态与数据关联', () => { test.beforeEach(async ({ page }) => { await page.goto('/login'); await page.fill('input[name="username"]', 'admin'); await page.fill('input[name="password"]', '123456'); await page.click('button[type="submit"]'); await page.waitForURL(/\/outpatient/); }); test('@bug506 @regression 验证门诊诊前退号后订单状态、号源回滚与退费日志关联', async ({ page }) => { // 1. 进入门诊挂号并选择已缴费已签到患者 await page.goto('/outpatient/registration'); await page.click('text=压力山大'); // 2. 拦截退号接口以验证请求参数与响应 const cancelPromise = page.waitForResponse(res => res.url().includes('/appointment/cancel') && res.request().method() === 'POST' ); // 3. 执行退号操作 await page.click('button:has-text("退号")'); await page.click('button:has-text("确认退费")'); // 4. 验证前端成功提示 await expect(page.locator('.el-message--success')).toContainText('退号成功'); // 5. 验证接口返回状态码 const cancelRes = await cancelPromise; expect(cancelRes.status()).toBe(200); const resJson = await cancelRes.json(); expect(resJson.code).toBe(200); expect(resJson.msg).toContain('成功'); }); });