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

44 lines
1.9 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, expect } from 'vitest'
import { mount } from '@vue/test-utils'
// 注:实际项目可能使用 Cypress/Playwright此处以标准 E2E 断言结构演示,可根据实际测试框架替换底层 API
import ExamApply from '@/views/outpatient/exam/ExamApply.vue'
describe('门诊检查申请单交互回归测试', () => {
// ... 原有测试用例 ...
describe('Bug #550 Regression', { tags: ['@bug550', '@regression'] }, () => {
it('应解耦项目与方法勾选、修复卡片显示并实现结构化层级展示', async () => {
const wrapper = mount(ExamApply, {
global: {
stubs: { 'el-tree': true, 'el-checkbox-group': true, 'el-checkbox': true, 'el-tooltip': true, 'el-icon': true }
}
})
// 1. 模拟勾选彩超项目 "128线排"
await wrapper.find('.item-checkbox[data-id="item_128"]').trigger('click')
// 验证:检查方法未被自动勾选(解耦)
const methodCheckbox = wrapper.find('.method-checkbox[data-id="method_default"]')
expect(methodCheckbox.attributes('checked')).toBeUndefined()
// 2. 验证已选卡片显示
const selectedCard = wrapper.find('.selected-card')
expect(selectedCard.text()).not.toContain('套餐') // 去除冗余前缀
expect(selectedCard.attributes('title')).toContain('128线排') // 完整名称提示
// 3. 验证默认收起状态
const detailsPanel = wrapper.find('.selected-details')
expect(detailsPanel.isVisible()).toBe(false)
// 4. 验证层级结构:项目 > 检查方法
const hierarchy = wrapper.find('.selected-list')
expect(hierarchy.find('.group-header').exists()).toBe(true)
expect(hierarchy.find('.method-item').exists()).toBe(true)
// 点击展开验证
await wrapper.find('.group-header').trigger('click')
expect(detailsPanel.isVisible()).toBe(true)
})
})
})