For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Make both exam sprint PDF reports render the report header on every page, format generated time as Beijing local time, and show current page / total pages in the footer.
Architecture: Keep the existing report HTML templates as the source of header content, but teach the Playwright PDF worker to extract that .report-header markup and pass it to Chromium's native displayHeaderFooter templates. Format Instant generatedAt in each renderer with Asia/Shanghai and yyyy-MM-dd HH:mm:ss.
Tech Stack: Java, Playwright Java, Chromium PDF, JUnit 5, AssertJ, PDFBox.
Files:
abilities/exam-sprint/infrastructure/src/test/java/cn/yunzhixue/ability/center/examsprint/infrastructure/report/rendering/achievement/ClasspathAchievementExamSprintReportRendererTest.javaabilities/exam-sprint/infrastructure/src/test/java/cn/yunzhixue/ability/center/examsprint/infrastructure/report/rendering/outlook/ClasspathOutlookExamSprintReportRendererTest.javaabilities/exam-sprint/infrastructure/src/main/java/cn/yunzhixue/ability/center/examsprint/infrastructure/report/rendering/achievement/ClasspathAchievementExamSprintReportRenderer.javaModify: abilities/exam-sprint/infrastructure/src/main/java/cn/yunzhixue/ability/center/examsprint/infrastructure/report/rendering/outlook/ClasspathOutlookExamSprintReportRenderer.java
[ ] Step 1: Write failing renderer tests
Add assertions that rendered HTML contains 2026-05-13 10:08:54 and does not contain 2026-05-13T02:08:54.657335Z for both report renderers.
Run: ./mvnw -pl abilities/exam-sprint/infrastructure -Dtest=ClasspathAchievementExamSprintReportRendererTest,ClasspathOutlookExamSprintReportRendererTest test
Expected: FAIL because current renderer uses Instant.toString().
Use DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.of("Asia/Shanghai")) in both renderers.
Run the same Maven command. Expected: PASS.
Files:
abilities/exam-sprint/infrastructure/src/test/java/cn/yunzhixue/ability/center/examsprint/infrastructure/report/pdf/PlaywrightExamSprintReportPdfGeneratorTest.javaModify: abilities/exam-sprint/infrastructure/src/main/java/cn/yunzhixue/ability/center/examsprint/infrastructure/report/pdf/DefaultPlaywrightPdfWorker.java
[ ] Step 1: Write failing PDF test
Add a multi-page HTML test with .report-header, generate PDF, and assert extracted text contains repeated header text and footer page text such as 1/2 and 2/2 after whitespace normalization.
Run: ./mvnw -pl abilities/exam-sprint/infrastructure -Dtest=PlaywrightExamSprintReportPdfGeneratorTest#generateRepeatsReportHeaderAndFooterPageNumbers test
Expected: FAIL because Playwright header/footer are not configured.
In both page.pdf(...) call sites, call a shared method returning Page.PdfOptions with displayHeaderFooter=true, a header template built from the source .report-header, a footer template with <span class="pageNumber"></span> / <span class="totalPages"></span>, and top/bottom margins that reserve space.
Run the same Maven single-test command. Expected: PASS.
Files:
No production files beyond Task 1 and Task 2.
[ ] Step 1: Run all relevant infrastructure tests
Run: ./mvnw -pl abilities/exam-sprint/infrastructure test
Expected: PASS.
Run: git diff -- abilities/exam-sprint/infrastructure docs/superpowers/plans/2026-05-13-report-playwright-page-header-footer.md
Expected: only intended renderer, PDF worker, tests, and plan changes.