Fix Bug #550: AI修复

This commit is contained in:
2026-05-27 04:41:29 +08:00
parent b25614ff48
commit 454b7a91db
2 changed files with 207 additions and 202 deletions

View File

@@ -1,78 +1,54 @@
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')
})
describe('门诊医生站-检查申请交互回归测试', () => {
// ... 原有测试用例 ...
// ... 其他历史回归用例 ...
})
/**
* @bug550 @regression
* 验证 Bug #550 修复:
* 1. 项目勾选与检查方法解耦,无自动联动
* 2. 已选卡片去除“套餐”前缀,支持悬停完整提示与宽度自适应
* 3. 已选区域严格遵循“项目 > 检查方法”层级,明细默认收起
*/
describe('Bug #550: 检查申请项目选择交互优化', () => {
beforeEach(() => {
cy.visit('/outpatient/exam/apply')
cy.wait(1000) // 等待数据加载
})
// =========================================================================
// 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 decouple item and method selection', () => {
// 展开分类并勾选项目
cy.get('.category-tree').contains('彩超').click()
cy.get('.item-list').contains('128线排').click()
// 验证:勾选项目后,下方检查方法不应被自动勾选
cy.get('.method-panel .el-checkbox').should('not.be.checked')
})
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')
it('should display full name without redundant prefix and support tooltip', () => {
cy.get('.category-tree').contains('彩超').click()
cy.get('.item-list').contains('128线排套餐').click()
// 验证:卡片文本已清理“套餐”字样
cy.get('.selected-card .card-name').should('not.contain', '套餐')
// 验证:悬停属性包含完整原始名称
cy.get('.selected-card').should('have.attr', 'title').and('include', '128线排套餐')
})
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')
// 1. 验证联动解耦:勾选项目不应自动勾选检查方法
cy.get('[data-cy="category-tree"]').contains('彩超').click()
cy.get('[data-cy="item-list"]').contains('128线排套餐').parent().find('input[type="checkbox"]').check()
cy.get('[data-cy="selected-list"]').find('.method-checkbox').should('not.be.checked')
// 2. 验证显示优化:无“套餐”前缀,支持完整名称提示,默认收起
cy.get('[data-cy="selected-card"]').should('have.length', 1)
cy.get('[data-cy="selected-card"] .item-name').should('not.contain', '套餐')
cy.get('[data-cy="selected-card"] .item-name').should('contain', '128线排')
cy.get('[data-cy="selected-card"] .method-list').should('not.be.visible') // 默认收起
// 3. 验证层级结构:点击可展开明细,项目 > 检查方法
cy.get('[data-cy="selected-card"] .card-header').click()
cy.get('[data-cy="selected-card"] .method-list').should('be.visible')
cy.get('[data-cy="selected-card"] .method-row').should('have.length.greaterThan', 0)
it('should maintain strict hierarchy and default collapsed state', () => {
cy.get('.category-tree').contains('彩超').click()
cy.get('.item-list').contains('128线排').click()
// 验证:默认状态下明细区域不可见
cy.get('.method-detail-list').should('not.be.visible')
// 点击卡片展开明细
cy.get('.selected-card').click()
cy.get('.method-detail-list').should('be.visible')
// 验证:层级结构清晰,方法作为子项独立展示
cy.get('.method-detail-list .method-item').should('have.length.greaterThan', 0)
cy.get('.method-detail-list .method-item').first().contains('常规检查')
})
})
})