diff --git a/e2e/smoke.spec.ts b/e2e/smoke.spec.ts new file mode 100644 index 0000000..e96bdc6 --- /dev/null +++ b/e2e/smoke.spec.ts @@ -0,0 +1,30 @@ +import { expect, test } from '@playwright/test' +import { LINKS } from '../src/content/links' + +test('raw HTML contains the rel=me anchor (no JS needed)', async ({ request }) => { + const res = await request.get('/') + const html = await res.text() + expect(html).toMatch( + /]*href="https:\/\/mastodon\.saillant\.cc\/@clement"[^>]*rel="me"/, + ) +}) + +test('raw HTML contains every identity link', async ({ request }) => { + const html = await (await request.get('/')).text() + for (const l of LINKS) expect(html).toContain(`href="${l.href}"`) +}) + +test('the demo boots: canvas mounts and hud shows', async ({ page }) => { + await page.goto('/') + await expect(page.locator('#demo canvas')).toBeVisible() + await expect(page.locator('#tracker')).toBeVisible() +}) + +test('reduced motion serves the readable fallback', async ({ browser }) => { + const ctx = await browser.newContext({ reducedMotion: 'reduce' }) + const page = await ctx.newPage() + await page.goto('/') + await expect(page.locator('#fallback h1')).toBeVisible() + await expect(page.locator('#demo canvas')).toHaveCount(0) + await ctx.close() +}) diff --git a/playwright.config.ts b/playwright.config.ts new file mode 100644 index 0000000..5f806d9 --- /dev/null +++ b/playwright.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from '@playwright/test' + +export default defineConfig({ + testDir: 'e2e', + use: { baseURL: 'http://localhost:4173' }, + webServer: { + command: 'npm run build && npm run preview', + port: 4173, + reuseExistingServer: !process.env.CI, + }, +}) diff --git a/src/App.tsx b/src/App.tsx index b605667..a58a16e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -15,24 +15,26 @@ export default function App() { useRideInput() const player = useMemo(() => createModPlayer(), []) return ( -
- - - - - - - - - - - + <> +
+ + + + + + + + + + + + +
- -
+ ) } diff --git a/vite.config.ts b/vite.config.ts index 9b2cbfe..7b1f9c0 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -47,4 +47,7 @@ export default defineConfig({ // served straight from node_modules, where the relative lookup works. exclude: ['chiptune3'], }, + test: { + exclude: ['node_modules', 'dist', 'e2e'], + }, })