Skip to content

Cleaned up e2e test isolation and file structure#27063

Merged
9larsons merged 3 commits intomainfrom
e2e-test-cleanup-phase1
Apr 1, 2026
Merged

Cleaned up e2e test isolation and file structure#27063
9larsons merged 3 commits intomainfrom
e2e-test-cleanup-phase1

Conversation

@9larsons
Copy link
Copy Markdown
Contributor

@9larsons 9larsons commented Apr 1, 2026

Summary

Phase 1+2 of the e2e shard rebalancing plan.

ISO cleanup (Phase 1):

  • Removed usePerTestIsolation() from 5 files where it was unnecessary:
    • 4 single-test files where per-file isolation is identical (private-site, staff-invites, newsletter-send, virtual-window)
    • filter-actions.test.ts — 2 tests that operate on independent label operations with no shared state conflicts

File consolidation (Phase 1):

  • Merged posts.test.ts (1 test) and post-settings.test.ts (1 test) into publishing.test.ts — same feature surface, eliminates 2 Ghost instance spinups
  • Consolidated 3 post preview modal tests into 1 flow test

forEach collapse (Phase 2):

  • force-upgrade.test.ts: Collapsed 2 NAV_ITEMS.forEach() loops (14 tests, each with its own Ghost instance) into 2 flow tests. Eliminates ~11 Ghost instance spinups — likely the single most expensive file in the suite.
  • navigation.test.ts: Collapsed NAV_ITEMS.forEach() (7 tests) into 1 flow test that iterates all items in sequence.

No coverage removed. Every assertion from the original tests is preserved — just grouped into fewer tests with fewer Ghost instances.

Net impact:

  • 2 files deleted, 6 files modified
  • ~23 fewer test() calls
  • ~13 fewer Ghost instance spinups per CI run
  • Largest savings from force-upgrade forEach collapse

Test plan

  • CI e2e tests pass on all 8 shards
  • Verify no coverage gaps by reviewing deleted test assertions against their new locations

9larsons added 3 commits April 1, 2026 12:06
These four files each contain only one test, so per-file isolation
is identical to per-test isolation. The call was a no-op adding
cognitive overhead without any behavioral benefit.
posts.test.ts (1 test) and post-settings.test.ts (1 test) tested
the same feature surface as publishing.test.ts with the same setup
pattern. Merging them eliminates 2 Ghost instance spinups in CI
without losing any coverage.
Three separate tests for closing the preview modal (close button,
ESC from header, ESC from iframe) are now one test that exercises
all three dismiss methods in sequence. Same coverage, one setup
instead of three.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Walkthrough

This pull request removes the usePerTestIsolation function invocations from four test files (virtual-window, newsletter-send, private-site, and staff-invites). It consolidates three separate test scenarios into a single test in post-preview.test.ts. Two complete test suites from post-settings.test.ts and posts.test.ts are removed, with their test logic relocated to publishing.test.ts, which is updated to include the PostFactory type import.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing test isolation calls and consolidating test files to streamline the e2e test suite.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description clearly explains the changes: removal of redundant per-test isolation, consolidation of test files, and reduction of Ghost instance spinups in CI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch e2e-test-cleanup-phase1

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 and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
e2e/tests/admin/posts/post-preview.test.ts (2)

5-5: Test suite naming should follow 'Ghost Admin - Feature' convention.

The test suite is named 'Post Preview Modal' but guidelines specify the format 'Ghost Admin - Feature' or 'Ghost Public - Feature'.

