|
|
@@ -90,50 +90,6 @@ vi.mock('@d8d/file-management-ui', () => ({
|
|
|
})
|
|
|
}));
|
|
|
|
|
|
-// Mock 残疾人选择器组件
|
|
|
-vi.mock('@d8d/allin-disability-person-management-ui', () => ({
|
|
|
- DisabledPersonSelector: vi.fn(({ open, onOpenChange, onSelect, mode }) => {
|
|
|
- if (!open) return null;
|
|
|
-
|
|
|
- return (
|
|
|
- <div data-testid="disabled-person-selector-mock">
|
|
|
- <div>残疾人选择器模拟</div>
|
|
|
- <button
|
|
|
- data-testid="select-person-button"
|
|
|
- onClick={() => {
|
|
|
- const mockPerson = {
|
|
|
- id: 1,
|
|
|
- name: '测试残疾人',
|
|
|
- gender: '男',
|
|
|
- disabilityId: 'D123456',
|
|
|
- disabilityType: '肢体残疾',
|
|
|
- disabilityLevel: '三级',
|
|
|
- phone: '13800138000',
|
|
|
- province: '北京',
|
|
|
- city: '北京市',
|
|
|
- // 注意:原系统使用字符串存储省市,而不是ID
|
|
|
- // 薪资查询函数现在需要省市ID,但这里保持原样
|
|
|
- // 实际应该从API获取省市ID
|
|
|
- };
|
|
|
- onSelect(mode === 'multiple' ? [mockPerson] : mockPerson);
|
|
|
- // 选择人员后自动关闭残疾人选择器,模拟真实行为
|
|
|
- onOpenChange(false);
|
|
|
- }}
|
|
|
- style={{ pointerEvents: 'auto' }} // 确保按钮可以点击
|
|
|
- >
|
|
|
- 选择测试人员
|
|
|
- </button>
|
|
|
- <button
|
|
|
- data-testid="close-selector-button"
|
|
|
- onClick={() => onOpenChange(false)}
|
|
|
- style={{ pointerEvents: 'auto' }} // 确保按钮可以点击
|
|
|
- >
|
|
|
- 关闭
|
|
|
- </button>
|
|
|
- </div>
|
|
|
- );
|
|
|
- })
|
|
|
-}));
|
|
|
|
|
|
// Mock 共享工具包中的rpcClient函数
|
|
|
vi.mock('@d8d/shared-ui-components/utils/hc', () => ({
|
|
|
@@ -178,6 +134,61 @@ vi.mock('@d8d/shared-ui-components/utils/hc', () => ({
|
|
|
total: 3
|
|
|
})
|
|
|
}))
|
|
|
+ },
|
|
|
+ // 残疾人API - 用于残疾人选择器组件
|
|
|
+ searchDisabledPersons: {
|
|
|
+ $get: vi.fn(() => Promise.resolve({
|
|
|
+ status: 200,
|
|
|
+ json: async () => ({
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ name: '测试残疾人',
|
|
|
+ gender: '男',
|
|
|
+ idCard: '110101199001011234', // 添加身份证号字段
|
|
|
+ disabilityId: 'D123456',
|
|
|
+ disabilityType: '肢体残疾',
|
|
|
+ disabilityLevel: '三级',
|
|
|
+ phone: '13800138000',
|
|
|
+ province: '北京',
|
|
|
+ city: '北京市',
|
|
|
+ provinceId: 1,
|
|
|
+ cityId: 2,
|
|
|
+ isInBlackList: 0
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ total: 1,
|
|
|
+ page: 1,
|
|
|
+ pageSize: 10
|
|
|
+ })
|
|
|
+ }))
|
|
|
+ },
|
|
|
+ getAllDisabledPersons: {
|
|
|
+ $get: vi.fn(() => Promise.resolve({
|
|
|
+ status: 200,
|
|
|
+ json: async () => ({
|
|
|
+ data: [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ name: '测试残疾人',
|
|
|
+ gender: '男',
|
|
|
+ idCard: '110101199001011234', // 添加身份证号字段
|
|
|
+ disabilityId: 'D123456',
|
|
|
+ disabilityType: '肢体残疾',
|
|
|
+ disabilityLevel: '三级',
|
|
|
+ phone: '13800138000',
|
|
|
+ province: '北京',
|
|
|
+ city: '北京市',
|
|
|
+ provinceId: 1,
|
|
|
+ cityId: 2,
|
|
|
+ isInBlackList: 0
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ total: 1,
|
|
|
+ page: 1,
|
|
|
+ pageSize: 10
|
|
|
+ })
|
|
|
+ }))
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -828,7 +839,7 @@ describe('订单管理集成测试', () => {
|
|
|
|
|
|
// 验证残疾人选择器打开
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.getByTestId('disabled-person-selector-mock')).toBeInTheDocument();
|
|
|
+ expect(screen.getByTestId("disabled-persons-table")).toBeInTheDocument();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
@@ -863,7 +874,7 @@ describe('订单管理集成测试', () => {
|
|
|
|
|
|
// 验证残疾人选择器打开
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.getByTestId('disabled-person-selector-mock')).toBeInTheDocument();
|
|
|
+ expect(screen.getByTestId("disabled-persons-table")).toBeInTheDocument();
|
|
|
});
|
|
|
|
|
|
// 选择人员
|
|
|
@@ -872,7 +883,7 @@ describe('订单管理集成测试', () => {
|
|
|
|
|
|
// 等待残疾人选择器关闭(选择人员后会自动关闭)
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.queryByTestId('disabled-person-selector-mock')).not.toBeInTheDocument();
|
|
|
+ expect(screen.queryByTestId('disabled-persons-table')).not.toBeInTheDocument();
|
|
|
});
|
|
|
|
|
|
const dialogTitle = screen.queryByTestId('batch-add-persons-dialog-title');
|
|
|
@@ -1144,18 +1155,24 @@ describe('订单管理集成测试', () => {
|
|
|
const selectPersonsButton = screen.getByTestId('select-persons-button');
|
|
|
fireEvent.click(selectPersonsButton);
|
|
|
|
|
|
- // 验证残疾人选择器打开
|
|
|
+ // 验证残疾人选择器打开 - 查找对话框或表格
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.getByTestId('disabled-person-selector-mock')).toBeInTheDocument();
|
|
|
+ // 查找残疾人选择器的表格或其他元素
|
|
|
+ expect(screen.getByTestId('disabled-persons-table')).toBeInTheDocument();
|
|
|
});
|
|
|
|
|
|
- // 选择测试人员
|
|
|
- const selectPersonButton = screen.getByTestId('select-person-button');
|
|
|
- await userEvent.click(selectPersonButton);
|
|
|
+ // 选择测试人员 - 在多选模式下需要勾选复选框,然后点击确认按钮
|
|
|
+ // 首先找到复选框(在表格行的第一个单元格中)
|
|
|
+ const checkbox = screen.getByRole('checkbox', { name: '选择' });
|
|
|
+ await userEvent.click(checkbox);
|
|
|
+
|
|
|
+ // 然后点击确认选择按钮
|
|
|
+ const confirmButton = screen.getByTestId('confirm-batch-button');
|
|
|
+ await userEvent.click(confirmButton);
|
|
|
|
|
|
// 等待残疾人选择器关闭(选择人员后会自动关闭)
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.queryByTestId('disabled-person-selector-mock')).not.toBeInTheDocument();
|
|
|
+ expect(screen.queryByTestId('disabled-persons-table')).not.toBeInTheDocument();
|
|
|
});
|
|
|
|
|
|
// 验证人员被添加到列表
|
|
|
@@ -1365,7 +1382,7 @@ describe('订单管理集成测试', () => {
|
|
|
|
|
|
// 验证残疾人选择器打开
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.getByTestId('disabled-person-selector-mock')).toBeInTheDocument();
|
|
|
+ expect(screen.getByTestId("disabled-persons-table")).toBeInTheDocument();
|
|
|
});
|
|
|
});
|
|
|
|
|
|
@@ -1476,7 +1493,7 @@ describe('订单管理集成测试', () => {
|
|
|
|
|
|
// 验证残疾人选择器打开
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.getByTestId('disabled-person-selector-mock')).toBeInTheDocument();
|
|
|
+ expect(screen.getByTestId("disabled-persons-table")).toBeInTheDocument();
|
|
|
});
|
|
|
|
|
|
// 选择人员
|
|
|
@@ -1485,7 +1502,7 @@ describe('订单管理集成测试', () => {
|
|
|
|
|
|
// 等待残疾人选择器自动关闭(选择人员后自动关闭)
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.queryByTestId('disabled-person-selector-mock')).not.toBeInTheDocument();
|
|
|
+ expect(screen.queryByTestId('disabled-person-selector-real')).not.toBeInTheDocument();
|
|
|
});
|
|
|
|
|
|
// 等待handlePersonSelect完成
|
|
|
@@ -1526,7 +1543,7 @@ describe('订单管理集成测试', () => {
|
|
|
const addPersonsButton = screen.getByTestId('order-detail-card-add-persons-button');
|
|
|
await userEvent.click(addPersonsButton);
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.getByTestId('disabled-person-selector-mock')).toBeInTheDocument();
|
|
|
+ expect(screen.getByTestId("disabled-persons-table")).toBeInTheDocument();
|
|
|
});
|
|
|
const selectPersonButton = screen.getByTestId('select-person-button');
|
|
|
await userEvent.click(selectPersonButton);
|
|
|
@@ -1567,7 +1584,7 @@ describe('订单管理集成测试', () => {
|
|
|
const addPersonsButton = screen.getByTestId('order-detail-card-add-persons-button');
|
|
|
await userEvent.click(addPersonsButton);
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.getByTestId('disabled-person-selector-mock')).toBeInTheDocument();
|
|
|
+ expect(screen.getByTestId("disabled-persons-table")).toBeInTheDocument();
|
|
|
});
|
|
|
const selectPersonButton = screen.getByTestId('select-person-button');
|
|
|
await userEvent.click(selectPersonButton);
|
|
|
@@ -1609,7 +1626,7 @@ describe('订单管理集成测试', () => {
|
|
|
const addPersonsButton = screen.getByTestId('order-detail-card-add-persons-button');
|
|
|
await userEvent.click(addPersonsButton);
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.getByTestId('disabled-person-selector-mock')).toBeInTheDocument();
|
|
|
+ expect(screen.getByTestId("disabled-persons-table")).toBeInTheDocument();
|
|
|
});
|
|
|
const selectPersonButton = screen.getByTestId('select-person-button');
|
|
|
await userEvent.click(selectPersonButton);
|
|
|
@@ -1673,7 +1690,7 @@ describe('订单管理集成测试', () => {
|
|
|
const addPersonsButton = screen.getByTestId('order-detail-card-add-persons-button');
|
|
|
await userEvent.click(addPersonsButton);
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.getByTestId('disabled-person-selector-mock')).toBeInTheDocument();
|
|
|
+ expect(screen.getByTestId("disabled-persons-table")).toBeInTheDocument();
|
|
|
});
|
|
|
|
|
|
// 第一次选择人员
|
|
|
@@ -1692,7 +1709,7 @@ describe('订单管理集成测试', () => {
|
|
|
// 再次打开选择器并选择相同人员
|
|
|
await userEvent.click(addPersonsButton);
|
|
|
await waitFor(() => {
|
|
|
- expect(screen.getByTestId('disabled-person-selector-mock')).toBeInTheDocument();
|
|
|
+ expect(screen.getByTestId("disabled-persons-table")).toBeInTheDocument();
|
|
|
});
|
|
|
await userEvent.click(selectPersonButton);
|
|
|
|