67c2d27e74
* ci: add frontend-only CI workflow * docs: update CLAUDE.md for standalone frontend repo * fix(register): replace check-your-email success state with inline message (#2) * fix(register): replace check-your-email success state with inline message Ports PR #181 intent from cartsnitch/cartsnitch to cartsnitch/app. Removes registrationComplete, resendLoading, resendMessage state and the handleResendVerification function. After successful signUp.email, now sets setError('Account created! Please sign in.') instead of showing the separate "Check your email" page. Refs: CAR-822, CAR-818 * fix(e2e): update registration test to match new inline success message Renames 'can register a new account and see check your email screen' to 'shows success message after registration' and asserts .bg-red-50 contains 'Account created! Please sign in.' instead of checking for a heading. Updates 'can sign in with credentials' test to first register a fresh account and assert the success message, then proceed with login. Refs: CAR-822, PR cartsnitch/cartsnitch#181 --------- Co-authored-by: Chris Farhood <chris@farhood.org> --------- Co-authored-by: Test User <test@example.com> Co-authored-by: savannah-savings-cto[bot] <269715008+savannah-savings-cto[bot]@users.noreply.github.com> Co-authored-by: cartsnitch-engineer[bot] <269717931+cartsnitch-engineer[bot]@users.noreply.github.com> Co-authored-by: Chris Farhood <chris@farhood.org>
53 lines
2.1 KiB
TypeScript
53 lines
2.1 KiB
TypeScript
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('shows success message after registration', 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.locator('.bg-red-50')).toContainText('Account created! Please sign in.');
|
|
});
|
|
|
|
test('shows validation error when registration fields are empty', async ({ page }) => {
|
|
await page.goto('/register');
|
|
await page.click('button[type="submit"]');
|
|
|
|
await expect(page.locator('.bg-red-50')).toContainText('Please fill in all fields');
|
|
});
|
|
|
|
test('can navigate from register to login', async ({ page }) => {
|
|
await page.goto('/register');
|
|
await page.getByRole('link', { name: /sign in/i }).click();
|
|
|
|
await expect(page).toHaveURL(/\/login/);
|
|
await expect(page.getByRole('heading', { name: /cartsnitch/i })).toBeVisible();
|
|
});
|
|
|
|
test('can sign in with credentials and land on dashboard', async ({ page }) => {
|
|
await mockAuthRoutes(page, false);
|
|
const email = uniqueEmail();
|
|
await page.goto('/register');
|
|
await page.fill('[placeholder="Full Name"]', 'Betty Tester');
|
|
await page.fill('[placeholder="Email"]', email);
|
|
await page.fill('[placeholder="Password (min. 8 characters)"]', 'TestPass123!');
|
|
await page.click('button[type="submit"]');
|
|
await expect(page.locator('.bg-red-50')).toContainText('Account created! Please sign in.');
|
|
|
|
await mockAuthRoutes(page, true);
|
|
await page.goto('/login');
|
|
await page.fill('[placeholder="Email"]', email);
|
|
await page.fill('[placeholder="Password"]', 'TestPass123!');
|
|
await page.click('button[type="submit"]');
|
|
|
|
await expect(page).toHaveURL('http://localhost:5173/');
|
|
});
|
|
|
|
});
|