From 8f97048d606e6bbab9ba03c4e959c2daaa0b7448 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sat, 5 Sep 2026 21:46:50 -0700 Subject: [PATCH] fix(tests): complete hidden SSH dialog exits during cleanup (#18993) * test: await nested SSH dialog exit before further dismissal * test: wait for the dismissed SSH dialog identity * test: wait for picker Back to reveal the reused host form * validation: keep hidden E2E compositor frames active * test: extract hidden Electron compositor setup * test: complete hidden dialog exit animations without global throttling changes --- tests/e2e/helpers/ssh-config-host-picker.ts | 37 ++++++++++++++------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/tests/e2e/helpers/ssh-config-host-picker.ts b/tests/e2e/helpers/ssh-config-host-picker.ts index 9b7d7b2d34a..bad31c818d9 100644 --- a/tests/e2e/helpers/ssh-config-host-picker.ts +++ b/tests/e2e/helpers/ssh-config-host-picker.ts @@ -73,23 +73,36 @@ export async function closeSettingsPage(page: Page): Promise { export async function closeOpenDialogs(page: Page): Promise { for (let attempt = 0; attempt < 5; attempt += 1) { + // Nested dialogs can finish their exit animations in different frames. + await expect(page.locator('[role="dialog"][data-state="closed"]')).toHaveCount(0, { + timeout: 3_000 + }) const dialogCount = await page.getByRole('dialog').count() if (dialogCount === 0) { return } - const dialog = page.getByRole('dialog').last() - const cancelOrBack = dialog.getByRole('button', { name: /^(Cancel|Back)$/ }) - await ((await cancelOrBack - .first() - .isVisible() - .catch(() => false)) - ? cancelOrBack.first().click() - : page.keyboard.press('Escape')) - await expect - .poll(async () => page.getByRole('dialog').count(), { timeout: 3_000 }) - .toBeLessThan(dialogCount) - .catch(() => undefined) + const dialogId = await page.getByRole('dialog').last().getAttribute('id') + if (!dialogId) { + throw new Error('Open dialog is missing its Radix identity') + } + const dialog = page.locator(`[role="dialog"][id=${JSON.stringify(dialogId)}]`) + const back = dialog.getByRole('button', { name: 'Back', exact: true }) + if (await back.isVisible()) { + await back.click() + // The picker and host form reuse the same Radix dialog. + await expect(back).toBeHidden({ timeout: 3_000 }) + await expect(dialog.getByRole('button', { name: 'Cancel', exact: true })).toBeVisible({ + timeout: 3_000 + }) + continue + } + const cancel = dialog.getByRole('button', { name: 'Cancel', exact: true }) + await ((await cancel.isVisible()) ? cancel.click() : page.keyboard.press('Escape')) + // Hidden Electron windows can park CSS exits before their first compositor frame. + await page.screenshot({ animations: 'disabled' }) + await expect(dialog).toBeHidden({ timeout: 3_000 }) } + await expect(page.getByRole('dialog')).toHaveCount(0, { timeout: 3_000 }) } /** Leave settings / overlays so the main shell (Add Project) is reachable. */