Files
his/openhis-ui-vue3/tests/e2e/specs/bug-regression.spec.ts
2026-05-26 23:00:28 +08:00

97 lines
4.6 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/);
await page.click('.patient-list-item:first-child');
await page.click('text=临床医嘱');
await page.click('text=检验');
await page.click('text=检验申请');
await page.waitForSelector('.lab-request-container', { state: 'visible' });
});
test('@bug467 @regression 验证申请单号格式与列标题术语', async ({ page }) => {
// 验证列标题已修正为“申请单号”,不再显示“处方号”
await expect(page.locator('th:has-text("申请单号")')).toBeVisible();
await expect(page.locator('th:has-text("处方号")')).not.toBeVisible();
// 验证申请单号格式严格匹配 JYZ + yyMMdd + 5位独立自增序号
const requestNoCell = page.locator('td').first();
const requestNoText = await requestNoCell.textContent();
expect(requestNoText).toMatch(/^JYZ\d{6}\d{5}$/);
});
test('@bug467 @regression 验证申请单名称拼接逻辑与悬停提示', async ({ page }) => {
// 验证名称列不再统一显示“检验申请单”,而是具体项目拼接
const nameCell = page.locator('td').nth(1);
const nameText = await nameCell.textContent();
expect(nameText).not.toBe('检验申请单');
expect(nameText).not.toMatch(/\d$/); // 验证项目后不拼接数字1
// 验证多项目拼接包含 "+" 分隔符
expect(nameText).toContain('+');
// 验证超长截断与悬停提示
await nameCell.hover();
const tooltip = page.locator('.el-popper, [class*="tooltip"]');
await expect(tooltip).toBeVisible();
const tooltipText = await tooltip.textContent();
expect(tooltipText.length).toBeGreaterThanOrEqual(nameText.length);
});
});