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:
parent
ff09775091
commit
1219b46ca3
2 changed files with 9 additions and 6 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue