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

46 lines
1.7 KiB
TypeScript
Executable File

import { test, expect } from '@playwright/test';
test.describe('Bug Regression Tests', () => {
// 原有回归测试用例占位...
test('@bug575 @regression 预约成功后 adm_schedule_pool.booked_num 应实时累加', 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 page.waitForURL('/dashboard');
// 2. 进入门诊预约挂号界面
await page.goto('/outpatient/appointment');
await page.waitForLoadState('networkidle');
// 3. 拦截号源查询接口,记录初始 booked_num
let initialBookedNum = 0;
await page.route('**/api/schedule/pool/detail', async (route) => {
const response = await route.fetch();
const json = await response.json();
initialBookedNum = json.data?.booked_num ?? 0;
await route.fulfill({ response, json });
});
// 4. 执行预约操作
await page.click('.schedule-slot-item[data-status="AVAILABLE"]');
await page.click('.btn-confirm-appointment');
await page.waitForSelector('.el-message--success');
await expect(page.locator('.el-message--success')).toContainText('预约成功');
// 5. 刷新页面并验证 booked_num 已 +1
await page.reload();
await page.waitForLoadState('networkidle');
const updatedBookedNum = await page.evaluate(async () => {
const res = await fetch('/api/schedule/pool/detail');
const data = await res.json();
return data.data?.booked_num ?? 0;
});
expect(updatedBookedNum).toBe(initialBookedNum + 1);
});
});