|
|
@@ -498,22 +498,33 @@ test.describe('订单人员关联测试', () => {
|
|
|
await orderManagementPage.submitForm();
|
|
|
await orderManagementPage.waitForDialogClosed();
|
|
|
await orderManagementPage.openPersonManagementDialog(testData.orderName);
|
|
|
- const addButton = page.getByRole('button', { name: /添加人员|新增人员/ });
|
|
|
+ // 使用 first() 因为有两个"添加人员"按钮(卡片中+底部)
|
|
|
+ const addButton = page.getByRole('button', { name: /添加人员|新增人员/ }).first();
|
|
|
await addButton.click();
|
|
|
await page.waitForTimeout(300);
|
|
|
- const hasPersonToAdd = await selectDisabledPersonInAddDialog(page, createdPersonName);
|
|
|
- if (!hasPersonToAdd) {
|
|
|
- await page.keyboard.press('Escape');
|
|
|
- await orderManagementPage.closeDetailDialog();
|
|
|
- test.skip(true, '没有可用的残疾人数据');
|
|
|
- return;
|
|
|
- }
|
|
|
- await page.getByLabel(/入职日期/).fill(testData.hireDate);
|
|
|
- await page.getByLabel(/薪资|工资/).fill(String(testData.salary));
|
|
|
- const submitButton = page.getByRole('button', { name: /^(添加|确定|保存)$/ });
|
|
|
- await submitButton.click();
|
|
|
- await page.waitForLoadState('domcontentloaded')
|
|
|
- .catch(() => console.debug('domcontentloaded 超时,继续检查 Toast 消息'));
|
|
|
+
|
|
|
+ // 等待残疾人选择对话框打开
|
|
|
+ const dialog = page.getByTestId('disabled-person-selector-dialog');
|
|
|
+ await dialog.waitFor({ state: 'visible', timeout: 5000 });
|
|
|
+
|
|
|
+ // 等待自动选择完成(通过检查待添加人员数量)
|
|
|
+ // 使用 test-id 检查待添加人员列表
|
|
|
+ const pendingPersonsDebug = page.getByTestId('pending-persons-debug');
|
|
|
+ await pendingPersonsDebug.waitFor({ state: 'attached', timeout: 10000 });
|
|
|
+
|
|
|
+ // 检查待添加人员数量
|
|
|
+ const pendingData = await pendingPersonsDebug.textContent();
|
|
|
+ console.log('待添加人员数据:', pendingData);
|
|
|
+
|
|
|
+ // 关闭残疾人选择对话框
|
|
|
+ await page.keyboard.press('Escape');
|
|
|
+ await dialog.waitFor({ state: 'hidden', timeout: 5000 });
|
|
|
+
|
|
|
+ // 点击"确认添加"按钮批量添加人员
|
|
|
+ const confirmButton = page.getByTestId('confirm-add-persons-button');
|
|
|
+ await confirmButton.click();
|
|
|
+
|
|
|
+ // 等待成功 toast
|
|
|
await page.waitForTimeout(1000);
|
|
|
const successToast = page.locator('[data-sonner-toast][data-type="success"]');
|
|
|
const hasSuccess = await successToast.count() > 0;
|