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

106 lines
4.1 KiB
TypeScript
Executable File

import { describe, it, cy } from 'cypress';
// 历史回归测试用例占位...
describe('Historical Regression Tests', () => {
it('should pass existing outpatient flow', () => {
cy.visit('/outpatient/dashboard');
cy.get('#patient-search').type('测试患者');
cy.contains('查询').click();
});
});
// @bug550 @regression
describe('Bug #550: 检查申请项目选择交互优化', () => {
beforeEach(() => {
cy.visit('/outpatient/examination-apply');
// 模拟接口返回数据
cy.intercept('GET', '/api/examination/categories', { fixture: 'categories.json' }).as('getCategories');
cy.intercept('GET', '/api/examination/items', { fixture: 'items.json' }).as('getItems');
cy.intercept('GET', '/api/examination/methods', { fixture: 'methods.json' }).as('getMethods');
});
it('1. 联动解耦:勾选项目不应自动勾选检查方法', () => {
cy.wait(['@getCategories', '@getItems', '@getMethods']);
cy.get('.category-tree').contains('彩超').click();
cy.get('.item-list').find('label').contains('128线排').click();
// 验证方法区域保持未勾选状态
cy.get('.method-list').find('input[type="checkbox"]').each(($el) => {
cy.wrap($el).should('not.be.checked');
});
});
it('2. 卡片显示优化:名称完整提示、去除冗余前缀、默认收起', () => {
cy.wait(['@getCategories', '@getItems', '@getMethods']);
cy.get('.category-tree').contains('彩超').click();
cy.get('.item-list').find('label').contains('128线排').click();
// 验证已选择区域默认收起
cy.get('.selected-card .card-body').should('not.be.visible');
// 验证去除“套餐”字样
cy.get('.selected-card .card-title').should('not.contain', '套餐');
// 验证 hover 显示完整名称
cy.get('.selected-card .card-title').should('have.attr', 'title', '128线排套餐');
});
it('3. 结构化展示:严格遵循 项目 > 方法 层级,无冗余标签', () => {
cy.wait(['@getCategories', '@getItems', '@getMethods']);
cy.get('.category-tree').contains('彩超').click();
cy.get('.item-list').find('label').contains('128线排').click();
// 展开明细
cy.get('.selected-card .card-header').click();
cy.get('.selected-card .card-body').should('be.visible');
// 验证层级结构:方法缩进显示在父项目下
cy.get('.selected-card .card-body .method-row').should('have.length.greaterThan', 0);
// 验证已删除“项目套餐明细”冗余标签
cy.get('.selected-card .card-body').should('not.contain', '项目套餐明细');
});
});
// @bug544 @regression
describe('Bug #544: 智能分诊队列显示完诊状态及历史查询', () => {
beforeEach(() => {
cy.visit('/triage/smart-queue');
cy.intercept('GET', '/api/triage/queue/list', {
statusCode: 200,
body: {
code: 200,
data: {
list: [
{ queueNo: 'Q001', patientName: '张三', status: 'WAITING', statusName: '候诊', triageTime: '2026-05-26 09:00:00', deptName: '呼吸内科' },
{ queueNo: 'Q002', patientName: '李四', status: 'COMPLETED', statusName: '完诊', triageTime: '2026-05-26 08:30:00', deptName: '呼吸内科' }
],
total: 2
}
}
}).as('getQueueList');
});
it('1. 列表应显示包含“完诊”状态的所有患者', () => {
cy.wait('@getQueueList');
cy.get('.el-table__body-wrapper').contains('李四').should('be.visible');
cy.get('.el-table__body-wrapper').contains('完诊').should('be.visible');
});
it('2. 支持按日期范围查询历史队列,默认查询当天', () => {
cy.wait('@getQueueList');
// 验证默认加载了当天数据
cy.get('.el-date-editor').should('contain', '2026-05-26');
// 模拟切换历史日期并查询
cy.get('.el-date-editor').click();
cy.contains('昨天').click();
cy.get('.el-button--primary').contains('查询').click();
cy.wait('@getQueueList').then((interception) => {
expect(interception.request.query.startDate).to.exist;
expect(interception.request.query.endDate).to.exist;
});
});
});