Replace hash URLs with path-based routing, post-build prerender for money pages, Playwright smoke tests, and wrap the app in HelmetProvider so /donate mounts correctly. Co-authored-by: Cursor <[email protected]>
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
|
|
|
test.describe('MIM4U public navigation', () => {
|
|
test('home loads with brand heading', async ({ page }) => {
|
|
await page.goto('/')
|
|
await expect(page.getByRole('navigation', { name: 'Main navigation' })).toBeVisible()
|
|
await expect(page.getByRole('heading', { level: 1 })).toContainText(/Restoring hope/i, { timeout: 20000 })
|
|
})
|
|
|
|
test('path routes work without hash', async ({ page }) => {
|
|
await page.goto('/donate/')
|
|
await expect(page).toHaveURL(/\/donate\/?/)
|
|
await expect(page.getByRole('heading', { level: 1, name: 'Donate' })).toBeVisible({ timeout: 25000 })
|
|
|
|
await page.goto('/request-assistance/')
|
|
await expect(page).toHaveURL(/\/request-assistance\/?/)
|
|
await expect(page.getByRole('heading', { level: 1, name: 'Request Assistance' })).toBeVisible({
|
|
timeout: 25000,
|
|
})
|
|
})
|
|
|
|
test('legacy hash URLs redirect to paths', async ({ page }) => {
|
|
await page.goto('/')
|
|
await page.evaluate(() => {
|
|
window.location.hash = '#/donate'
|
|
window.dispatchEvent(new HashChangeEvent('hashchange'))
|
|
})
|
|
await expect(page).toHaveURL(/\/donate\/?/, { timeout: 15000 })
|
|
})
|
|
|
|
test('api health via nginx proxy', async ({ request }) => {
|
|
const res = await request.get('/api/health')
|
|
expect(res.ok()).toBeTruthy()
|
|
const body = await res.json()
|
|
expect(body.ok).toBe(true)
|
|
})
|
|
})
|