fix(e2e): replace VITE_MOCK_AUTH with Playwright route mocking

- Removed VITE_MOCK_AUTH=true from playwright.config.ts webServer command
- Added mockAuthRoutes helper to e2e/fixtures.ts to mock /auth/* endpoints
- Updated j1-registration-login.spec.ts to use route mocking instead
  of env var-based mock auth

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Barcode Betty
2026-04-15 10:32:24 +00:00
committed by Barcode Betty
parent ffdc26cce5
commit 00f3c86276
2 changed files with 97 additions and 4 deletions
+3 -3
View File
@@ -1,9 +1,11 @@
import { test, expect } from '@playwright/test';
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 }) => {
mockAuthRoutes(page, true);
await page.goto('/register');
await page.fill('[placeholder="Full Name"]', 'Betty Tester');
await page.fill('[placeholder="Email"]', uniqueEmail());
@@ -30,8 +32,8 @@ test.describe('J1: Registration and Login', () => {
});
test('can sign in with credentials and land on dashboard', async ({ page }) => {
// Register first so we have a real account
const email = uniqueEmail();
mockAuthRoutes(page, true);
await page.goto('/register');
await page.fill('[placeholder="Full Name"]', 'Login Betty');
await page.fill('[placeholder="Email"]', email);
@@ -39,11 +41,9 @@ test.describe('J1: Registration and Login', () => {
await page.click('button[type="submit"]');
await expect(page).toHaveURL('http://localhost:5173/');
// Sign out by clearing the mock session (reload with no session)
await page.goto('/');
await page.reload();
// Now sign in
await page.goto('/login');
await page.fill('[placeholder="Email"]', email);
await page.fill('[placeholder="Password"]', 'TestPass123!');