import { describe, it, cy } from 'cypress' describe('HIS System Regression Tests', () => { beforeEach(() => { cy.login('nkhs1', '123456') }) it('should verify basic login and dashboard load', () => { cy.visit('/') cy.get('.dashboard-container').should('be.visible') }) // @bug544 @regression describe('Bug #544: Triage Queue List & Historical Query', () => { it('should display completed status patients and support historical date query', () => { cy.visit('/triage/queue') // 1. 验证默认加载当天数据 cy.get('[data-cy="queue-table"]').should('exist') cy.get('[data-cy="date-range-picker"]').should('contain', new Date().toISOString().slice(0, 10)) // 2. 验证可筛选“完诊”状态患者 cy.get('[data-cy="status-select"]').select('完诊') cy.get('[data-cy="search-btn"]').click() cy.get('[data-cy="queue-table"] tbody tr').should('have.length.greaterThan', 0) cy.get('[data-cy="queue-table"] .status-tag').should('contain', '完诊') // 3. 验证历史队列查询功能(按时间范围检索) cy.get('[data-cy="start-date"]').clear().type('2026-05-01') cy.get('[data-cy="end-date"]').clear().type('2026-05-02') cy.get('[data-cy="search-btn"]').click() cy.get('[data-cy="queue-table"]').should('exist') cy.url().should('include', 'startDate=2026-05-01') cy.url().should('include', 'endDate=2026-05-02') }) }) // @bug550 @regression describe('Bug #550: Exam Item Selection Interaction Optimization', () => { it('should decouple item/method selection, display full names without "套餐" prefix, and show hierarchical collapsed details', () => { cy.visit('/outpatient/examination/apply') // 1. 展开分类并勾选项目 cy.get('[data-cy="category-tree"]').contains('彩超').click() cy.get('[data-cy="item-list"]').contains('128线排').parent().find('input[type="checkbox"]').check() // 2. 验证联动解耦:检查方法区域未被自动勾选 cy.get('[data-cy="method-list"]').find('input[type="checkbox"]:checked').should('have.length', 0) // 3. 验证已选卡片显示:名称完整/提示,去除“套餐”冗余前缀 cy.get('[data-cy="selected-area"]').should('be.visible') cy.get('[data-cy="selected-card"]').should('contain', '128线排') cy.get('[data-cy="selected-card"]').should('not.contain', '套餐') // 4. 验证默认收起状态及层级结构(项目 > 检查方法) cy.get('[data-cy="selected-card"] .details-panel').should('not.be.visible') // 默认收起 cy.get('[data-cy="selected-card"] .card-header').click() // 点击展开 cy.get('[data-cy="selected-card"] .details-panel').should('be.visible') cy.get('[data-cy="selected-card"] .details-panel').should('contain', '检查方法') cy.get('[data-cy="selected-card"] .details-panel').should('not.contain', '项目套餐明细') // 验证冗余标签已移除 }) }) // @bug506 @regression describe('Bug #506: Outpatient Pre-consultation Cancellation DB State', () => { it('should correctly update order_main, slot, pool, and refund_log after cancellation', () => { cy.visit('/outpatient/registration') // Mock API to simulate successful cancellation flow cy.intercept('POST', '/api/outpatient/registration/cancel', { statusCode: 200, body: { success: true, message: '退号成功' } }).as('cancelRequest') // 1. 选择已缴费已签到患者 cy.get('[data-cy="patient-list"]').contains('压力山大').click() // 2. 点击退号并确认 cy.get('[data-cy="cancel-btn"]').click() cy.get('[data-cy="confirm-cancel-btn"]').click() cy.wait('@cancelRequest').then((interception) => { expect(interception.response.body.success).to.be.true }) // 3. 验证前端提示成功 cy.get('.el-message--success').should('contain', '退号成功') // 4. 验证号源状态回滚为“待约” cy.get('[data-cy="slot-status"]').should('contain', '待约') // 5. 验证订单列表状态更新为“已取消” cy.get('[data-cy="order-status-tag"]').should('contain', '已取消') }) }) })