feat: add testing infrastructure — Vitest, Playwright, CI, git hooks
Add comprehensive testing covering 420 unit/handler tests across 24 Vitest files, 9 Playwright E2E specs, accessibility scans, and visual regression. Includes GitHub Actions CI, Husky pre-push hook, and TESTING.md docs.
This commit is contained in:
parent
036af95e00
commit
1e30ba23cd
35 changed files with 3637 additions and 5 deletions
55
e2e/admin-events.spec.js
Normal file
55
e2e/admin-events.spec.js
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
import { test, expect } from './helpers/fixtures.js'
|
||||
|
||||
test.describe('Admin events list', () => {
|
||||
test('events list loads for admin', async ({ adminPage }) => {
|
||||
await adminPage.goto('/admin/events')
|
||||
|
||||
await expect(adminPage.locator('h1')).toContainText('Events')
|
||||
})
|
||||
|
||||
test('create event button present', async ({ adminPage }) => {
|
||||
await adminPage.goto('/admin/events')
|
||||
|
||||
await expect(
|
||||
adminPage.getByRole('link', { name: 'Create Event' })
|
||||
).toBeVisible()
|
||||
})
|
||||
})
|
||||
|
||||
test.describe('Admin events create', () => {
|
||||
test('create event page loads', async ({ adminPage }) => {
|
||||
await adminPage.goto('/admin/events/create')
|
||||
|
||||
await expect(adminPage.locator('h1')).toContainText('Create Event')
|
||||
})
|
||||
|
||||
test('create event form has required fields', async ({ adminPage }) => {
|
||||
await adminPage.goto('/admin/events/create')
|
||||
|
||||
// Title input
|
||||
await expect(
|
||||
adminPage.getByPlaceholder('Enter a clear, descriptive event title')
|
||||
).toBeVisible()
|
||||
|
||||
// Description textarea
|
||||
await expect(
|
||||
adminPage.getByPlaceholder(
|
||||
'Provide a clear description of what attendees can expect from this event'
|
||||
)
|
||||
).toBeVisible()
|
||||
|
||||
// Event type select (USelect renders a button with the selected value)
|
||||
await expect(adminPage.getByText('Event Type')).toBeVisible()
|
||||
})
|
||||
})
|
||||
|
||||
test.describe('Admin events access control', () => {
|
||||
test('non-admin redirect', async ({ page }) => {
|
||||
await page.goto('/admin/events')
|
||||
|
||||
// Admin middleware redirects unauthenticated users to /
|
||||
await page.waitForURL((url) => !url.pathname.startsWith('/admin'))
|
||||
|
||||
expect(page.url()).not.toContain('/admin/events')
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue