From 4f755d55deabdf99efae50cd5db91e0f528fac2a Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sat, 21 Nov 2026 04:26:44 +0800 Subject: [PATCH] test(e2e): wait for the Run window to take focus before toggling it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tool-window shortcut hides a window only once it is active, and activation focuses it on the next frame. Under load the test pressed ⌘4 or Shift+Escape before that, so the window stayed open. --- e2e/toolwindows.spec.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/e2e/toolwindows.spec.ts b/e2e/toolwindows.spec.ts index 76cdf27f8..374d9c898 100644 --- a/e2e/toolwindows.spec.ts +++ b/e2e/toolwindows.spec.ts @@ -71,12 +71,17 @@ test("⌘1 focuses, hides and re-shows the Project tool window", async ({ workbe test("⌘4 toggles Run; Shift+Escape hides the active tool window", async ({ workbench: page }) => { const run = page.getByRole("region", { name: "Run" }); + // The shortcut hides the window only once it is active: activation focuses it a frame after it shows. + const focusedInRun = () => + expect.poll(() => page.evaluate(() => !!document.activeElement?.closest('[data-toolwindow="run"]'))).toBe(true); await page.keyboard.press("Meta+4"); await expect(run).toBeVisible(); + await focusedInRun(); await page.keyboard.press("Meta+4"); await expect(run).toBeHidden(); await page.keyboard.press("Meta+4"); await expect(run).toBeVisible(); + await focusedInRun(); await page.keyboard.press("Shift+Escape"); await expect(run).toBeHidden(); });