120 lines
5.4 KiB
TypeScript
Executable File
120 lines
5.4 KiB
TypeScript
Executable File
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/);
|
|
});
|
|
|
|
test('@bug467 @regression 验证申请单号格式与名称截断', async ({ page }) => {
|
|
await page.click('.patient-list-item:first-child');
|
|
await page.click('text=检验');
|
|
await expect(page.locator('text=申请单号')).toBeVisible();
|
|
const firstRowNo = await page.locator('.el-table__body tr:first-child td:first-child').textContent();
|
|
expect(firstRowNo).toMatch(/^JYZ\d{6}\d{5}$/);
|
|
});
|
|
});
|
|
|
|
// Bug #556 Regression Tests
|
|
test.describe('Bug #556 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(/\/outpatient/);
|
|
await page.click('.patient-queue-item:has-text("小花")');
|
|
await page.click('text=检验');
|
|
});
|
|
|
|
test('@bug556 @regression 验证新增检验申请单时就诊卡号与执行时间自动回显', async ({ page }) => {
|
|
await page.click('button:has-text("+新增")');
|
|
await page.waitForSelector('.lab-request-dialog');
|
|
|
|
// 验证就诊卡号自动带出
|
|
const cardNoInput = page.locator('input[name="patientCardNo"]');
|
|
await expect(cardNoInput).toBeVisible();
|
|
const cardNoValue = await cardNoInput.inputValue();
|
|
expect(cardNoValue).not.toBe('');
|
|
expect(cardNoValue).toMatch(/^\d+$/);
|
|
|
|
// 验证执行时间默认填充当前时间 (YYYY-MM-DD HH:mm)
|
|
const execTimeInput = page.locator('input[name="executeTime"]');
|
|
await expect(execTimeInput).toBeVisible();
|
|
const execTimeValue = await execTimeInput.inputValue();
|
|
expect(execTimeValue).toMatch(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/);
|
|
});
|
|
|
|
test('@bug556 @regression 验证检验项目列表无冗余"套餐"文字', async ({ page }) => {
|
|
await page.click('button:has-text("+新增")');
|
|
await page.waitForSelector('.lab-request-dialog');
|
|
|
|
// 展开分类
|
|
await page.click('.category-node:has-text("免疫")');
|
|
|
|
// 获取所有项目名称文本
|
|
const itemNames = await page.locator('.lab-item-row .item-name').allTextContents();
|
|
expect(itemNames.length).toBeGreaterThan(0);
|
|
|
|
// 验证不包含冗余标签
|
|
for (const name of itemNames) {
|
|
expect(name).not.toContain('套餐');
|
|
expect(name.trim().length).toBeGreaterThan(0);
|
|
}
|
|
});
|
|
});
|