feat: add Playwright E2E test config and basic tests

Adds playwright.config.ts pointing at tests/e2e/ with a 15s timeout and dev server reuse. Stubs two test files: public-pages (home, pets, login load checks) and admin-guard (unauthenticated /admin and /foster redirect to /login). Installs @playwright/test as a dev dependency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-26 12:49:46 -05:00
co-authored by Claude Sonnet 4.6
parent b0bd8277a8
commit c129eecb15
3 changed files with 41 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
import { defineConfig } from '@playwright/test';
export default defineConfig({
testDir: 'tests/e2e',
timeout: 15000,
webServer: {
command: 'npm run dev',
port: 5173,
reuseExistingServer: true
},
use: {
baseURL: 'http://localhost:5173'
}
});
+11
View File
@@ -0,0 +1,11 @@
import { test, expect } from '@playwright/test';
test('admin redirects to login when not authenticated', async ({ page }) => {
await page.goto('/admin');
await expect(page).toHaveURL(/\/login/);
});
test('foster redirects to login when not authenticated', async ({ page }) => {
await page.goto('/foster');
await expect(page).toHaveURL(/\/login/);
});
+16
View File
@@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test';
test('home page loads', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveTitle(/./);
});
test('pets page loads', async ({ page }) => {
await page.goto('/pets');
await expect(page.locator('h1')).toBeVisible();
});
test('login page loads', async ({ page }) => {
await page.goto('/login');
await expect(page.locator('form')).toBeVisible();
});