97 lines
3.9 KiB
TypeScript
Executable File
97 lines
3.9 KiB
TypeScript
Executable File
import { test, expect } from '@playwright/test';
|
|
|
|
// 原有测试用例保持不变...
|
|
test('基础登录流程', 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 expect(page.locator('.el-menu')).toBeVisible();
|
|
});
|
|
|
|
// ================= 新增 Bug #544 回归测试 =================
|
|
test('@bug544 @regression 智能分诊队列应显示完诊状态且支持历史查询', async ({ page }) => {
|
|
await page.goto('/triage/queue');
|
|
|
|
// 1. 验证默认加载当天队列,且包含“完诊”状态患者
|
|
await expect(page.locator('.el-table__body tr')).toHaveCountGreaterThan(0);
|
|
const completedTag = page.getByText('完诊');
|
|
await expect(completedTag).toBeVisible();
|
|
|
|
// 2. 验证历史队列查询入口存在且默认值为当天
|
|
const dateRangePicker = page.getByPlaceholder('开始日期');
|
|
await expect(dateRangePicker).toBeVisible();
|
|
await expect(page.getByPlaceholder('结束日期')).toBeVisible();
|
|
|
|
// 3. 模拟切换历史日期并查询
|
|
await dateRangePicker.click();
|
|
await page.getByRole('button', { name: '2026-05-17' }).click(); // 假设历史日期
|
|
await page.getByRole('button', { name: '查询' }).click();
|
|
|
|
// 4. 验证查询后表格刷新且无报错
|
|
await expect(page.locator('.el-loading-mask')).toHaveCount(0);
|
|
await expect(page.locator('.el-table__body tr')).toHaveCountGreaterThan(0);
|
|
});
|
|
|
|
// ================= 新增 Bug #574 回归测试 =================
|
|
test('@bug574 @regression 预约签到缴费成功后排班号源状态应流转为3', async ({ page }) => {
|
|
// 1. 登录系统
|
|
await page.goto('/login');
|
|
await page.fill('input[name="username"]', 'admin');
|
|
await page.fill('input[name="password"]', '123456');
|
|
await page.click('button[type="submit"]');
|
|
await expect(page.locator('.el-menu')).toBeVisible();
|
|
|
|
// 2. 进入门诊挂号/预约管理页面
|
|
await page.goto('/outpatient/registration');
|
|
await expect(page.locator('.page-title')).toContainText('门诊挂号');
|
|
|
|
// 3. 拦截支付成功接口,验证后端返回及状态流转逻辑
|
|
let slotStatusUpdated = false;
|
|
await page.route('**/api/order/pay/success', async (route) => {
|
|
const response = await route.fetch();
|
|
const json = await response.json();
|
|
// 模拟业务成功响应
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify({ code: 200, msg: '缴费成功', data: { success: true } })
|
|
});
|
|
});
|
|
});
|
|
|
|
// ================= 新增 Bug #505 回归测试 =================
|
|
test('@bug505 @regression 已发药医嘱禁止护士直接退回', 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 expect(page.locator('.el-menu')).toBeVisible();
|
|
|
|
// 2. 进入医嘱校对-已校对页签
|
|
await page.goto('/nurse/order-verify');
|
|
await page.getByRole('tab', { name: '已校对' }).click();
|
|
await page.waitForSelector('.el-table__body tr');
|
|
|
|
// 3. 拦截退回接口,模拟后端已发药状态拦截逻辑
|
|
await page.route('**/api/order/return', async (route) => {
|
|
await route.fulfill({
|
|
status: 200,
|
|
contentType: 'application/json',
|
|
body: JSON.stringify({
|
|
code: 500,
|
|
msg: '该药品已由药房发放,请先执行退药处理,不可直接退回',
|
|
data: null
|
|
})
|
|
});
|
|
});
|
|
|
|
// 4. 勾选第一条医嘱并点击退回
|
|
await page.locator('.el-table__body tr').first().locator('input[type="checkbox"]').check();
|
|
await page.getByRole('button', { name: '退回' }).click();
|
|
|
|
// 5. 验证系统拦截提示
|
|
await expect(page.getByText('该药品已由药房发放,请先执行退药处理,不可直接退回')).toBeVisible();
|
|
});
|