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

86 lines
4.0 KiB
TypeScript
Executable File

import { describe, it, cy } from 'cypress';
describe('门诊医生站-检查申请模块回归测试', () => {
beforeEach(() => {
cy.visit('/outpatient/examination/apply');
cy.wait(500);
});
it('should load examination categories and items correctly', () => {
cy.get('.category-tree').should('be.visible');
cy.contains('彩超').click();
cy.get('.item-list').should('contain', '128线排');
});
// @bug550 @regression
describe('Bug #550: 检查申请项目选择交互优化', () => {
it('should decouple item and method selection, show full names, and render hierarchical details', () => {
cy.contains('彩超').click();
cy.get('.item-list').contains('128线排').click();
cy.get('.method-list .el-checkbox').should('not.have.class', 'is-checked');
cy.get('.selected-card .item-name').should('not.contain', '套餐');
cy.get('.selected-card .item-name').trigger('mouseover');
cy.get('.el-tooltip__popper').should('contain', '128线排');
cy.get('.method-detail-panel').should('not.be.visible');
cy.get('.selected-card .expand-btn').click();
cy.get('.method-detail-panel').should('be.visible');
cy.get('.method-item').first().should('have.css', 'padding-left').and('match', /16px|20px/);
cy.get('.method-item').first().find('.el-checkbox').click();
cy.get('.method-item').first().find('.el-checkbox').should('have.class', 'is-checked');
cy.get('.selected-card .item-name').parent().find('.el-checkbox').should('not.have.class', 'is-checked');
});
});
});
// @bug584 @regression
describe('Bug #584: 住院医生站-手术申请历史列表操作列动态控制', () => {
beforeEach(() => {
cy.intercept('GET', '/api/inpatient/surgery/apply/list', { fixture: 'surgery_apply_list.json' }).as('getList');
cy.visit('/inpatient/doctor/surgery/apply');
cy.wait('@getList');
});
it('should dynamically render operation buttons based on surgery application status', () => {
// 待签发 (status=0) 应显示:编辑、详情、删除
cy.get('tr[data-status="0"] .operation-cell').within(() => {
cy.contains('编辑').should('be.visible');
cy.contains('删除').should('be.visible');
cy.contains('详情').should('be.visible');
cy.contains('撤回').should('not.exist');
cy.contains('打印').should('not.exist');
});
// 已签发 (status=1) 应显示:撤回、详情
cy.get('tr[data-status="1"] .operation-cell').within(() => {
cy.contains('撤回').should('be.visible');
cy.contains('详情').should('be.visible');
cy.contains('编辑').should('not.exist');
cy.contains('删除').should('not.exist');
});
// 已校对/已执行/已安排/已完成 (status=2/3/4/5) 应显示:详情、打印
cy.get('tr[data-status="2"] .operation-cell').within(() => {
cy.contains('打印').should('be.visible');
cy.contains('详情').should('be.visible');
cy.contains('编辑').should('not.exist');
cy.contains('删除').should('not.exist');
cy.contains('撤回').should('not.exist');
});
});
it('should trigger confirmation dialog on delete and handle revoke validation', () => {
// 测试删除防误触
cy.get('tr[data-status="0"] .operation-cell').contains('删除').click();
cy.get('.el-message-box__wrapper').should('be.visible');
cy.contains('确认删除该笔手术申请单吗?删除后数据还原将无法恢复。').should('be.visible');
cy.get('.el-button--danger').contains('确认').click();
cy.wait('@deleteRequest');
// 测试撤回拦截逻辑(模拟护士已校对)
cy.intercept('POST', '/api/inpatient/surgery/apply/revoke/*', { statusCode: 400, body: { msg: '撤回失败!该手术申请已由病区护士已校对,请致电病区护士处理。' } }).as('revokeFail');
cy.get('tr[data-status="1"] .operation-cell').contains('撤回').click();
cy.wait('@revokeFail');
cy.get('.el-message--error').should('contain', '撤回失败');
});
});