From 1219b46ca3bc58e1b85123c7025c4075de743a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Sat, 25 Apr 2026 23:51:19 +0200 Subject: [PATCH] Fix profile-visibility radio selector in e2e (strict-mode collision) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `getByLabel('Public')` matched both radios because the Private radio's help-text label contains the substring "public" ("…followers see your public content."). Switch to targeting the input directly by name+value, which is unambiguous regardless of help-text wording. Co-Authored-By: Claude Opus 4.7 (1M context) --- e2e/public-content.test.ts | 6 +++++- e2e/social.test.ts | 9 ++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/e2e/public-content.test.ts b/e2e/public-content.test.ts index 50288b7..5fd2243 100644 --- a/e2e/public-content.test.ts +++ b/e2e/public-content.test.ts @@ -50,9 +50,13 @@ async function setRouteVisibility( // New users default to profile_visibility='private' (locked-account // model). Tests that need an anon visitor to see the profile in full // have to flip the owner to public first. +// +// The radio is targeted by name+value rather than getByLabel because +// the Private radio's help-text label happens to contain the word +// "public", which trips Playwright's strict-mode match. async function setProfileVisibilityPublic(page: Page) { await page.goto("/settings"); - await page.getByLabel("Public").check(); + await page.locator('input[type=radio][name=profileVisibility][value=public]').check(); await page.getByRole("button", { name: /^Save$/ }).first().click(); await page.waitForLoadState("networkidle"); } diff --git a/e2e/social.test.ts b/e2e/social.test.ts index 522c6be..dd0ca1b 100644 --- a/e2e/social.test.ts +++ b/e2e/social.test.ts @@ -28,11 +28,10 @@ async function registerUser(page: Page, email: string, username: string) { async function setProfileVisibility(page: Page, value: "public" | "private") { await page.goto("/settings"); - if (value === "public") { - await page.getByLabel("Public").check(); - } else { - await page.getByLabel(/Private/).check(); - } + // Target the radio by name+value; getByLabel collides because the + // help text of one radio mentions the other's word ("public" appears + // in the Private radio's helper sentence). + await page.locator(`input[type=radio][name=profileVisibility][value=${value}]`).check(); await page.getByRole("button", { name: /^Save$/ }).first().click(); await page.waitForLoadState("networkidle"); }