Deploy / deploy-master (push) Skipped
Deploy / deploy-dev (push) Successful in 12s
Deploy / app-quality (push) Successful in 1m8s
Deploy / secret-scan (push) Successful in 4s
Deploy / security-deps (push) Successful in 6s
Deploy / app-image (push) Successful in 1m1s
Deploy / validate-dispatch (push) Successful in 1s
Deploy / scheduled-rebuild-dev (push) Skipped
Deploy / scheduled-rebuild-master (push) Skipped
Deploy / rollback-dev (push) Skipped
Deploy / rollback-master (push) Skipped
Deploy / changes (push) Successful in 3s
Deploy / context (push) Successful in 1s
95 lines
3.4 KiB
JavaScript
95 lines
3.4 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { describe, it } from "node:test";
|
|
|
|
const baseUrl = process.env.E2E_BASE_URL ?? "http://127.0.0.1:3100";
|
|
|
|
async function readPage(pathname) {
|
|
const response = await fetch(`${baseUrl}${pathname}`);
|
|
assert.equal(response.status, 200);
|
|
return response.text();
|
|
}
|
|
|
|
describe("Next.js production server", () => {
|
|
it("renders the homepage with the main hero copy", async () => {
|
|
const html = await readPage("/");
|
|
|
|
assert.match(html, /Moin in Goldebek/);
|
|
assert.match(html, /Nächste Termine/);
|
|
assert.match(html, /href="#goldebek-entdecken"/);
|
|
assert.match(html, /id="goldebek-entdecken"/);
|
|
assert.match(html, />Über Goldebek</);
|
|
});
|
|
|
|
it("server-renders the complete static navigation", async () => {
|
|
const html = await readPage("/leben/");
|
|
const primaryNavigation = html.match(/<nav[^>]*id="primary-navigation"[\s\S]*?<\/nav>/)?.[0];
|
|
|
|
assert.ok(primaryNavigation);
|
|
assert.match(html, />Kulturausschuss</);
|
|
assert.match(html, />Seniorinnen & Senioren</);
|
|
assert.match(html, /href="\/kontakt"/);
|
|
assert.doesNotMatch(primaryNavigation, />Startseite<\/a>/);
|
|
});
|
|
|
|
it("server-renders verified municipal events", async () => {
|
|
const html = await readPage("/termine/");
|
|
|
|
assert.match(html, /70-jähriges Jubiläum/);
|
|
assert.match(html, /Dörpshuus Goldebek/);
|
|
});
|
|
|
|
it("renders the service page without client-side placeholders", async () => {
|
|
const html = await readPage("/service/");
|
|
|
|
assert.match(html, /Gut informiert im Alltag/);
|
|
assert.doesNotMatch(html, /href="#"/);
|
|
});
|
|
|
|
it("redirects the former Ansprechpartner page to Kontakt", async () => {
|
|
const response = await fetch(`${baseUrl}/service/ansprechpartner`, { redirect: "manual" });
|
|
|
|
assert.equal(response.status, 308);
|
|
assert.equal(new URL(response.headers.get("location"), baseUrl).pathname, "/kontakt");
|
|
});
|
|
|
|
it("places Kontakt below Service in the breadcrumb", async () => {
|
|
const html = await readPage("/kontakt/");
|
|
|
|
assert.match(html, /href="\/service">Service<\/a>/);
|
|
assert.match(html, /Kontakt zur Gemeinde/);
|
|
});
|
|
|
|
it("contains basic accessible document landmarks", async () => {
|
|
const html = await readPage("/");
|
|
assert.match(html, /<html lang="de"/);
|
|
assert.match(html, /Zum Inhalt springen/);
|
|
assert.match(html, /<main id="main-content"/);
|
|
assert.doesNotMatch(html, /href="#"/);
|
|
});
|
|
|
|
it("serves the calendar API with cache validation", async () => {
|
|
const response = await fetch(`${baseUrl}/api/events`, { redirect: "manual" });
|
|
assert.equal(response.status, 200);
|
|
const events = await response.json();
|
|
assert.equal(events[0].title, "E2E Beispieltermin");
|
|
assert.match(response.headers.get("cache-control") ?? "", /stale-while-revalidate/);
|
|
const etag = response.headers.get("etag");
|
|
assert.ok(etag);
|
|
|
|
const cached = await fetch(`${baseUrl}/api/events`, {
|
|
headers: { "if-none-match": etag },
|
|
});
|
|
assert.equal(cached.status, 304);
|
|
});
|
|
|
|
it("reports liveness and calendar readiness", async () => {
|
|
const live = await fetch(`${baseUrl}/health/live`);
|
|
assert.equal(live.status, 200);
|
|
assert.deepEqual(await live.json(), { status: "ok" });
|
|
|
|
const ready = await fetch(`${baseUrl}/health/ready`);
|
|
assert.equal(ready.status, 200);
|
|
assert.deepEqual(await ready.json(), { status: "ok", reason: null });
|
|
});
|
|
});
|