Add @playwright/test, axe-core and @axe-core/playwright as devDependencies. - playwright.config.ts with desktop+mobile projects and a webServer that boots astro preview on 127.0.0.1:4321. - tests/e2e/site.spec.ts covers: home renders with H1 and textual map summary; skip-link is the first focusable and jumps to main; filter pills toggle aria-pressed and update the live counter; 404 is noindex; JSON-LD parses and exposes Organization+WebSite+ItemList; robots.txt and sitemap are wired to Astro.site; the 404 is excluded from the sitemap; the generated og-default.png is 1200x630. - Scripts: test:e2e runs the suite, test:e2e:install pulls the chromium headless shell. - .gitignore ignores test-results/, playwright-report/ and the playwright cache. All 16 tests pass (8 desktop, 8 mobile).
28 lines
645 B
TypeScript
28 lines
645 B
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
export default defineConfig({
|
|
testDir: './tests/e2e',
|
|
fullyParallel: true,
|
|
reporter: [['list']],
|
|
use: {
|
|
baseURL: 'http://127.0.0.1:4321',
|
|
trace: 'retain-on-failure',
|
|
},
|
|
webServer: {
|
|
command: 'npm run preview -- --host 127.0.0.1 --port 4321',
|
|
url: 'http://127.0.0.1:4321/',
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 60_000,
|
|
},
|
|
projects: [
|
|
{
|
|
name: 'desktop',
|
|
use: { ...devices['Desktop Chrome'], viewport: { width: 1280, height: 800 } },
|
|
},
|
|
{
|
|
name: 'mobile',
|
|
use: { ...devices['Pixel 5'] },
|
|
},
|
|
],
|
|
});
|