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

106 lines
4.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, 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, optimize display, and structure hierarchy', () => {
cy.login('doctor1', '123456')
cy.visit('/outpatient/examination-application')
// 验证项目与检查方法解耦勾选
cy.get('[data-cy="item-list"] li').first().click()
cy.get('[data-cy="selected-card"]').should('be.visible')
cy.get('[data-cy="expand-btn"]').click()
cy.get('[data-cy="method-item"] input[type="checkbox"]').first().check()
// 验证层级结构与显示优化
cy.get('[data-cy="details-panel"]').should('be.visible')
cy.get('[data-cy="method-list"]').should('have.length.greaterThan', 0)
})
})
// =========================================================================
// Bug #574 Regression Test
// =========================================================================
describe('Bug #574: 预约签到缴费成功后排班号状态流转', { tags: ['@bug574', '@regression'] }, () => {
it('should update adm_schedule_slot.status to 3 after successful check-in and payment', () => {
cy.login('admin', '123456')
cy.visit('/outpatient/registration')
// 1. 搜索并选择已预约患者
cy.get('[data-cy="patient-search-input"]').type('预约测试患者')
cy.get('[data-cy="search-btn"]').click()
cy.get('[data-cy="appointment-list"] [data-cy="row"]').first().click()
// 2. 执行预约签到
cy.get('[data-cy="checkin-btn"]').click()
cy.get('[data-cy="confirm-checkin"]').click()
// 3. 执行缴费
cy.get('[data-cy="pay-btn"]').click()
cy.get('[data-cy="payment-modal"]').should('be.visible')
cy.get('[data-cy="confirm-payment"]').click()
// 4. 验证成功提示
cy.contains('签到缴费成功').should('be.visible')
// 5. 验证排班号状态已更新为 3 (拦截状态查询接口验证数据库流转结果)
cy.intercept('GET', '**/api/schedule-slot/by-order/*').as('fetchSlotStatus')
cy.wait('@fetchSlotStatus').then((interception) => {
expect(interception.response.body.status).to.eq('3')
})
})
})