test(pagination): e2e coverage for continuous-overlay dogfood fixes - #423
test(pagination): e2e coverage for continuous-overlay dogfood fixes#423arthrod wants to merge 2 commits into
Conversation
Adds the repo's first Playwright spec (tooling/e2e/pagination.spec.ts), locking in the user-visible behavior from the 2026-05-23 dogfood pass that the margin-aware-packing fix resolved but that has no automated coverage: - ISSUE-001: every break sits on/above the true 931px A4 boundary (no downward drift); per-page gaps stay ~one page tall and don't accumulate. - ISSUE-002: advisory break lines actually render on load. - ISSUE-003: a "Page 1 of N" marker plus "Page K of N" labels with a real total, numbered 2..N in document order. - ISSUE-004: at a 600px viewport every label box stays within [0, 600] (left-gutter placement), so page numbers never scroll off-screen. Plus two hand-verified invariants: the overlay keeps pointer-events:none (native editing untouched) and the load+resize recompute logs no console errors. Lives in tooling/e2e/ (pnpm e2e), outside the bun fast/slow lanes. Verified 6/6 on Chromium against apps/www /dev/pagination2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…n notes - dogfood-output/report.md: add Resolution blocks (ISSUE-001/003/004 fixed, 002 improved) referencing fix e7be784 + the new e2e coverage; report had captured only the pre-fix state. - include dogfood screenshots/videos the report references. - carry forward untracked docs/plans/2026-05-22-pagination-*.md (in-flight planning notes) so they are not orphaned. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@coderabbitai review very carefully and fix |
|
@Kilo review very carefully and fix |
|
@gemini review very carefully and fix |
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive documentation and implementation plans for a new pagination system, including exploratory research, architectural proposals, and detailed phased plans for both page-box line projection and a two-mode editing strategy. It also adds E2E tests to verify the behavior of the pagination overlay. Feedback focuses on resolving a placeholder file in the documentation and improving the robustness and idiomatic style of the E2E tests, specifically recommending the use of Playwright's boundingBox() for coordinate retrieval and all() for more readable locator iteration.
| @@ -0,0 +1 @@ | |||
| PLACEHOLDER | |||
| const topOf = (handle: { | ||
| evaluate: <R>(fn: (el: SVGElement | HTMLElement) => R) => Promise<R>; | ||
| }) => handle.evaluate((el) => Number.parseFloat((el as HTMLElement).style.top)); |
There was a problem hiding this comment.
The topOf helper function relies on parsing the inline style.top property, which is fragile if the styling method changes (e.g., moved to CSS classes or calculated differently). Consider using Playwright's boundingBox() method to retrieve the element's position, which is more robust for E2E testing as it reflects the actual rendered position. Note: This requires importing Locator from @playwright/test.
| const topOf = (handle: { | |
| evaluate: <R>(fn: (el: SVGElement | HTMLElement) => R) => Promise<R>; | |
| }) => handle.evaluate((el) => Number.parseFloat((el as HTMLElement).style.top)); | |
| const topOf = async (locator: any) => { | |
| const box = await locator.boundingBox(); | |
| return box?.y ?? 0; | |
| }; |
| for (let i = 0; i < count; i++) { | ||
| const box = await labels.nth(i).boundingBox(); | ||
| expect(box).not.toBeNull(); | ||
| // Whole chip within the 600px viewport (left-gutter placement), so the | ||
| // user never has to scroll horizontally to read a page number. | ||
| expect(box!.x).toBeGreaterThanOrEqual(0); | ||
| expect(box!.x + box!.width).toBeLessThanOrEqual(600); | ||
| } |
There was a problem hiding this comment.
Iterating over locators using a loop with nth(i) is less idiomatic in Playwright. Using labels.all() with a for...of loop is generally preferred for better readability and to avoid multiple count() and nth() calls.
| for (let i = 0; i < count; i++) { | |
| const box = await labels.nth(i).boundingBox(); | |
| expect(box).not.toBeNull(); | |
| // Whole chip within the 600px viewport (left-gutter placement), so the | |
| // user never has to scroll horizontally to read a page number. | |
| expect(box!.x).toBeGreaterThanOrEqual(0); | |
| expect(box!.x + box!.width).toBeLessThanOrEqual(600); | |
| } | |
| for (const label of await labels.all()) { | |
| const box = await label.boundingBox(); | |
| expect(box).not.toBeNull(); | |
| // Whole chip within the 600px viewport (left-gutter placement), so the | |
| // user never has to scroll horizontally to read a page number. | |
| expect(box!.x).toBeGreaterThanOrEqual(0); | |
| expect(box!.x + box!.width).toBeLessThanOrEqual(600); | |
| } |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainLet me gather the PR contents to review carefully. 🏁 Script executed: Length of output: 53737 Let me check for the Playwright config and related tooling files. 🏁 Script executed: Length of output: 2897 🏁 Script executed: Length of output: 4645
Review:
|
| # | Severity | File | Issue |
|---|---|---|---|
| 1 | 🔴 Bug | tooling/e2e/pagination.spec.ts:126–130 |
box! non-null assertion needs proper narrowing |
| 2 | 🔴 CI risk | tooling/config/playwright.config.ts + spec |
Unverified firefox/webkit browsers in config |
| 3 | 🟡 Type | tooling/e2e/pagination.spec.ts:44–47 |
Use Locator type instead of ad-hoc structural type |
| 4 | 🟡 Fragile | tooling/e2e/pagination.spec.ts:35 |
Hard-coded geometry constant not linked to plugin source |
| 5 | 🟡 Redundancy | tooling/e2e/pagination.spec.ts:61 |
Duplicate assertion in ISSUE-002 test |
| 6 | 🟡 Asset | dogfood-output/screenshots/issue-A-step1.png |
Duplicate of initial.png |
| 7 | 🟠 Missing | dogfood-output/report.md |
Mentioned in PR body but not committed |
| 8 | 🟠 Cleanup | docs/plans/2026-05-22-pagination-unified-plan.md |
Single-line PLACEHOLDER should be removed |
Proposed fixes
- Fix
box!→ proper null guard in ISSUE-004 - Add browser-skip guard for firefox/webkit
- Fix
topOfto useLocatortype - Fix ISSUE-002 redundant assertion
The requested changes have been implemented and a pull request has been created: View PR
Stacked on
codex/pagination-dogfood-fixes. Adds the repo's first Playwright e2e spec, locking in the user-visible behavior from the 2026-05-23 dogfood pass thate7be784(margin-aware packing + overlay polish) fixed but that had no automated coverage.Tests —
tooling/e2e/pagination.spec.ts(6, Chromium-verified 6/6)≤ pageIndex×931 + 30px; per-page gap in[931−250, 931+30]Page 1 of Nmarker +Page K of Nlabels2..Nin order[0, 600]pointer-events: none; editable still liveLives in
tooling/e2e/(run viapnpm e2e), outside the bun fast/slow lanes, so the inner loop stays fast.Docs
dogfood-output/report.md: Resolution blocks added (001/003/004 fixed, 002 improved604ms→308ms) + screenshots; previously captured only the pre-fix state.docs/plans/2026-05-22-pagination-*.mdso they aren't orphaned.Verification
apps/www/dev/pagination2.tooling/e2e/by config.pnpm check(test:all+test:slowestacross the whole monorepo) was not run — disproportionate for a Playwright-only change that touches no package graph or bun test glob; lint is the relevant gate and passes.🤖 Generated with Claude Code