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

59 lines
2.5 KiB
TypeScript
Executable File

import { test, expect } from '@playwright/test';
// ... 原有测试用例 ...
/**
* Bug #503 Regression Test
* 验证:需申请模式下,护士执行医嘱后药房明细/汇总单不显示;
* 提交汇总发药申请后,明细与汇总单同步显示且数据一致。
*/
test.describe('Bug #503: Inpatient Dispensing Detail & Summary Sync', () => {
test('@bug503 @regression should sync dispensing detail and summary visibility based on application mode', 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');
// 模拟执行医嘱(假设存在执行按钮)
await page.click('text=执行医嘱');
await page.click('button:has-text("确认执行")');
await expect(page.locator('.el-message')).toContainText('执行成功');
// 2. 切换至药房账号,验证明细单与汇总单均为空
await page.goto('/login');
await page.fill('input[name="username"]', 'yjk1');
await page.fill('input[name="password"]', '123456');
await page.click('button[type="submit"]');
await page.waitForURL('/pharmacy/dispensing');
await page.click('text=发药明细单');
await expect(page.locator('.el-table__empty-text')).toBeVisible();
await page.click('text=发药汇总单');
await expect(page.locator('.el-table__empty-text')).toBeVisible();
// 3. 切回护士站,提交汇总发药申请
await page.goto('/nurse-station');
await page.click('text=汇总发药申请');
await page.check('input[type="checkbox"]'); // 勾选待申请记录
await page.click('button:has-text("提交申请")');
await expect(page.locator('.el-message')).toContainText('申请提交成功');
// 4. 切回药房,验证明细单与汇总单同步显示且数量一致
await page.goto('/pharmacy/dispensing');
await page.click('text=发药明细单');
const detailCount = await page.locator('.el-table__row').count();
expect(detailCount).toBeGreaterThan(0);
await page.click('text=发药汇总单');
const summaryCount = await page.locator('.el-table__row').count();
expect(summaryCount).toBeGreaterThan(0);
// 核心断言:明细与汇总记录数应一致(或汇总为明细的聚合,此处验证基础同步)
expect(detailCount).toEqual(summaryCount);
});
});