Skip to content

Commit bea65f8

Browse files
gqcnclaude
andcommitted
fix(frontend): parallelize user drawer/modal setup and increase E2E dialog timeouts
Parallelize async setup tasks (status, role, tenant, dept) in user drawer and batch-edit modal with Promise.all to reduce initialization latency. Add DIALOG_READY_TIMEOUT (20s) to UserPage and apply to all waitForDialogReady calls, fixing E2E flakiness in TC0226 and TC0228 under act containers. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent b3e07db commit bea65f8

5 files changed

Lines changed: 32 additions & 13 deletions

File tree

apps/lina-vben/apps/web-antd/src/views/system/user/user-batch-edit-modal.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,11 @@ const [Modal, modalApi] = useVbenModal({
202202
updateTenant: false,
203203
});
204204
205-
await setupStatusOptions();
206-
await setupRoleOptions();
207-
await setupTenantOptions();
205+
await Promise.all([
206+
setupStatusOptions(),
207+
setupRoleOptions(),
208+
setupTenantOptions(),
209+
]);
208210
modalApi.setState({ loading: false });
209211
},
210212
async onConfirm() {

apps/lina-vben/apps/web-antd/src/views/system/user/user-drawer.vue

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ async function setupDeptSelect() {
159159
fieldName: 'deptId',
160160
},
161161
]);
162+
163+
return deptTree;
162164
}
163165
164166
const [Drawer, drawerApi] = useVbenDrawer({
@@ -199,15 +201,19 @@ const [Drawer, drawerApi] = useVbenDrawer({
199201
),
200202
});
201203
204+
const setupTasks: Promise<unknown>[] = [
205+
setupRoleOptions(),
206+
setupTenantOptions(),
207+
dictStore.getDictOptionsAsync('sys_normal_disable'),
208+
];
202209
if (orgEnabled.value) {
203-
await setupDeptSelect();
210+
setupTasks.push(setupDeptSelect());
204211
}
205212
206-
await setupRoleOptions();
207-
await setupTenantOptions();
208-
209-
const statusOptions =
210-
await dictStore.getDictOptionsAsync('sys_normal_disable');
213+
const setupResults = await Promise.all(setupTasks);
214+
const statusOptions = setupResults[2] as Awaited<
215+
ReturnType<typeof dictStore.getDictOptionsAsync>
216+
>;
211217
formApi.updateSchema([
212218
{
213219
fieldName: 'status',

hack/tests/e2e/settings/user/TC0226-user-account-labels.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ test.describe("TC-226 用户管理账号字段展示", () => {
3232
.locator('[role="dialog"]')
3333
.filter({ has: adminPage.getByPlaceholder("请输入账号") })
3434
.last(),
35+
20000,
3536
);
3637

3738
await expect(drawer.getByText(//).first()).toBeVisible();

hack/tests/pages/UserPage.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ export class UserPage {
1818
/** Drawer submit can settle slowly in full-suite parallel runs. */
1919
private static readonly DRAWER_HIDDEN_TIMEOUT = 20000;
2020

21+
/** User drawer and batch-edit modal can initialize slowly in act containers. */
22+
private static readonly DIALOG_READY_TIMEOUT = 20000;
23+
2124
/** The Vben drawer (Sheet/Dialog) container */
2225
private get drawer() {
2326
return this.page
@@ -54,7 +57,7 @@ export class UserPage {
5457

5558
/** Wait until the user drawer has finished async schema/data initialization. */
5659
private async waitForDrawerReady(expectedUsername: string) {
57-
await waitForDialogReady(this.drawer);
60+
await waitForDialogReady(this.drawer, UserPage.DIALOG_READY_TIMEOUT);
5861

5962
const usernameInput = this.drawerAccountInput;
6063
await usernameInput.waitFor({ state: "visible", timeout: 10000 });
@@ -366,7 +369,7 @@ export class UserPage {
366369
.locator('[role="dialog"]')
367370
.filter({ hasText: /|Batch Edit Users/i })
368371
.last();
369-
await waitForDialogReady(dialog);
372+
await waitForDialogReady(dialog, UserPage.DIALOG_READY_TIMEOUT);
370373
await waitForBusyIndicatorsToClear(dialog, 20000);
371374
return dialog;
372375
}
@@ -440,7 +443,10 @@ export class UserPage {
440443
/** Click export button */
441444
async clickExport() {
442445
await this.page.getByRole("button", { name: /\s*/ }).click();
443-
await waitForDialogReady(this.page.locator('[role="dialog"]'));
446+
await waitForDialogReady(
447+
this.page.locator('[role="dialog"]'),
448+
UserPage.DIALOG_READY_TIMEOUT,
449+
);
444450
}
445451

446452
/** Click confirm button in the export confirm modal */
@@ -518,7 +524,10 @@ export class UserPage {
518524
.getByRole("button", { name: /\s*/ })
519525
.first()
520526
.click();
521-
await waitForDialogReady(this.page.locator('[role="dialog"]'));
527+
await waitForDialogReady(
528+
this.page.locator('[role="dialog"]'),
529+
UserPage.DIALOG_READY_TIMEOUT,
530+
);
522531
}
523532

524533
/** Get the total count from the pager */

openspec/changes/release-test-and-build/tasks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
- [x] **FB-19**: GitHub Actions `E2E tests (host-only)``TC0012d` 字典类型删除和 `TC-228a` 用户批量编辑中仍存在重试状态丢失、删除响应监听不稳和全局加载遮罩拦截点击的问题,导致 nightly host-only E2E 失败
6565
- [x] **FB-20**: `.github/workflows/release-test-and-build.yml` 仍手工展开测试 job,未像 nightly 一样复用共享测试验证套件,且 release 应采用 Main CI 的简要测试范围,不运行完整 E2E
6666
- [ ] **FB-21**: host-only E2E `TC0063-auth-menu` 仍通过中文菜单名硬编码创建受限角色,未显式包含 `system:user:query` 等页面实际依赖的按钮权限,导致普通用户访问 `/system/user` 时连续收到 `403` 并卡住 loading,从而让 `TC0063b``TC0063d` 失败
67+
- [ ] **FB-22**: host-only E2E 在 `act` 容器内执行时,用户新增抽屉和批量编辑弹窗初始化串行请求过多,导致 `TC0226-user-account-labels``TC0228-user-batch-edit``waitForDialogReady` 的 10 秒 busy 等待内长期保持 loading 遮罩,从而让 `E2E tests (host-only)` 继续失败
6768

6869
## Feedback Verification
6970

0 commit comments

Comments
 (0)