chore: sync all local changes and new files
- Update next.config.ts - Add netlify.toml, Docker configs, e2e tests - Add env templates, docs (README, ROADMAP, TODO) - Add vitest/playwright test configs - Add component and lib tests - Add install script, portainer env template - Update .gitignore (tsbuildinfo, deno.lock, dev.db)
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
test.describe('Authentication Flow', () => {
|
||||
test('should handle login, registration, and logout', async ({ page }) => {
|
||||
// Visit site → home page loads → see navbar
|
||||
await page.goto('/');
|
||||
await expect(page.locator('nav')).toBeVisible();
|
||||
|
||||
// Click Login → see login form
|
||||
await page.click('text=Login');
|
||||
await expect(page.locator('form')).toBeVisible();
|
||||
|
||||
// Try invalid login → see error message
|
||||
await page.fill('input[type="email"]', 'invalid@example.com');
|
||||
await page.fill('input[type="password"]', 'wrongpassword');
|
||||
await page.click('button[type="submit"]');
|
||||
await expect(page.locator('text=Invalid credentials')).toBeVisible();
|
||||
|
||||
// Navigate to registration (assuming a link exists on login page)
|
||||
await page.click('text=Register');
|
||||
|
||||
// Fill registration form → submit → redirect to home
|
||||
await page.fill('input[name="name"]', 'Test User');
|
||||
await page.fill('input[name="email"]', 'newuser@example.com');
|
||||
await page.fill('input[name="password"]', 'securepassword123');
|
||||
await page.click('button[type="submit"]');
|
||||
|
||||
// Check redirect and authentication state
|
||||
await expect(page).toHaveURL('/');
|
||||
// See user menu or similar in navbar when authenticated
|
||||
await expect(page.locator('nav')).toContainText('Logout');
|
||||
|
||||
// Click logout → redirect to home → see login button
|
||||
await page.click('text=Logout');
|
||||
await expect(page).toHaveURL('/');
|
||||
await expect(page.locator('text=Login')).toBeVisible();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user