From c953fabc6b6aa0e4ddfec045bdca0664a32c35ba Mon Sep 17 00:00:00 2001 From: Barcode Betty Date: Wed, 15 Apr 2026 21:39:47 +0000 Subject: [PATCH] fix(e2e): correct j1 registration assertions to match dev Register.tsx flow - Registration test: assert 'Check your email' heading (dev shows email verification screen after signUp, no session established) - Sign-in test: use mock routes directly without registration step; dev Login.tsx calls getSession() which the mock provides Co-Authored-By: Paperclip --- e2e/journeys/j1-registration-login.spec.ts | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/e2e/journeys/j1-registration-login.spec.ts b/e2e/journeys/j1-registration-login.spec.ts index 3444e4d..a811cc8 100644 --- a/e2e/journeys/j1-registration-login.spec.ts +++ b/e2e/journeys/j1-registration-login.spec.ts @@ -4,16 +4,15 @@ import { mockAuthRoutes } from '../fixtures'; const uniqueEmail = () => `betty+e2e-${Date.now()}@cartsnitch.test`; test.describe('J1: Registration and Login', () => { - test('can register a new account and lands on dashboard', async ({ page }) => { - await mockAuthRoutes(page, true); + test('can register a new account and see check your email screen', async ({ page }) => { + await mockAuthRoutes(page, false); await page.goto('/register'); await page.fill('[placeholder="Full Name"]', 'Betty Tester'); await page.fill('[placeholder="Email"]', uniqueEmail()); await page.fill('[placeholder="Password (min. 8 characters)"]', 'TestPass123!'); await page.click('button[type="submit"]'); - await expect(page).toHaveURL('http://localhost:5173/'); - await expect(page.getByRole('heading', { name: /cart/i })).toBeVisible(); + await expect(page.getByRole('heading', { name: /check your email/i })).toBeVisible(); }); test('shows validation error when registration fields are empty', async ({ page }) => { @@ -32,20 +31,9 @@ test.describe('J1: Registration and Login', () => { }); test('can sign in with credentials and land on dashboard', async ({ page }) => { - const email = uniqueEmail(); await mockAuthRoutes(page, true); - await page.goto('/register'); - await page.fill('[placeholder="Full Name"]', 'Login Betty'); - await page.fill('[placeholder="Email"]', email); - await page.fill('[placeholder="Password (min. 8 characters)"]', 'TestPass123!'); - await page.click('button[type="submit"]'); - await expect(page).toHaveURL('http://localhost:5173/'); - - await page.goto('/'); - await page.reload(); - await page.goto('/login'); - await page.fill('[placeholder="Email"]', email); + await page.fill('[placeholder="Email"]', 'test@cartsnitch.test'); await page.fill('[placeholder="Password"]', 'TestPass123!'); await page.click('button[type="submit"]');