aa81b39600
Add playwright.config.ts with webServer configured to run build and preview on port 4173. Add e2e/smoke.spec.ts with 4 smoke tests: rel=me anchor presence, all identity links in HTML, canvas and HUD visibility, and reduced motion fallback rendering. Restructure App.tsx to render Scroller outside #demo div to fix selector ambiguity in e2e tests. Add test.exclude to vite.config.ts to prevent vitest from running playwright tests.
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
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(
|
|
/<a[^>]*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()
|
|
})
|