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

60 lines
2.6 KiB
TypeScript
Executable File

import { test, expect } from '@playwright/test';
test.describe('HIS 核心业务回归测试集', () => {
test.beforeEach(async ({ page }) => {
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 page.waitForURL('/dashboard');
});
// ... 其他已有测试用例 ...
test('Bug #574: 预约签到缴费成功后 adm_schedule_slot.status 应流转为 3', { tag: ['@bug574', '@regression'] }, async ({ page }) => {
// 1. 进入门诊挂号界面
await page.goto('/outpatient/registration');
await page.waitForLoadState('networkidle');
// 2. 模拟选择已预约患者并执行预约签到
await page.click('text=预约签到');
await page.waitForSelector('text=签到成功', { timeout: 5000 });
// 3. 执行缴费操作
await page.click('text=确认缴费');
await page.waitForSelector('text=缴费成功', { timeout: 5000 });
// 4. 拦截并验证后端状态更新接口返回
const statusResponse = await page.waitForResponse(
res => res.url().includes('/api/schedule/slot/status') && res.status() === 200
);
const body = await statusResponse.json();
// 验证状态已正确流转为 3 (已取号/待就诊)
expect(body.status).toBe(3);
expect(body.message).toContain('已取号');
});
test('Bug #550: 检查申请项目选择交互优化 - 解耦、卡片展示与层级结构', { tag: ['@bug550', '@regression'] }, async ({ page }) => {
await page.goto('/outpatient/examination-apply');
await page.waitForLoadState('networkidle');
// 1. 验证解耦:勾选项目不应自动勾选检查方法
await page.click('text=彩超');
await page.waitForSelector('text=128线排');
await page.click('text=128线排');
const methodCheckbox = page.locator('.method-panel input[type="checkbox"]').first();
await expect(methodCheckbox).not.toBeChecked();
// 2. 验证卡片展示:无“套餐”前缀,支持悬停提示完整名称,默认收起
const selectedCard = page.locator('.selected-card').first();
await expect(selectedCard.locator('.item-name')).not.toContainText('套餐');
await expect(selectedCard.locator('.card-details')).toBeHidden(); // 默认收起状态
// 3. 验证层级结构:点击展开显示明细,结构为 项目 > 检查方法
await selectedCard.locator('.card-header').click();
await expect(selectedCard.locator('.card-details')).toBeVisible();
await expect(selectedCard.locator('.method-item').first()).toBeVisible();
});
});