Files
his/tests/e2e/specs/bug-regression.spec.ts
2026-05-26 21:15:29 +08:00

67 lines
3.2 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
import LabRequest from '@/views/inpatientdoctorstation/lab/LabRequest.vue';
import OutpatientDailySettlement from '@/views/billing/outpatientsettlement/OutpatientDailySettlement.vue';
// @bug466 @regression
describe('Bug #466: 检验申请单核心质控字段及联动逻辑', () => {
it('应默认显示申请类型、标本类型、执行时间字段', () => {
const wrapper = mount(LabRequest, {
global: { stubs: ['el-dialog', 'el-tree', 'el-checkbox-group', 'el-radio-group', 'el-input', 'el-date-picker'] }
});
expect(wrapper.find('[data-cy="application-type"]').exists()).toBe(true);
expect(wrapper.find('[data-cy="specimen-type"]').exists()).toBe(true);
expect(wrapper.find('[data-cy="execution-time"]').exists()).toBe(true);
});
it('申请类型应默认选中普通,支持切换急诊', () => {
const wrapper = mount(LabRequest, {
global: { stubs: ['el-dialog', 'el-tree', 'el-checkbox-group', 'el-radio-group', 'el-input', 'el-date-picker'] }
});
const radioGroup = wrapper.find('[data-cy="application-type"]');
expect(radioGroup.vm.modelValue).toBe('1'); // 1: 普通
radioGroup.vm.$emit('update:modelValue', '2');
expect(radioGroup.vm.modelValue).toBe('2'); // 2: 急诊
});
it('勾选检验项目后应自动带出标本类型', async () => {
const wrapper = mount(LabRequest, {
global: { stubs: ['el-dialog', 'el-tree', 'el-checkbox-group', 'el-radio-group', 'el-input', 'el-date-picker'] }
});
wrapper.vm.selectedItemIds = [101];
wrapper.vm.itemList = [{ id: 101, name: '血常规', specimenType: '血液' }];
await wrapper.vm.$nextTick();
wrapper.vm.onItemSelectChange([101]);
await wrapper.vm.$nextTick();
expect(wrapper.vm.specimenType).toBe('血液');
});
it('执行时间早于当前时间时应拦截并提示', async () => {
const wrapper = mount(LabRequest, {
global: { stubs: ['el-dialog', 'el-tree', 'el-checkbox-group', 'el-radio-group', 'el-input', 'el-date-picker'] }
});
const pastTime = new Date();
pastTime.setFullYear(pastTime.getFullYear() - 1);
wrapper.vm.executionTime = pastTime;
await wrapper.vm.$nextTick();
const mockAlert = vi.fn();
wrapper.vm.$alert = mockAlert;
wrapper.vm.handleSubmit();
expect(mockAlert).toHaveBeenCalledWith('执行时间不可早于当前时间', '提示', { type: 'warning' });
});
});
// @bug568 @regression
describe('Bug #568: 收费工作站-门诊日结排版修复', () => {
it('门诊日结页面应包含清晰的布局结构:顶部筛选区、汇总卡片区、明细表格区', () => {
const wrapper = mount(OutpatientDailySettlement, {
global: { stubs: ['el-card', 'el-form', 'el-form-item', 'el-date-picker', 'el-select', 'el-option', 'el-button', 'el-row', 'el-col', 'el-table', 'el-table-column'] }
});
expect(wrapper.find('.settlement-filter-area').exists()).toBe(true);
expect(wrapper.find('.settlement-summary-cards').exists()).toBe(true);
expect(wrapper.find('.settlement-detail-table').exists()).toBe(true);
expect(wrapper.findAll('.summary-card').length).toBeGreaterThanOrEqual(3);
});
});