|
|
@@ -782,7 +782,7 @@ describe('订单管理集成测试', () => {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it.skip('应该成功批量添加人员到已存在订单', async () => {
|
|
|
+ it('应该成功批量添加人员到已存在订单', async () => {
|
|
|
renderOrderManagement();
|
|
|
|
|
|
// 等待数据加载
|
|
|
@@ -809,9 +809,19 @@ describe('订单管理集成测试', () => {
|
|
|
expect(screen.getByTestId('batch-add-persons-dialog-title')).toBeInTheDocument();
|
|
|
});
|
|
|
|
|
|
- // 点击选择残疾人按钮 - 使用role和文本查找
|
|
|
- const selectPersonsButtons = screen.getAllByRole('button', { name: /选择残疾人/ });
|
|
|
- const selectPersonsButton = selectPersonsButtons[0]; // 第一个是PersonSelector中的按钮
|
|
|
+ // 调试:查看当前所有按钮
|
|
|
+ const allButtons = screen.getAllByRole('button');
|
|
|
+ console.debug('所有按钮文本:', allButtons.map(btn => btn.textContent).filter(t => t && t.trim()));
|
|
|
+
|
|
|
+ // 调试:查看当前所有test ID
|
|
|
+ const allTestIdsBefore = screen.getAllByTestId(/.*/);
|
|
|
+ console.debug('打开模态框后所有test ID:', allTestIdsBefore.map(el => el.getAttribute('data-testid')));
|
|
|
+
|
|
|
+ // 点击选择残疾人按钮 - 参考已通过的测试,使用test ID查找
|
|
|
+ await waitFor(() => {
|
|
|
+ expect(screen.getByTestId('select-persons-button')).toBeInTheDocument();
|
|
|
+ });
|
|
|
+ const selectPersonsButton = screen.getByTestId('select-persons-button');
|
|
|
await userEvent.click(selectPersonsButton);
|
|
|
|
|
|
// 验证残疾人选择器打开
|
|
|
@@ -828,9 +838,27 @@ describe('订单管理集成测试', () => {
|
|
|
expect(screen.queryByTestId('disabled-person-selector-mock')).not.toBeInTheDocument();
|
|
|
});
|
|
|
|
|
|
+ // 立即检查PersonSelector模态框是否还在
|
|
|
+ console.debug('选择人员后立即检查PersonSelector模态框...');
|
|
|
+ const dialogTitle = screen.queryByTestId('batch-add-persons-dialog-title');
|
|
|
+ console.debug('找到的dialogTitle:', dialogTitle ? '是' : '否');
|
|
|
+
|
|
|
+ // 调试:查看当前所有文本
|
|
|
+ console.debug('选择人员后所有文本:', Array.from(screen.getAllByText(/.*/)).map(el => el.textContent).filter(t => t && t.trim()));
|
|
|
+
|
|
|
+ // 调试:查看当前所有test ID
|
|
|
+ const allTestIds = screen.getAllByTestId(/.*/);
|
|
|
+ console.debug('选择人员后所有test ID:', allTestIds.map(el => el.getAttribute('data-testid')));
|
|
|
+
|
|
|
+ // 首先验证PersonSelector模态框仍然打开
|
|
|
+ await waitFor(() => {
|
|
|
+ expect(screen.getByTestId('batch-add-persons-dialog-title')).toBeInTheDocument();
|
|
|
+ });
|
|
|
+
|
|
|
// 验证人员被添加到列表
|
|
|
await waitFor(() => {
|
|
|
const personElements = screen.getAllByText('测试残疾人');
|
|
|
+ console.debug('找到的测试残疾人元素数量:', personElements.length);
|
|
|
expect(personElements.length).toBeGreaterThan(0);
|
|
|
});
|
|
|
|
|
|
@@ -841,8 +869,8 @@ describe('订单管理集成测试', () => {
|
|
|
const salaryInput = screen.getByTestId('salary-detail-input-1');
|
|
|
fireEvent.change(salaryInput, { target: { value: '5000元/月' } });
|
|
|
|
|
|
- const workStatusSelect = screen.getByTestId('work-status-input-1');
|
|
|
- await userEvent.selectOptions(workStatusSelect, 'WORKING');
|
|
|
+ const workStatusInput = screen.getByTestId('work-status-input-1');
|
|
|
+ fireEvent.change(workStatusInput, { target: { value: '在职' } });
|
|
|
|
|
|
// 提交表单
|
|
|
const submitButton = screen.getByRole('button', { name: /添加/ });
|
|
|
@@ -860,7 +888,7 @@ describe('订单管理集成测试', () => {
|
|
|
personId: 1,
|
|
|
joinDate: '2024-01-01T00:00:00.000Z',
|
|
|
salaryDetail: '5000元/月',
|
|
|
- workStatus: 'WORKING'
|
|
|
+ workStatus: 'working'
|
|
|
})
|
|
|
])
|
|
|
}
|