Suggested fix
-test.describe('Post Preview Modal', () => {
+test.describe('Ghost Admin - Post Preview Modal', () => {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e/tests/admin/posts/post-preview.test.ts` at line 5, The suite name used in
test.describe currently reads "Post Preview Modal" and must follow the "Ghost
Admin - Feature" convention; update the test.describe invocation (the string
passed to test.describe) to a name like "Ghost Admin - Post Preview Modal" (or
equivalent "Ghost Admin - <Feature>") so it matches project naming guidelines
and keeps the rest of the tests (inside the same test.describe block) unchanged.

12-51: Consolidating multiple scenarios into one test deviates from coding guidelines.

The coding guidelines state "one test = one scenario (never mix multiple scenarios)". This test exercises three distinct dismiss methods (close button, ESC from header, ESC from iframe) in sequence.

I understand from the PR objectives that this consolidation is intentional to reduce CI overhead (fewer Ghost instances). If this trade-off is accepted, consider adding a brief comment at the top of the test explaining the consolidation rationale for future maintainers.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@e2e/tests/admin/posts/post-preview.test.ts` around lines 12 - 51, This test
mixes three independent scenarios (close button, ESC from header, ESC from
iframe) so either split them into three separate tests or, if consolidation is
intentionally chosen to reduce CI overhead, add a brief comment at the top of
this test explaining that rationale; locate the test function (the test named
'preview modal opens and can be closed via close button, ESC from header, and
ESC from iframe') and either refactor its body into three tests that each
exercise PostEditorPage.previewButton/previewModal.close(), previewModal.header
+ pressKey('Escape'), and previewModalDesktopFrame.clickPostLinkByTitle(...) +
pressKey('Escape') respectively, or prepend a one-line explanatory comment above
the existing test describing why multiple scenarios are consolidated for CI cost
reasons.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@e2e/tests/admin/posts/post-preview.test.ts`:
- Line 5: The suite name used in test.describe currently reads "Post Preview
Modal" and must follow the "Ghost Admin - Feature" convention; update the
test.describe invocation (the string passed to test.describe) to a name like
"Ghost Admin - Post Preview Modal" (or equivalent "Ghost Admin - <Feature>") so
it matches project naming guidelines and keeps the rest of the tests (inside the
same test.describe block) unchanged.
- Around line 12-51: This test mixes three independent scenarios (close button,
ESC from header, ESC from iframe) so either split them into three separate tests
or, if consolidation is intentionally chosen to reduce CI overhead, add a brief
comment at the top of this test explaining that rationale; locate the test
function (the test named 'preview modal opens and can be closed via close
button, ESC from header, and ESC from iframe') and either refactor its body into
three tests that each exercise
PostEditorPage.previewButton/previewModal.close(), previewModal.header +
pressKey('Escape'), and previewModalDesktopFrame.clickPostLinkByTitle(...) +
pressKey('Escape') respectively, or prepend a one-line explanatory comment above
the existing test describing why multiple scenarios are consolidated for CI cost
reasons.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6f0b2e23-6d52-44f6-9e02-c89d62adf11a

📥 Commits

Reviewing files that changed from the base of the PR and between 298dd47 and a265c32.

📒 Files selected for processing (8)
  • e2e/tests/admin/members/virtual-window.test.ts
  • e2e/tests/admin/posts/newsletter-send.test.ts
  • e2e/tests/admin/posts/post-preview.test.ts
  • e2e/tests/admin/posts/post-settings.test.ts
  • e2e/tests/admin/posts/posts.test.ts
  • e2e/tests/admin/posts/publishing.test.ts
  • e2e/tests/admin/settings/private-site.test.ts
  • e2e/tests/admin/settings/staff-invites.test.ts
💤 Files with no reviewable changes (6)
  • e2e/tests/admin/settings/private-site.test.ts
  • e2e/tests/admin/settings/staff-invites.test.ts
  • e2e/tests/admin/posts/newsletter-send.test.ts
  • e2e/tests/admin/posts/posts.test.ts
  • e2e/tests/admin/members/virtual-window.test.ts
  • e2e/tests/admin/posts/post-settings.test.ts

@9larsons 9larsons enabled auto-merge (squash) April 1, 2026 17:26
@9larsons 9larsons merged commit bef12af into main Apr 1, 2026
36 checks passed
@9larsons 9larsons deleted the e2e-test-cleanup-phase1 branch April 1, 2026 17:30
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