Fix profile-visibility radio selector in e2e (strict-mode collision)

`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) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-04-25 23:51:19 +02:00
parent ff09775091
commit 1219b46ca3
2 changed files with 9 additions and 6 deletions

View file

@ -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");
}