Files
geograsim/.dontDeploy/playwright/tests/stufe1-smoke/routes-static.spec.js
T
Adminator 1e51ef7def Nachtrag: alle bisher untracked Ordner + hängende Änderungen mit-committen
- Konzept/, didaktik_geografie/, didaktik_simulation/, v2-modules/, v2-platform/
- 12 code-workspace-Files
- STATUS-*.md
- viele M/D/R-Änderungen an bereits getrackten Files
- .gitignore verstärkt: **/.humaninput/, **/secret_keys.txt

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-08 02:27:02 +02:00

73 lines
2.7 KiB
JavaScript

// @ts-check
const { test, expect } = require('@playwright/test');
const paths = require('../../fixtures/known-paths.json');
/**
* Stufe 1 · Statische Routes
*
* Prüft pro Top-Level-Route: kommt 200 zurück + rendert die Seite ein <body>?
* Trennt nach Funktionsgruppe (info, glossar, module-info, sim-wrapper)
* damit Fehler-Reports gleich strukturiert lesbar sind.
*/
function allPathsOf(group) {
const out = [];
Object.entries(group).forEach(([k, list]) => list.forEach(p => out.push({ category: k, path: p })));
return out;
}
test.describe('Public Pages', () => {
for (const { category, path } of allPathsOf(paths.public)) {
test(`${category} · /${path}`, async ({ page }) => {
const res = await page.goto(`/${path}`);
expect(res, `Keine Antwort von /${path}`).not.toBeNull();
expect(res.status(), `/${path} antwortet nicht 200`).toBeLessThan(400);
const body = await page.locator('body').count();
expect(body, `body fehlt auf /${path}`).toBeGreaterThan(0);
});
}
});
test.describe('Schüler:innen-/Lehrer:innen-Einstieg', () => {
for (const { category, path } of allPathsOf(paths.schueler_lehrer_einstieg)) {
test(`${category} · /${path}`, async ({ page }) => {
const res = await page.goto(`/${path}`);
expect(res.status()).toBeLessThan(400);
});
}
});
test.describe('Modul-Info-Seiten · aktive Sims', () => {
for (const p of paths.module_info.active) {
test(`existiert · /${p}`, async ({ page }) => {
const res = await page.goto(`/${p}`);
expect(res.status(), `${p} sollte 200 sein`).toBe(200);
// Titel ist Modul-spezifisch — wir prüfen nur dass eine h1/h2 vorhanden ist
const headings = await page.locator('h1, h2').count();
expect(headings).toBeGreaterThan(0);
});
}
});
test.describe('Modul-Info-Seiten · geplante Sims (sollen 404 sein)', () => {
for (const p of paths.module_info.planned_should_404) {
test(`${p} antwortet 404 (geplant)`, async ({ page }) => {
const res = await page.goto(`/${p}`);
// 404 oder eine „kommt bald"-Seite — beides OK, Hauptsache nicht 500
expect(res.status(), `${p} bricht (5xx)`).toBeLessThan(500);
});
}
});
test.describe('Sim-Wrapper · aktive', () => {
for (const p of paths.sims_wrapper.active) {
test(`Sim lädt · /${p}`, async ({ page }) => {
const res = await page.goto(`/${p}`);
expect(res.status(), `${p} antwortet nicht 200`).toBe(200);
// Plattform-Kontext muss injiziert sein
const hasGGS = await page.evaluate(() => typeof window['__GGS__'] === 'object' && window['__GGS__'] !== null);
expect(hasGGS, `__GGS__ fehlt in /${p} — Wrapper-Bug?`).toBe(true);
});
}
});