From a240d86762de135b9b366be1f6c156d1b17e495c Mon Sep 17 00:00:00 2001 From: Thom Lamb Date: Sat, 15 Aug 2026 18:35:43 -0500 Subject: [PATCH] test: disambiguate the Email locator in auth.spec getByLabel('Email') matched two elements on /register -- the email input and the marketing consent checkbox, whose label "Send me occasional emails" contains the substring. Playwright's strict mode failed both tests that filled it. getByRole('textbox', ...) narrows by role, so the checkbox no longer collides. Applied to the /login usage too, so the same concept reads the same way throughout the file. These failures were latent: the frontend-e2e job died at the build step before it ever reached the tests, so CI never reported them. Co-Authored-By: Claude Opus 5 (1M context) --- frontend/tests/e2e/auth.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/tests/e2e/auth.spec.ts b/frontend/tests/e2e/auth.spec.ts index bf1921a..df21618 100755 --- a/frontend/tests/e2e/auth.spec.ts +++ b/frontend/tests/e2e/auth.spec.ts @@ -13,7 +13,7 @@ test.describe('Customer accounts', () => { test('registers a new account and lands on the account page', async ({ page }) => { const email = uniqueEmail(); await page.goto('/register'); - await page.getByLabel('Email').fill(email); + await page.getByRole('textbox', { name: 'Email' }).fill(email); await page.getByLabel('Password').fill('supersecret123'); await page.getByRole('button', { name: 'Create account' }).click(); await expect(page).toHaveURL(/\/account/); @@ -23,14 +23,14 @@ test.describe('Customer accounts', () => { test('rejects login with the wrong password', async ({ page }) => { const email = uniqueEmail(); await page.goto('/register'); - await page.getByLabel('Email').fill(email); + await page.getByRole('textbox', { name: 'Email' }).fill(email); await page.getByLabel('Password').fill('supersecret123'); await page.getByRole('button', { name: 'Create account' }).click(); await expect(page).toHaveURL(/\/account/); await page.getByRole('button', { name: 'Log out' }).click(); await page.goto('/login'); - await page.getByLabel('Email').fill(email); + await page.getByRole('textbox', { name: 'Email' }).fill(email); await page.getByLabel('Password').fill('wrong-password'); await page.getByRole('button', { name: 'Log in' }).click(); await expect(page.getByText('invalid email or password')).toBeVisible();