|
|
@@ -1132,20 +1132,22 @@ export class OrderManagementPage {
|
|
|
const targetButton = uploadButton.nth(buttonIndex);
|
|
|
await targetButton.click();
|
|
|
|
|
|
- // 等待 FileSelector 对话框打开(第三个对话框)
|
|
|
- await this.page.waitForTimeout(TIMEOUTS.MEDIUM);
|
|
|
-
|
|
|
// FileSelector 对话框的 data-testid 是 "file-selector-dialog"
|
|
|
const fileSelectorDialog = this.page.getByTestId('file-selector-dialog');
|
|
|
- const dialogVisible = await fileSelectorDialog.count() > 0;
|
|
|
|
|
|
- if (!dialogVisible) {
|
|
|
- console.debug('FileSelector 对话框未打开');
|
|
|
+ // 等待 FileSelector 对话框打开(第三个对话框)
|
|
|
+ // 使用 expect().toBeVisible() 主动等待,而不是被动超时
|
|
|
+ try {
|
|
|
+ await fileSelectorDialog.waitFor({ state: 'visible', timeout: TIMEOUTS.DIALOG });
|
|
|
+ console.debug('FileSelector 对话框已打开');
|
|
|
+ } catch (_error) {
|
|
|
+ console.debug('FileSelector 对话框未打开(超时)');
|
|
|
+ // 打印调试信息
|
|
|
+ const allDialogs = await this.page.locator('[role="dialog"]').count();
|
|
|
+ console.debug(`当前页面对话框数量: ${allDialogs}`);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- console.debug('FileSelector 对话框已打开');
|
|
|
-
|
|
|
// 使用 uploadFileToField 上传文件
|
|
|
// MinioUploader 使用 data-testid="minio-uploader-input"(因为 testId 未被传递)
|
|
|
try {
|
|
|
@@ -1159,7 +1161,7 @@ export class OrderManagementPage {
|
|
|
}
|
|
|
);
|
|
|
console.debug(`文件 ${fileName} 上传操作已完成`);
|
|
|
- } catch (error) {
|
|
|
+ } catch (_error) {
|
|
|
console.debug('文件上传失败:', error);
|
|
|
// 即使上传失败,也尝试关闭对话框
|
|
|
await fileSelectorDialog.getByRole('button', { name: '取消' }).click().catch(() => {});
|
|
|
@@ -1508,7 +1510,7 @@ export class OrderManagementPage {
|
|
|
|
|
|
try {
|
|
|
await menuButton.click();
|
|
|
- } catch (error) {
|
|
|
+ } catch (_error) {
|
|
|
console.debug(`无法打开订单 "${orderName}" 的菜单:`, error);
|
|
|
return false;
|
|
|
}
|
|
|
@@ -1554,7 +1556,7 @@ export class OrderManagementPage {
|
|
|
|
|
|
try {
|
|
|
await menuButton.click();
|
|
|
- } catch (error) {
|
|
|
+ } catch (_error) {
|
|
|
console.debug(`无法打开订单 "${orderName}" 的菜单:`, error);
|
|
|
return false;
|
|
|
}
|