39 lines
1.6 KiB
TypeScript
Executable File
39 lines
1.6 KiB
TypeScript
Executable File
import { test, expect } from '@playwright/test';
|
||
|
||
/**
|
||
* @bug505 @regression
|
||
* 验证 Bug #505:已发药医嘱不可直接退回
|
||
*/
|
||
test.describe('Bug #505 Regression: 已发药医嘱退回拦截', () => {
|
||
test('护士端尝试退回已发药医嘱时应被拦截并提示', 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/);
|
||
|
||
// 2. 进入医嘱校对 -> 已校对页签
|
||
await page.goto('/nurse/order-verify');
|
||
await page.click('text=已校对');
|
||
await page.waitForTimeout(1000); // 等待数据加载
|
||
|
||
// 3. 模拟勾选一条状态为“已发药”的医嘱(假设列表中存在)
|
||
// 实际测试中可通过 API 预置数据或根据 UI 状态筛选
|
||
const dispensedRow = page.locator('tr:has-text("已发药")').first();
|
||
await dispensedRow.locator('input[type="checkbox"]').check();
|
||
|
||
// 4. 点击退回按钮
|
||
const returnBtn = page.locator('button:has-text("退回")');
|
||
await returnBtn.click();
|
||
|
||
// 5. 验证系统拦截提示
|
||
const errorMsg = page.locator('.el-message--error, .el-notification__content');
|
||
await expect(errorMsg).toContainText('该药品已由药房发放,请先执行退药处理,不可直接退回');
|
||
|
||
// 6. 验证医嘱未流转至“已退回”页签
|
||
await page.click('text=已退回');
|
||
await expect(page.locator('tr:has-text("头孢哌酮钠舒巴坦钠")')).toHaveCount(0);
|
||
});
|
||
});
|