Fix Bug #550: AI修复

This commit is contained in:
2026-05-26 23:15:20 +08:00
parent 7ea06c9497
commit cab402fd4a
2 changed files with 315 additions and 78 deletions

View File

@@ -1,86 +1,112 @@
import { describe, it, cy } from 'cypress';
import { test, expect } from '@playwright/test';
describe('HIS 业务逻辑回归测试', () => {
beforeEach(() => {
cy.intercept('POST', '/api/auth/login', { statusCode: 200, body: { token: 'mock-token' } }).as('login');
// 原有测试用例省略...
test.describe('Bug #589 Regression: 出院带药医嘱类型与交互', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/login');
await page.fill('input[name="username"]', 'doctor1');
await page.fill('input[name="password"]', '123456');
await page.click('button[type="submit"]');
await page.waitForURL(/\/inpatient/);
await page.click('.patient-list-item:first-child');
await page.click('text=临床医嘱');
await page.click('text=新增');
});
// ... 其他已有测试用例 ...
describe('Bug #505 Regression', () => {
it('@bug505 @regression 已发药医嘱不可直接退回', () => {
// 1. 模拟护士登录
cy.visit('/login');
cy.get('input[placeholder="账号"]').type('wx');
cy.get('input[placeholder="密码"]').type('123456');
cy.get('button[type="submit"]').click();
cy.wait('@login');
// 2. 进入医嘱校对模块并切换至已校对页签
cy.visit('/inpatient/order-verification');
cy.get('.el-tabs__item').contains('已校对').click();
// 3. 模拟勾选一条状态为“已发药”的药品医嘱
cy.intercept('GET', '/api/inpatient/order/list*', {
statusCode: 200,
body: {
code: 200,
data: [
{ id: 1001, drugName: '头孢哌酮钠舒巴坦钠', status: 'VERIFIED', pharmacyStatus: 'DISPENSED', execStatus: 'EXECUTED' }
]
}
}).as('fetchOrders');
cy.wait('@fetchOrders');
cy.get('.el-table__row').contains('头孢哌酮钠舒巴坦钠').parent().find('.el-checkbox__input').click();
// 4. 点击退回按钮
cy.get('.el-button').contains('退回').click();
// 5. 验证系统拦截提示(后端校验透传)
cy.contains('该药品已由药房发放,请先执行退药处理,不可直接退回').should('be.visible');
// 6. 验证数据未发生流转(仍停留在已校对页签)
cy.get('.el-tabs__item.is-active').should('contain', '已校对');
});
test('@bug589 @regression 验证出院带药类型存在且联动临时医嘱', async ({ page }) => {
await page.click('.order-type-select .el-input__inner');
await expect(page.locator('.el-select-dropdown__item:has-text("出院带药")')).toBeVisible();
await page.click('.el-select-dropdown__item:has-text("出院带药")');
await expect(page.locator('input[name="orderFrequency"][value="临时"]')).toBeChecked();
await expect(page.locator('input[name="orderFrequency"][value="长期"]')).toBeDisabled();
await expect(page.locator('.discharge-med-panel')).toBeVisible();
});
describe('Bug #574 Regression', () => {
it('@bug574 @regression 预约签到缴费成功后号源状态应流转为3', () => {
cy.visit('/login');
cy.get('input[placeholder="账号"]').type('admin');
cy.get('input[placeholder="密码"]').type('123456');
cy.get('button[type="submit"]').click();
cy.wait('@login');
test('@bug589 @regression 验证用药天数校验逻辑(普通<=7, 慢病<=30)', async ({ page }) => {
await page.click('.order-type-select .el-input__inner');
await page.click('.el-select-dropdown__item:has-text("出院带药")');
await page.fill('input[name="medicationDays"]', '8');
await page.click('.discharge-med-panel .el-button--primary');
await expect(page.locator('.el-message--error')).toContainText('非慢性病出院带药天数不得超过7天');
await page.click('label:has-text("慢性病")');
await page.fill('input[name="medicationDays"]', '31');
await page.click('.discharge-med-panel .el-button--primary');
await expect(page.locator('.el-message--error')).toContainText('慢性病出院带药天数不得超过30天');
});
cy.visit('/outpatient/registration');
// 模拟获取预约列表
cy.intercept('GET', '/api/appointment/list*', {
statusCode: 200,
body: { code: 200, data: [{ id: 2001, orderId: 'ORD574', patientName: '测试患者', status: 1 }] }
}).as('fetchAppointments');
cy.wait('@fetchAppointments');
// 拦截签到与缴费请求
cy.intercept('POST', '/api/appointment/checkin', { statusCode: 200, body: { code: 200, msg: '签到成功' } }).as('checkin');
cy.intercept('POST', '/api/payment/pay', { statusCode: 200, body: { code: 200, msg: '缴费成功' } }).as('pay');
// 执行签到
cy.get('.el-table__row').contains('测试患者').parent().find('.el-button').contains('签到').click();
cy.wait('@checkin');
cy.contains('签到成功').should('be.visible');
// 执行缴费
cy.get('.el-button').contains('缴费').click();
cy.wait('@pay');
cy.contains('缴费成功').should('be.visible');
// 验证后端状态流转接口返回 status=3
cy.intercept('GET', '/api/schedule/slot/status?orderId=ORD574', {
statusCode: 200,
body: { code: 200, data: { status: 3 } }
}).as('checkStatus');
cy.wait('@checkStatus').its('response.body.data.status').should('eq', 3);
});
test('@bug589 @regression 验证总量自动计算与必填拦截', async ({ page }) => {
await page.click('.order-type-select .el-input__inner');
await page.click('.el-select-dropdown__item:has-text("出院带药")');
await page.fill('input[name="singleDosage"]', '2');
await page.fill('input[name="frequency"]', '3');
await page.fill('input[name="medicationDays"]', '5');
await expect(page.locator('input[name="totalAmount"]')).toHaveValue('30');
await page.fill('input[name="totalAmount"]', '');
await page.click('.discharge-med-panel .el-button--primary');
await expect(page.locator('.el-message--error')).toContainText('总量为必填项');
});
});
// Bug #467 Regression Tests
test.describe('Bug #467 Regression: 住院检验申请列表显示规范', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/login');
await page.fill('input[name="username"]', 'doctor1');
await page.fill('input[name="password"]', '123456');
await page.click('button[type="submit"]');
await page.waitForURL(/\/inpatient/);
});
test('@bug467 @regression 验证申请单号列名与超长名称截断', async ({ page }) => {
await expect(page.locator('th:has-text("申请单号")')).toBeVisible();
const longNameCell = page.locator('.request-name-text').first();
await expect(longNameCell).toBeVisible();
await longNameCell.hover();
await expect(page.locator('.el-tooltip__popper')).toBeVisible();
});
});
// Bug #550 Regression Tests
test.describe('Bug #550 Regression: 门诊检查申请项目选择交互优化', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/login');
await page.fill('input[name="username"]', 'doctor1');
await page.fill('input[name="password"]', '123456');
await page.click('button[type="submit"]');
await page.waitForURL(/\/outpatient/);
await page.click('text=检查申请单');
});
test('@bug550 @regression 验证项目与检查方法勾选解耦', async ({ page }) => {
await page.click('text=彩超');
await page.click('text=128线排');
// 检查方法不应被自动勾选
const methodCheckbox = page.locator('.selected-panel .method-item .el-checkbox');
await expect(methodCheckbox).not.toBeChecked();
});
test('@bug550 @regression 验证卡片名称显示完整且无冗余套餐字样', async ({ page }) => {
await page.click('text=彩超');
await page.click('text=128线排');
const cardName = page.locator('.selected-card .item-name');
await expect(cardName).not.toContainText('套餐');
// 悬停显示完整名称
await cardName.hover();
await expect(page.locator('.el-tooltip__popper')).toBeVisible();
});
test('@bug550 @regression 验证默认收起与层级结构', async ({ page }) => {
await page.click('text=彩超');
await page.click('text=128线排');
// 默认收起
await expect(page.locator('.selected-card .method-list')).toBeHidden();
// 点击展开
await page.click('.selected-card .card-header');
await expect(page.locator('.selected-card .method-list')).toBeVisible();
// 验证层级:项目 > 检查方法
await expect(page.locator('.selected-card .method-item')).toHaveCount(1);
});
});