From 342b3b47a286b2ec175b26549c276d6ca642aee8 Mon Sep 17 00:00:00 2001 From: Samuel K Date: Fri, 5 Jun 2026 19:59:54 -0500 Subject: [PATCH] fix(desktop): scope wizard e2e template selectors to active tab panel PR #497 moved the Create Workspace source step into bits-ui Tabs (Git/Local/Image). All panels stay mounted, so the Image tab's "Python 3.12" catalog entry collides with the Git tab's "Python" template button, breaking the e2e tests with a strict-mode violation. Scope the lookups to the active tabpanel, which bits-ui marks hidden when inactive. --- desktop/e2e/integration.e2e.ts | 8 ++++++-- desktop/e2e/workspaces.e2e.ts | 11 +++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/desktop/e2e/integration.e2e.ts b/desktop/e2e/integration.e2e.ts index 636914567..3cf98f8c8 100644 --- a/desktop/e2e/integration.e2e.ts +++ b/desktop/e2e/integration.e2e.ts @@ -371,8 +371,12 @@ test.describe await dialog.locator("button", { hasText: "docker" }).first().click() await dialog.getByRole("button", { name: /^continue$/i }).click() - // Step 2 — Source: click Python template - await dialog.locator("button", { hasText: "Python" }).click() + // Step 2 — Source: click Python template (scope to the active Git tab + // panel so it doesn't match the Image tab catalog's "Python 3.12" entry) + await dialog + .getByRole("tabpanel") + .locator("button", { hasText: "Python" }) + .click() const sourceInput = dialog.locator('input[placeholder*="github"]') await expect(sourceInput).toHaveValue( "https://github.com/microsoft/vscode-remote-try-python", diff --git a/desktop/e2e/workspaces.e2e.ts b/desktop/e2e/workspaces.e2e.ts index 32676a22a..3d5f83f36 100644 --- a/desktop/e2e/workspaces.e2e.ts +++ b/desktop/e2e/workspaces.e2e.ts @@ -81,14 +81,17 @@ test.describe.serial("Create Workspace Wizard", () => { dialog.getByRole("heading", { name: /choose a source/i }), ).toBeVisible() - // Quick Start Templates section + 5 core templates + // Quick Start Templates section + 5 core templates. Scope to the active + // tab panel (Git) so the template buttons don't collide with the Image + // tab's catalog entries (e.g. "Python 3.12"), which share language names. await expect(dialog).toContainText("Quick Start Templates") + const gitPanel = dialog.getByRole("tabpanel") for (const lang of ["Python", "Node.js", "Go", "Rust", "Java"]) { - await expect(dialog.locator("button", { hasText: lang })).toBeVisible() + await expect(gitPanel.locator("button", { hasText: lang })).toBeVisible() } // Language icons render - const icons = dialog.locator("button img") + const icons = gitPanel.locator("button img") expect(await icons.count()).toBeGreaterThan(0) const firstIcon = icons.first() await expect(firstIcon).toBeVisible() @@ -100,7 +103,7 @@ test.describe.serial("Create Workspace Wizard", () => { test("should select a template and populate the source field", async () => { const dialog = page.locator('[role="dialog"]').first() - await dialog.locator("button", { hasText: "Python" }).click() + await dialog.getByRole("tabpanel").locator("button", { hasText: "Python" }).click() const sourceInput = dialog.locator('input[placeholder*="github"]') await expect(sourceInput).toHaveValue(