Added per-role first-login smoke tests for Ghost Admin - #29815
Conversation
no ref - a production regression left Contributors, Authors and Editors with blank or wrong landing views after login, and nothing in the suite walked a non-admin role through a real first login - each staff role now signs in through the real signin form in a fresh browser context and asserts its landing view plus the navigation it should (and should not) see - Editor, Super Editor and Administrator had no e2e fixtures at all; they now reuse the existing StaffAccountFactory invite flow - corrected the stale NAV_ITEMS role-visibility metadata to match the shipped sidebar gating and moved the contributor menu selectors into a page object
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
WalkthroughAdded role-specific sidebar visibility rules, including support for Super Editor. Added Playwright fixtures for Editor, Super Editor, and Administrator accounts. Added contributor user-menu selectors and a page object. Added smoke tests for first-login landing pages and navigation for Administrators, Editors, Super Editors, Authors, and Contributors. Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run @tryghost/admin:test:acceptance |
✅ Succeeded | 6m 42s | View ↗ |
nx run-many -t test:unit -p @tryghost/test-data... |
✅ Succeeded | 3m 41s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | <1s | View ↗ |
nx run-many -t lint -p @tryghost/e2e,@tryghost/... |
✅ Succeeded | 2m 24s | View ↗ |
nx run @tryghost/admin:build |
✅ Succeeded | 1m 52s | View ↗ |
nx run-many --target=build --projects=tag:publi... |
✅ Succeeded | 32s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-08-10 14:11:13 UTC
no ref The test and helper names already describe the enduring behavior, while the removed comments captured temporary incident and implementation details.

What
e2e/tests/admin/staff-role-smoke.test.ts: every staff role performs a real first login in a fresh browser context and the test asserts the role's landing view plus the navigation it should (and should not) have:/analytics, full sidebar (Analytics, View site, Posts, Pages, Tags, Members, Settings)/site, sidebar with Posts, Pages, Tags, Settings (no Analytics/View site/Members)/site, Editor set plus Members/site, Posts and Pages only/posts, no sidebar at all — floating avatar menu with Posts / View site / Your profileghostAccountEditor,ghostAccountSuperEditor,ghostAccountAdministrator, reusing the existing StaffAccountFactory invite + MailPit flow (Author/Contributor already existed).ContributorUserMenupage object backed by new selector constants in@tryghost/test-data.NAV_ITEMSrole-visibility metadata in the sidebar page object (it claimed Editors see View site and Members, contradicting the shipped gating) and addedSuper Editorto itsUserRoleunion.Why
A recent production regression left non-admin staff with blank or wrong landing views immediately after login — only a hard refresh recovered — and nothing in the suite walked a non-admin role through a real first login, so it shipped unnoticed. The four non-admin tests anchor their landing waits on Ember-rendered content (site preview iframe, posts list), which is exactly what fails to render when the React and Ember routers desync, so this class of regression now fails loudly. First-ever logins skip staff device verification (the session endpoint checks
user.hasLoggedIn()), which is what makes fresh-context signin deterministic here.A console-error tripwire was considered and deliberately deferred — the admin console is currently too noisy to fail on. Tracked in PLA-314.
Verification
pnpm lint(0 errors) andpnpm test:typesine2e/; lint + typecheck inpackages/testing/test-data.home-redirect.tsx, sidebar gating innav-main/nav-content/nav-settings,admin-layout.tsx, role predicates inadmin-x-framework).