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

75 lines
3.3 KiB
TypeScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
// 假设项目已配置 Cypress 或 Playwright 用于 E2E此处使用标准 Cypress 语法结构
// 实际运行环境请根据项目测试框架调整断言语法
describe('HIS System Regression Tests', () => {
// ... 原有测试用例 ...
// 新增 Bug #566 回归测试
describe('Bug #566 Regression', { tags: ['@bug566', '@regression'] }, () => {
it('should render vital signs data points on temperature chart and sync table after save', () => {
// 1. 登录并进入模块
cy.login('wx', '123456');
cy.visit('/inpatient/nurse/temperature-chart');
// 2. 选择患者并打开录入弹窗
cy.get('[data-testid="patient-select"]').click();
cy.contains('123').click();
cy.get('[data-testid="add-vital-sign-btn"]').click();
// 3. 录入生命体征数据
cy.get('[data-testid="vital-date"]').type('2026-05-20');
cy.get('[data-testid="vital-time"]').select('06:00');
cy.get('[data-testid="vital-temp"]').type('38.6');
cy.get('[data-testid="vital-hr"]').type('89');
cy.get('[data-testid="vital-pulse"]').type('45');
// 4. 保存并验证成功提示
cy.get('[data-testid="save-btn"]').click();
cy.get('.el-message--success').should('contain', '保存成功');
// 5. 验证图表区域渲染ECharts Canvas 存在且可见)
cy.get('[data-testid="temperature-chart"]').should('be.visible');
cy.get('canvas').should('exist');
// 6. 验证下方表格区域同步显示录入数值
cy.get('[data-testid="vital-table"]').contains('38.6').should('be.visible');
cy.get('[data-testid="vital-table"]').contains('89').should('be.visible');
cy.get('[data-testid="vital-table"]').contains('45').should('be.visible');
});
});
// 新增 Bug #506 回归测试
describe('Bug #506 Regression', { tags: ['@bug506', '@regression'] }, () => {
it('should correctly update multi-table states after pre-consultation cancellation', () => {
cy.login('admin', '123456');
cy.visit('/outpatient/registration');
// 1. 选择已缴费、已签到的预约患者
cy.get('[data-testid="patient-search"]').type('压力山大');
cy.get('[data-testid="patient-list"]').contains('压力山大').click();
// 2. 点击退号并确认
cy.get('[data-testid="cancel-appointment-btn"]').click();
cy.get('.el-message-box__btns .el-button--primary').click();
cy.get('.el-message--success').should('contain', '退号成功');
// 3. 验证订单状态接口返回符合 PRD 定义
cy.request('GET', '/api/order/main/latest').then((res) => {
const order = res.body.data;
expect(order.status).to.eq(0, 'order_main.status 应为 0(已取消)');
expect(order.payStatus).to.eq(3, 'order_main.pay_status 应为 3(已退费)');
expect(order.cancelReason).to.eq('诊前退号', 'cancel_reason 应为诊前退号');
expect(order.cancelTime).to.not.be.null.and.to.not.be.undefined;
});
// 4. 验证退费日志关联正确
cy.request('GET', '/api/refund/log/latest').then((res) => {
const log = res.body.data;
expect(log.orderId).to.not.be.null;
});
});
});
});