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.
55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
JavaScript
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')
|
|
})
|
|
})
|