Skip to content

Moved remaining membership settings acceptance tests into Admin - #29386

Merged
9larsons merged 1 commit into
mainfrom
codex/settings-test-batch-5b
Jul 16, 2026
Merged

Moved remaining membership settings acceptance tests into Admin#29386
9larsons merged 1 commit into
mainfrom
codex/settings-test-batch-5b

Conversation

@9larsons

Copy link
Copy Markdown
Contributor

What changed

  • moved the final Batch 5 membership/settings acceptance coverage into the Admin browser-test lane
  • replaced 43 legacy Playwright cases across welcome emails, membership routing, and recommendations with 34 focused Admin acceptance cases
  • removed the three superseded legacy acceptance files

Coverage decisions

The replacement suite keeps browser-level behavior and API contracts in acceptance coverage:

  • welcome-email editor, preview lifecycle, validation, modal behavior, Koenig cards/configuration, sender fallback, row creation/toggles, and customization saves
  • recommendation listing, validation, create/edit/delete payloads, duplicate handling, and incoming recommendations
  • automations-flag visibility for the legacy welcome-email section

Coverage was consolidated rather than copied mechanically:

  • out-of-order preview responses, error mapping, sender placeholder variants, and design payload mapping remain covered by focused unit tests
  • actual welcome-email delivery, enable/disable outcomes, template delivery, preview customization, and persistence remain covered by existing Admin E2E tests
  • verification-token handling is already covered by the consolidated Admin email-settings acceptance suite

Validation

  • apps/admin: 3 migrated files, 34/34 acceptance tests
  • apps/admin-x-settings: 3 related unit files, 11/11 tests
  • ESLint on all new acceptance files
  • Admin TypeScript project build
  • independent review pass, findings incorporated, clean second pass

Follow-ups discovered

  • The migrated tests expose a pre-existing invalid DOM nesting warning from the legacy TableRow structure (<td> beneath <div>) in recommendations and newsletters. This is outside the port-only scope and should be fixed separately.
  • A cold full-suite local run triggered Vite dependency optimization for bson-objectid, reloaded the browser mid-run, and produced duplicate-React hook failures in unrelated suites. Focused suites remain green; the plan already identifies cold-cache optimization as a local papercut, and CI will provide the stable full-lane signal.

ref https://linear.app/ghost/issue/PLA-243

ref https://linear.app/ghost/issue/PLA-243

- finishes the split membership test migration before the legacy harness teardown
- keeps browser-level editor and API contracts in Admin while relying on focused unit and E2E coverage for lower- and higher-level behavior
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Replaces removed Admin-X Playwright acceptance tests with Admin Vitest browser acceptance suites. The new tests cover member welcome email previews, editor behavior, sender customization, activation state, membership navigation visibility, and recommendations listing, validation, CRUD, deletion confirmation, and incoming recommendations.

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: moving membership settings acceptance tests into Admin.
Description check ✅ Passed The description clearly matches the changeset and explains the migrated acceptance coverage and removals.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 codex/settings-test-batch-5b

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 16, 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 0d3f369

Command Status Duration Result
nx run @tryghost/admin:test:acceptance ✅ Succeeded 4m 3s View ↗

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


☁️ Nx Cloud last updated this comment at 2026-07-16 14:15:48 UTC

@9larsons
9larsons marked this pull request as ready for review July 16, 2026 13:58

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
apps/admin/src/settings/growth/recommendations.acceptance.test.tsx (2)

91-98: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove redundant locator reassignment.

Locators returned by settingsScreen.section(...) evaluate dynamically on each action. Reassigning modal to the exact same locator after transitioning to the next step is redundant.

♻️ Proposed refactor
-        let modal = settingsScreen.section("add-recommendation-modal");
+        const modal = settingsScreen.section("add-recommendation-modal");
         await modal.getByLabelText("URL").fill("not a real url");
         await modal.getByRole("button", {name: "Next"}).click();
         await expect.element(modal.getByText("Enter a valid URL")).toBeVisible();
 
         await modal.getByLabelText("URL").fill("https://example.com/a-cool-website");
         await modal.getByRole("button", {name: "Next"}).click();
-        modal = settingsScreen.section("add-recommendation-modal");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/admin/src/settings/growth/recommendations.acceptance.test.tsx` around
lines 91 - 98, Remove the redundant reassignment of modal from
settingsScreen.section("add-recommendation-modal") after clicking Next; continue
using the existing modal locator for subsequent actions, since it resolves the
current modal state dynamically.

86-86: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Return a mocked recommendation entity from the create endpoint.

Returning an empty array from the POST creation endpoint deviates from the actual API contract. While the current test passes because the frontend might not interact with the response body directly, it is safer to return a mocked representation of the created entity. This aligns with standard behavior and prevents future test breakages if the component begins to utilize the response (e.g., to read the new ID or updated timestamps).

♻️ Proposed refactor
-        const addApi = fakeAdminEndpoint("POST", "/recommendations/", {recommendations: []});
+        const addApi = fakeAdminEndpoint("POST", "/recommendations/", {
+            recommendations: [{
+                id: "new-recommendation-id",
+                title: "This is a title",
+                url: "https://example.com/a-cool-website",
+                description: "This is a description",
+                excerpt: null,
+                featured_image: null,
+                favicon: null,
+                one_click_subscribe: true,
+            }]
+        });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/admin/src/settings/growth/recommendations.acceptance.test.tsx` at line
86, Update the mocked POST endpoint configured by addApi to return a
representative created recommendation entity instead of an empty recommendations
array. Reuse the test’s existing recommendation fixture or factory where
available, ensuring the response includes the fields the real create API
returns, such as the entity ID and timestamps.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@apps/admin/src/settings/growth/recommendations.acceptance.test.tsx`:
- Around line 91-98: Remove the redundant reassignment of modal from
settingsScreen.section("add-recommendation-modal") after clicking Next; continue
using the existing modal locator for subsequent actions, since it resolves the
current modal state dynamically.
- Line 86: Update the mocked POST endpoint configured by addApi to return a
representative created recommendation entity instead of an empty recommendations
array. Reuse the test’s existing recommendation fixture or factory where
available, ensuring the response includes the fields the real create API
returns, such as the entity ID and timestamps.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f6802149-3575-4b06-a9b2-8d1541c2a9bc

📥 Commits

Reviewing files that changed from the base of the PR and between 70de564 and 0d3f369.

📒 Files selected for processing (6)
  • apps/admin-x-settings/test/acceptance/membership/member-welcome-emails.test.ts
  • apps/admin-x-settings/test/acceptance/membership/membership-settings.test.ts
  • apps/admin-x-settings/test/acceptance/membership/recommendations.test.ts
  • apps/admin/src/settings/growth/recommendations.acceptance.test.tsx
  • apps/admin/src/settings/membership/member-welcome-emails.acceptance.test.tsx
  • apps/admin/src/settings/membership/membership-settings.acceptance.test.tsx
💤 Files with no reviewable changes (3)
  • apps/admin-x-settings/test/acceptance/membership/membership-settings.test.ts
  • apps/admin-x-settings/test/acceptance/membership/recommendations.test.ts
  • apps/admin-x-settings/test/acceptance/membership/member-welcome-emails.test.ts

@9larsons
9larsons merged commit 6682543 into main Jul 16, 2026
79 of 81 checks passed
@9larsons
9larsons deleted the codex/settings-test-batch-5b branch July 16, 2026 14:16
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