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

106 lines
4.2 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, cy } from 'cypress'
describe('HIS System Regression Tests', () => {
it('should handle normal login flow', () => {
cy.login('doctor1', '123456')
cy.url().should('include', '/dashboard')
})
// ... 其他历史回归用例 ...
})
// =========================================================================
// Bug #562 Regression Test
// =========================================================================
describe('Bug #562: 门诊医生工作站-待写病历加载性能与状态修复', { tags: ['@bug562', '@regression'] }, () => {
it('should load pending medical records within 2 seconds and clear loading state', () => {
cy.login('doctor1', '123456')
cy.visit('/outpatient/doctor-workstation')
// 进入待写病历模块
cy.get('[data-cy="menu-pending-records"]').click()
// 验证加载动画出现
cy.get('[data-cy="loading-spinner"]').should('be.visible')
// 核心断言2秒内加载完成且状态清除
cy.get('[data-cy="loading-spinner"]', { timeout: 2000 }).should('not.exist')
// 验证数据列表正常渲染
cy.get('[data-cy="record-list"]').should('be.visible')
cy.get('[data-cy="record-item"]').should('have.length.greaterThan', 0)
})
it('should clear loading state on API timeout or error', { tags: ['@bug562', '@regression'] }, () => {
cy.login('doctor1', '123456')
cy.visit('/outpatient/doctor-workstation')
cy.get('[data-cy="menu-pending-records"]').click()
// 拦截并模拟接口超时/失败
cy.intercept('GET', '**/api/medical-record/pending*', {
statusCode: 500,
delay: 3000
}).as('pendingRecordsFail')
cy.get('[data-cy="loading-spinner"]').should('be.visible')
cy.wait('@pendingRecordsFail')
// 即使接口失败/超时loading 也必须被清除
cy.get('[data-cy="loading-spinner"]', { timeout: 1000 }).should('not.exist')
cy.get('[data-cy="record-list"]').should('be.visible')
})
})
// =========================================================================
// Bug #550 Regression Test
// =========================================================================
describe('Bug #550: 门诊医生站-检查申请项目选择交互优化', { tags: ['@bug550', '@regression'] }, () => {
it('should decouple item and method selection', () => {
cy.login('doctor1', '123456')
cy.visit('/outpatient/examination-application')
cy.get('[data-cy="exam-category-ultrasound"]').click()
cy.get('[data-cy="exam-item-128"]').click()
// 验证勾选项目时,检查方法区域未被自动勾选
cy.get('[data-cy="exam-method-area"]').find('input[type="checkbox"]:checked').should('have.length', 0)
})
it('should display full name without "套餐" prefix and support expand/collapse', () => {
cy.login('doctor1', '123456')
cy.visit('/outpatient/examination-application')
cy.get('[data-cy="exam-category-ultrasound"]').click()
cy.get('[data-cy="exam-item-128"]').click()
// 验证已选卡片无“套餐”冗余字样
cy.get('[data-cy="selected-item-card"]').should('not.contain', '套餐')
// 验证默认收起状态
cy.get('[data-cy="selected-item-card"]').find('[data-cy="method-detail"]').should('not.be.visible')
// 点击展开
cy.get('[data-cy="expand-toggle"]').click()
cy.get('[data-cy="method-detail"]').should('be.visible')
// 验证悬停显示完整名称
cy.get('[data-cy="item-name"]').trigger('mouseover')
cy.get('.el-tooltip__trigger').should('have.attr', 'title')
})
it('should render hierarchical structure (Item > Method) correctly', () => {
cy.login('doctor1', '123456')
cy.visit('/outpatient/examination-application')
cy.get('[data-cy="exam-category-ultrasound"]').click()
cy.get('[data-cy="exam-item-128"]').click()
cy.get('[data-cy="expand-toggle"]').click()
// 验证层级结构:项目为父级,方法为子级独立勾选
cy.get('[data-cy="selected-item-card"]').within(() => {
cy.get('.item-name').should('contain', '128线排')
cy.get('[data-cy="method-detail"]').find('label').should('have.length.greaterThan', 0)
})
})
})