# Report Playwright Page Header Footer Implementation Plan > **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. --- ### Task 1: Renderer Generated Time Format **Files:** - Modify: `abilities/exam-sprint/infrastructure/src/test/java/cn/yunzhixue/ability/center/examsprint/infrastructure/report/rendering/achievement/ClasspathAchievementExamSprintReportRendererTest.java` - Modify: `abilities/exam-sprint/infrastructure/src/test/java/cn/yunzhixue/ability/center/examsprint/infrastructure/report/rendering/outlook/ClasspathOutlookExamSprintReportRendererTest.java` - Modify: `abilities/exam-sprint/infrastructure/src/main/java/cn/yunzhixue/ability/center/examsprint/infrastructure/report/rendering/achievement/ClasspathAchievementExamSprintReportRenderer.java` - Modify: `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. - [ ] **Step 2: Run renderer tests to verify RED** Run: `./mvnw -pl abilities/exam-sprint/infrastructure -Dtest=ClasspathAchievementExamSprintReportRendererTest,ClasspathOutlookExamSprintReportRendererTest test` Expected: FAIL because current renderer uses `Instant.toString()`. - [ ] **Step 3: Implement Beijing time formatter** Use `DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.of("Asia/Shanghai"))` in both renderers. - [ ] **Step 4: Run renderer tests to verify GREEN** Run the same Maven command. Expected: PASS. ### Task 2: Playwright Native Header and Footer **Files:** - Modify: `abilities/exam-sprint/infrastructure/src/test/java/cn/yunzhixue/ability/center/examsprint/infrastructure/report/pdf/PlaywrightExamSprintReportPdfGeneratorTest.java` - Modify: `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. - [ ] **Step 2: Run PDF test to verify RED** Run: `./mvnw -pl abilities/exam-sprint/infrastructure -Dtest=PlaywrightExamSprintReportPdfGeneratorTest#generateRepeatsReportHeaderAndFooterPageNumbers test` Expected: FAIL because Playwright header/footer are not configured. - [ ] **Step 3: Implement PDF options** 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 ` / `, and top/bottom margins that reserve space. - [ ] **Step 4: Run PDF test to verify GREEN** Run the same Maven single-test command. Expected: PASS. ### Task 3: Full Relevant Verification **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. - [ ] **Step 2: Review diff** 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.