From 1fbde697129fd1f793088efeb7ba76a9238d4f4f Mon Sep 17 00:00:00 2001 From: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com> Date: Mon, 6 Jul 2026 18:29:07 -0400 Subject: [PATCH] fix(win-update-e2e): dismiss Got-it feature-tip modal before typing; restore createTerminalTab import --- tools/win-update-e2e/app-driver.mjs | 46 +++++++++++++++++++++-------- tools/win-update-e2e/run.mjs | 1 + 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/tools/win-update-e2e/app-driver.mjs b/tools/win-update-e2e/app-driver.mjs index 3753846a1..6ed85d33f 100644 --- a/tools/win-update-e2e/app-driver.mjs +++ b/tools/win-update-e2e/app-driver.mjs @@ -183,26 +183,40 @@ async function createWorkspaceFromSeededRepo(page, timeoutMs) { } } +const OVERLAY_DISMISS_LABELS = ['Got it', 'Dismiss setup scripts', 'Dismiss tip', 'Dismiss update'] + /** - * Best-effort dismissal of the post-worktree-creation overlays (setup-script - * prompt, feature tips, update banner) that can intercept pointer/focus events - * over the terminal. Never throws. + * Best-effort dismissal of the modals/banners that appear after creating a + * worktree (a full-screen "Got it" feature-tip modal, the setup-script prompt, + * update banner) and intercept all input over the terminal. Loops because tips + * can appear in sequence. Never throws. */ -export async function dismissOverlays(page) { - const labels = ['Dismiss setup scripts', 'Dismiss tip', 'Dismiss update'] - for (const name of labels) { - await page - .getByRole('button', { name }) - .first() - .click({ timeout: 3_000 }) - .catch(() => {}) +export async function dismissOverlays(page, rounds = 3) { + for (let i = 0; i < rounds; i++) { + let acted = false + for (const name of OVERLAY_DISMISS_LABELS) { + const btn = page.getByRole('button', { name }).first() + if (await btn.isVisible().catch(() => false)) { + await btn.click({ timeout: 3_000 }).catch(() => {}) + acted = true + } + } + await page.keyboard.press('Escape').catch(() => {}) + if (!acted) { + return + } + await page.waitForTimeout(400) } } /** Create a new terminal tab via the New tab menu. Returns the count after. */ export async function createTerminalTab(page) { + await dismissOverlays(page, 1) const before = await page.locator(SORTABLE_TAB).count() - await page.getByRole(NEW_TAB_BUTTON.role, { name: NEW_TAB_BUTTON.name }).click({ force: true }) + await page + .getByRole(NEW_TAB_BUTTON.role, { name: NEW_TAB_BUTTON.name }) + .first() + .click({ force: true }) await page.getByRole('menuitem', { name: NEW_TERMINAL_ITEM }).first().click({ force: true }) await page.waitForFunction( ({ selector, prev }) => document.querySelectorAll(selector).length > prev, @@ -229,6 +243,14 @@ export async function listTabIds(page) { * dropped. Click the pane, then focus the helper textarea as a belt-and-braces. */ export async function focusActiveTerminal(page) { + // A feature-tip modal can appear late and swallow keystrokes; clear any before + // focusing so typed commands actually reach the shell. + for (const name of OVERLAY_DISMISS_LABELS) { + const btn = page.getByRole('button', { name }).first() + if (await btn.isVisible().catch(() => false)) { + await btn.click({ timeout: 2_000 }).catch(() => {}) + } + } const surface = page.locator(TERMINAL_SURFACE_VISIBLE).first() await surface.click({ position: { x: 24, y: 24 }, timeout: 15_000 }).catch(() => {}) const input = page.locator(XTERM_INPUT).last() diff --git a/tools/win-update-e2e/run.mjs b/tools/win-update-e2e/run.mjs index 45b2b96bb..40fd6b50c 100644 --- a/tools/win-update-e2e/run.mjs +++ b/tools/win-update-e2e/run.mjs @@ -18,6 +18,7 @@ import { launchInstalledApp, ensureTerminal, dismissOverlays, + createTerminalTab, listTabIds, startMarker, readTerminalTextBestEffort,