93 lines
4.1 KiB
TypeScript
Executable File
93 lines
4.1 KiB
TypeScript
Executable File
import { test, expect } from '@playwright/test';
|
||
|
||
// ... 原有测试用例 ...
|
||
|
||
// @bug503 @regression
|
||
test('Bug #503: 住院发退药明细与汇总单触发时机同步校验', async ({ page }) => {
|
||
// 1. 登录护士站,模拟配置为“需申请模式”
|
||
await page.goto('/login');
|
||
await page.fill('input[name="username"]', 'wx');
|
||
await page.fill('input[name="password"]', '123456');
|
||
await page.click('button[type="submit"]');
|
||
await page.waitForURL('/nurse-station');
|
||
|
||
// 2. 护士执行一条临时医嘱
|
||
await page.click('text=执行医嘱');
|
||
await page.click('text=盐酸普罗帕酮注射液');
|
||
await page.click('text=确认执行');
|
||
await page.waitForTimeout(1000);
|
||
|
||
// 3. 切换至药房端,验证需申请模式下:执行后明细单与汇总单均不显示
|
||
await page.goto('/pharmacy/dispensing');
|
||
const detailRows = await page.locator('.dispensing-detail-table tbody tr').count();
|
||
const summaryRows = await page.locator('.dispensing-summary-table tbody tr').count();
|
||
expect(detailRows).toBe(0);
|
||
expect(summaryRows).toBe(0);
|
||
|
||
// 4. 返回护士站,执行“汇总发药申请”
|
||
await page.goto('/nurse-station/dispensing-apply');
|
||
await page.check('input[type="checkbox"]'); // 勾选待申请记录
|
||
await page.click('text=汇总发药申请');
|
||
await page.click('text=确认提交');
|
||
await page.waitForTimeout(1500);
|
||
|
||
// 5. 再次切换至药房端,验证明细单与汇总单同步出现且数据一致
|
||
await page.goto('/pharmacy/dispensing');
|
||
await page.waitForSelector('.dispensing-detail-table tbody tr');
|
||
const newDetailRows = await page.locator('.dispensing-detail-table tbody tr').count();
|
||
const newSummaryRows = await page.locator('.dispensing-summary-table tbody tr').count();
|
||
|
||
expect(newDetailRows).toBeGreaterThan(0);
|
||
expect(newSummaryRows).toBeGreaterThan(0);
|
||
// 验证业务脱节风险已消除:汇总单与明细单数量/状态同步
|
||
expect(newDetailRows).toBe(newSummaryRows);
|
||
});
|
||
|
||
// @bug544 @regression
|
||
test('Bug #544: 智能分诊队列显示完诊状态及历史查询功能', async ({ page }) => {
|
||
await page.goto('/login');
|
||
await page.fill('input[name="username"]', 'nkhs1');
|
||
await page.fill('input[name="password"]', '123456');
|
||
await page.click('button[type="submit"]');
|
||
await page.waitForURL('/triage/queue');
|
||
|
||
// 1. 验证默认加载当天队列,且列表包含“完诊”状态患者
|
||
await page.locator('text=智能队列(全科)').waitFor();
|
||
const completedRow = page.locator('tr:has-text("完诊")');
|
||
await expect(completedRow).toBeVisible({ timeout: 5000 });
|
||
|
||
// 2. 验证历史队列查询入口存在且默认时间为当天
|
||
const dateRangePicker = page.locator('.el-date-editor--daterange');
|
||
await expect(dateRangePicker).toBeVisible();
|
||
});
|
||
|
||
// @bug577 @regression
|
||
test('Bug #577: 检验申请单项目列表单价/使用单位应显示中文而非字典ID', 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/doctor');
|
||
|
||
// 选择患者并打开检验申请单
|
||
await page.click('text=检验');
|
||
await page.waitForSelector('.inspection-apply-modal');
|
||
|
||
// 验证左侧未选择列表中的单位显示为中文
|
||
const leftItems = page.locator('.left-list .item-row');
|
||
await expect(leftItems.first()).toBeVisible();
|
||
const priceUnitText = await leftItems.first().locator('.price-unit').textContent();
|
||
// 匹配格式:¥数字.数字/中文字符,排除纯数字ID
|
||
expect(priceUnitText).toMatch(/¥\d+\.\d+\/[^\d]+/);
|
||
expect(priceUnitText).not.toMatch(/\/\d{1,2}$/);
|
||
|
||
// 验证右侧已选择列表(添加一项后)
|
||
await leftItems.first().click();
|
||
await page.click('text=添加 >> 右侧');
|
||
const rightItems = page.locator('.right-list .item-row');
|
||
await expect(rightItems.first()).toBeVisible();
|
||
const rightPriceUnitText = await rightItems.first().locator('.price-unit').textContent();
|
||
expect(rightPriceUnitText).toMatch(/¥\d+\.\d+\/[^\d]+/);
|
||
expect(rightPriceUnitText).not.toMatch(/\/\d{1,2}$/);
|
||
});
|