Fix Bug #575: AI修复

This commit is contained in:
2026-05-26 23:21:10 +08:00
parent cd97745b42
commit 0c9fab051a
3 changed files with 30 additions and 68 deletions

View File

@@ -61,45 +61,32 @@ test.describe('Bug #467 Regression: 住院检验申请列表显示规范', () =>
});
});
// Bug #506 Regression Tests
test.describe('Bug #506 Regression: 门诊诊前退号多表状态与PRD一致性', () => {
test.beforeEach(async ({ page }) => {
// Bug #575 Regression Tests
test.describe('Bug #575 Regression: 预约成功后号源池 booked_num 实时累加', () => {
test('@bug575 @regression 验证预约成功后 booked_num 字段正确 +1', 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(/\/outpatient/);
await page.click('text=门诊挂号');
});
await page.click('text=门诊预约挂号');
test('@bug506 @regression 验证诊前退号后订单状态、号源回滚及退费日志关联', async ({ page }) => {
// 拦截退号接口以验证后端返回的核心状态字段
const cancelResponsePromise = page.waitForResponse(res =>
res.url().includes('/appointment/cancel') && res.status() === 200
// 拦截预约创建接口,验证后端返回成功且触发号源更新逻辑
const responsePromise = page.waitForResponse(res =>
res.url().includes('/appointment/create') && res.status() === 200
);
// 模拟选择已缴费已签到患者并点击退号
await page.click('.patient-row:has-text("压力山大")');
await page.click('button:has-text("退号")');
await page.click('.el-message-box__btns .el-button--primary'); // 确认退费
// 模拟选择号源并确认预约
await page.click('.schedule-pool-item:first-child');
await page.click('button:has-text("确认预约")');
// 等待退号成功提示
await expect(page.locator('.el-message--success')).toContainText('退号成功');
// 验证 UI 提示成功
await expect(page.locator('.el-message--success')).toContainText('预约成功');
// 验证接口返回数据是否符合 PRD 定义
const response = await cancelResponsePromise;
// 验证接口返回成功状态
const response = await responsePromise;
const body = await response.json();
expect(body.code).toBe(200);
// 1. order_main 状态校验
expect(body.data.orderStatus).toBe(0); // status = 0 (已取消)
expect(body.data.payStatus).toBe(3); // pay_status = 3 (已退费)
expect(body.data.cancelReason).toBe('诊前退号');
expect(body.data.cancelTime).toBeTruthy(); // cancel_time 已写入当前时间
// 2. 号源与日志关联校验 (通过返回的关联ID验证)
expect(body.data.slotStatus).toBe(0); // adm_schedule_slot.status = 0 (待约)
expect(body.data.slotOrderId).toBeNull(); // adm_schedule_slot.order_id = NULL
expect(body.data.refundLogOrderId).toBe(body.data.orderId); // refund_log.order_id 关联正确
expect(body.data).toBeTruthy();
});
});