105 lines
4.4 KiB
TypeScript
Executable File
105 lines
4.4 KiB
TypeScript
Executable File
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')
|
||
// ... existing test logic ...
|
||
})
|
||
})
|
||
|
||
// =========================================================================
|
||
// Bug #503 Regression Test
|
||
// =========================================================================
|
||
describe('Bug #503: 住院发退药明细与汇总单触发时机同步', { tags: ['@bug503', '@regression'] }, () => {
|
||
it('should sync detail and summary visibility based on nurse drug submit mode', () => {
|
||
// 1. 护士执行医嘱
|
||
cy.login('wx', '123456')
|
||
cy.visit('/inpatient/nurse-station')
|
||
cy.get('[data-cy="order-list"] .order-item').first().click()
|
||
cy.get('[data-cy="btn-execute-order"]').click()
|
||
cy.get('[data-cy="confirm-execute"]').click()
|
||
|
||
// 2. 切换至药房查看(需申请模式下,执行后明细与汇总均不应显示)
|
||
cy.login('yjk1', '123456')
|
||
cy.visit('/pharmacy/inpatient-dispensing')
|
||
cy.intercept('GET', '**/api/pharmacy/dispensing/detail*').as('getDetail')
|
||
cy.intercept('GET', '**/api/pharmacy/dispensing/summary*').as('getSummary')
|
||
cy.reload()
|
||
cy.wait('@getDetail').its('response.body.data').should('be.empty')
|
||
cy.wait('@getSummary').its('response.body.data').should('be.empty')
|
||
|
||
// 3. 护士执行汇总发药申请
|
||
cy.login('wx', '123456')
|
||
cy.visit('/inpatient/nurse-station/summary-apply')
|
||
cy.get('[data-cy="btn-apply-summary"]').click()
|
||
cy.get('[data-cy="toast-success"]').should('be.visible')
|
||
|
||
// 4. 药房再次查看,明细与汇总应同时出现且数据一致
|
||
cy.login('yjk1', '123456')
|
||
cy.visit('/pharmacy/inpatient-dispensing')
|
||
cy.wait('@getDetail').its('response.body.data').should('have.length.greaterThan', 0)
|
||
cy.wait('@getSummary').its('response.body.data').should('have.length.greaterThan', 0)
|
||
|
||
// 验证明细与汇总的药品数量/状态一致
|
||
cy.get('[data-cy="detail-count"]').then($detail => {
|
||
const detailCount = parseInt($detail.text())
|
||
cy.get('[data-cy="summary-count"]').should('have.text', detailCount.toString())
|
||
})
|
||
})
|
||
})
|