Skip to content

Added e2e runtime acceptance gate for console errors and pageerrors#29142

Draft
9larsons wants to merge 1 commit into
mainfrom
steve/pla-96-e-console-error-gate
Draft

Added e2e runtime acceptance gate for console errors and pageerrors#29142
9larsons wants to merge 1 commit into
mainfrom
steve/pla-96-e-console-error-gate

Conversation

@9larsons

@9larsons 9larsons commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

ref https://linear.app/tryghost/issue/PLA-96

Problem

The build-mode e2e suite (CI job_e2e_tests) boots the real production admin bundle in Docker, but no test fails on console.error / uncaught pageerror. A view can throw at runtime while a navigation-only test stays green — exactly the class of bug that build-success + unit tests miss, and that a real bug slipped through. The stats dashboard and admin-x-activitypub had thin/no real-build coverage.

This gate is bundler-agnostic (part of the Rolldown migration workstream but valuable independent of it), so it targets main.

What this adds

  1. Console-error / pageerror collector fixturee2e/helpers/playwright/console-errors.ts extends the Ghost base fixture with a runtimeErrors collector wired to the authenticated page. Captures pageerror + console.error (React error boundaries log via console.error, so boundary-swallowed throws are still caught). Small, explicit, commented allowlist for known-benign third-party noise. Failing tests print the captured errors with stacks.

  2. Smoke project/spece2e/tests/admin/smoke/admin-views-smoke.test.ts. For each major admin view it navigates, waits for a key content locator (reusing existing Page Objects), and asserts (i) content rendered and (ii) zero non-allowlisted console errors / pageerrors. Covered: posts list, editor, tags, members (seeded), comments, settings (general + staff), activitypub, and the Tinybird-gated analytics overview + web/stats dashboard.

  3. Wiring — new smoke Playwright project (excluded from main so existing shards are unchanged); runs in the analytics CI lane (projects: analytics,smoke) so Tinybird is present for the stats/analytics views. Those views test.skip() gracefully when GHOST_E2E_ANALYTICS !== 'true'.

  4. Missing page object — authored ActivityPubPage (e2e/helpers/pages/admin/activitypub/); the stats/analytics views reuse the existing analytics page objects.

Negative control

A skipped, annotated negative control test documents exactly how reintroducing a broken component makes the gate go red: break a view the suite renders (e.g. throw in the stats Overview render), rebuild the e2e image, run the smoke project — the shell may still mount, but the broken view emits a pageerror / React console.error, runtimeErrors becomes non-empty, and toHaveLength(0) fails with the captured stack. Revert → green.

Verification

Full smoke run against the live admin bundle requires the CI-only ghost-e2e:local image, so it's proven out in CI (draft). Locally, the novel collector logic was driven against a real Chromium page: a real uncaught pageerror is captured with its stack, a real console.error is captured, the allowlist drops third-party noise while keeping real crashes, and console.warn/console.log are ignored. Lint + types are clean.

ref https://linear.app/tryghost/issue/PLA-96

- the build-mode e2e suite boots the real production admin bundle, but no test
  fails on console.error / uncaught pageerror, so a view can throw at runtime
  while a navigation-only test stays green - exactly the class of bug that
  build-success and unit tests miss (and that a real bug slipped through)
- adds a console-error/pageerror collector fixture (extends the Ghost fixture)
  with a small, explicit, commented allowlist for known-benign third-party noise
- adds a smoke project/spec that navigates each major admin view (posts, editor,
  tags, members, comments, settings sections, activitypub, and the Tinybird-gated
  analytics overview + web/stats dashboard), waits for a key content locator, and
  asserts zero non-allowlisted runtime errors
- authors the missing activitypub page object; the stats/analytics views reuse
  the existing analytics page objects
- wires the smoke project into the analytics CI lane so Tinybird is present for
  the stats/analytics views; analytics views skip gracefully without it
- bundler-agnostic and valuable independent of the Rolldown migration, so it
  targets main
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 852e0ffb-b642-4b09-81ee-5607a7559c9f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch steve/pla-96-e-console-error-gate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit ae7d28b

Command Status Duration Result
nx run @tryghost/admin-x-settings:test:acceptance ✅ Succeeded 9m 58s View ↗
nx run ghost:test:ci:integration ✅ Succeeded 4s View ↗
nx run ghost:test:integration ✅ Succeeded 2m 45s View ↗
nx run ghost:test:legacy ✅ Succeeded 2m 54s View ↗
nx run ghost:test:e2e ✅ Succeeded 2m 24s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded 1s View ↗
nx run @tryghost/activitypub:test:acceptance ✅ Succeeded 46s View ↗
nx run @tryghost/comments-ui:test:acceptance ✅ Succeeded 43s View ↗
Additional runs (7) ✅ Succeeded ... View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-06 20:23:28 UTC

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.26%. Comparing base (1f42ca3) to head (ae7d28b).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #29142      +/-   ##
==========================================
- Coverage   74.29%   74.26%   -0.03%     
==========================================
  Files        1565     1565              
  Lines      135738   135738              
  Branches    16459    16452       -7     
==========================================
- Hits       100845   100805      -40     
- Misses      33864    33904      +40     
  Partials     1029     1029              
Flag Coverage Δ
e2e-tests 76.41% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

E2E Tests Failed

To view the Playwright test report locally, run:

REPORT_DIR=$(mktemp -d) && gh run download 28820101356 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant