98 lines
4.1 KiB
TypeScript
Executable File
98 lines
4.1 KiB
TypeScript
Executable File
import { describe, it, beforeEach } from 'cypress'
|
||
|
||
// ... existing regression tests ...
|
||
|
||
describe('Bug #550 Regression', { tags: ['@bug550', '@regression'] }, () => {
|
||
beforeEach(() => {
|
||
// 模拟进入门诊医生站检查申请页
|
||
cy.visit('/outpatient/doctor/examination')
|
||
// 拦截并Mock基础数据,确保测试环境稳定
|
||
cy.intercept('GET', '/api/examination/categories', { fixture: 'examination-categories.json' }).as('getCategories')
|
||
cy.intercept('GET', '/api/examination/items', { fixture: 'examination-items.json' }).as('getItems')
|
||
})
|
||
|
||
it('should decouple item/method selection, display full names without prefix, and render hierarchical details', () => {
|
||
// 1. 展开分类并勾选项目
|
||
cy.get('[data-cy="category-tree"]').contains('彩超').click()
|
||
cy.get('[data-cy="item-checkbox"]').contains('128线排').click()
|
||
|
||
// 2. 验证联动冲突已修复:检查方法不应被自动勾选
|
||
cy.get('[data-cy="method-checkbox"]').should('not.be.checked')
|
||
|
||
// 3. 验证名称显示:去除“套餐”前缀,且支持完整显示/Tooltip
|
||
cy.get('[data-cy="selected-card-name"]').should('not.contain', '套餐')
|
||
cy.get('[data-cy="selected-card-name"]').should('contain', '128线排')
|
||
// 验证卡片宽度自适应,无固定宽度导致的截断溢出
|
||
cy.get('[data-cy="selected-card"]').invoke('css', 'width').should('not.equal', '0px')
|
||
|
||
// 4. 验证默认收起状态
|
||
cy.get('[data-cy="selected-card"]').find('.card-details').should('not.be.visible')
|
||
|
||
// 5. 验证展开后层级结构:项目 > 检查方法
|
||
cy.get('[data-cy="expand-toggle"]').click()
|
||
cy.get('[data-cy="selected-card"]').find('.card-details').should('be.visible')
|
||
cy.get('[data-cy="selected-card"]').find('.method-row').should('have.length.greaterThan', 0)
|
||
|
||
// 6. 验证无冗余标签
|
||
cy.get('[data-cy="selected-card"]').should('not.contain', '项目套餐明细')
|
||
})
|
||
})
|
||
|
||
describe('Bug #561 Regression', { tags: ['@bug561', '@regression'] }, () => {
|
||
beforeEach(() => {
|
||
cy.visit('/outpatient/doctor/order')
|
||
})
|
||
|
||
it('should display total unit from treatment catalog instead of null', () => {
|
||
// 拦截医嘱详情接口,模拟返回诊疗目录配置的“使用单位”
|
||
cy.intercept('GET', '/api/outpatient/orders/*/detail', {
|
||
statusCode: 200,
|
||
body: {
|
||
id: 1001,
|
||
itemName: '超声切骨刀辅助操作',
|
||
totalQuantity: 1,
|
||
totalUnit: '次'
|
||
}
|
||
}).as('getOrderDetail')
|
||
|
||
// 模拟进入医嘱详情页
|
||
cy.visit('/outpatient/doctor/order/1001')
|
||
cy.wait('@getOrderDetail')
|
||
cy.get('[data-cy="total-unit-display"]').should('contain', '次')
|
||
})
|
||
})
|
||
|
||
describe('Bug #505 Regression', { tags: ['@bug505', '@regression'] }, () => {
|
||
beforeEach(() => {
|
||
cy.visit('/inpatient/nurse/order-verify')
|
||
// Mock 已校对列表数据:包含已发药和未发药医嘱
|
||
cy.intercept('GET', '/api/inpatient/orders/verified', {
|
||
statusCode: 200,
|
||
body: [
|
||
{ id: 1001, drugName: '头孢哌酮钠舒巴坦钠', execStatus: 'EXECUTED', dispenseStatus: 'DISPENSED' },
|
||
{ id: 1002, drugName: '生理盐水', execStatus: 'UNEXECUTED', dispenseStatus: 'UNDISPENSED' }
|
||
]
|
||
}).as('getVerifiedOrders')
|
||
})
|
||
|
||
it('should disable return button and show warning for dispensed orders', () => {
|
||
cy.wait('@getVerifiedOrders')
|
||
|
||
// 验证已发药医嘱:退回按钮置灰,悬停显示提示
|
||
cy.get('[data-cy="order-row-1001"]').within(() => {
|
||
cy.get('[data-cy="return-btn"]').should('be.disabled')
|
||
cy.get('[data-cy="return-btn"]').trigger('mouseenter')
|
||
cy.get('.el-tooltip__popper').should('contain', '该药品已由药房发放,请先执行退药处理,不可直接退回')
|
||
})
|
||
|
||
// 验证未发药医嘱:退回按钮可用
|
||
cy.get('[data-cy="order-row-1002"]').within(() => {
|
||
cy.get('[data-cy="return-btn"]').should('not.be.disabled')
|
||
})
|
||
|
||
// 验证勾选已发药医嘱后,顶部批量退回按钮自动置灰
|
||
cy.get('[data-cy="order-checkbox-1001"]').click()
|
||
cy.get('[data-cy="batch-return-btn"]').should('be.disabled')
|
||
})
|
||
})
|