Skip to content

Implement cohesive Storybook for staff + community UI portal application package Fixes #266#283

Open
rohit-r-kumar wants to merge 292 commits into
mainfrom
rohit-r-kumar/issue266
Open

Implement cohesive Storybook for staff + community UI portal application package Fixes #266#283
rohit-r-kumar wants to merge 292 commits into
mainfrom
rohit-r-kumar/issue266

Conversation

@rohit-r-kumar

@rohit-r-kumar rohit-r-kumar commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #266

Summary by Sourcery

Add a cohesive Storybook setup for the staff UI portal and align shared component stories to the new structure.

New Features:

  • Introduce Storybook configuration, global decorators, and Apollo mocks for the ui-staff app.
  • Add Storybook stories for staff root header and login page components.

Bug Fixes:

  • Adjust staff app tests to mock staff permissions directly and avoid brittle expectations around Navigate redirects.
  • Ensure placeholder pages fall back to JWT roles when backend-derived permissions are unavailable.

Enhancements:

  • Document and skip an unsupported SectionLayout behaviour test that depends on JWT roles-derived permissions.
  • Retitle existing shared UI Storybook stories to follow a consistent Components/Pages taxonomy across staff and shared packages.

Build:

  • Add Storybook, Chromatic, and related addons as dev dependencies and expose Storybook build/run/Chromatic scripts for the ui-staff app.
  • Align ui-staff-shared Storybook React dependency to the workspace catalog version.
  • Register @storybook/react in the workspace catalog for shared use.

Rohit Kumar and others added 30 commits May 4, 2026 21:59
Remove antd and react-dom from dependencies where unused, and storybook
from devDependencies across all ui-staff-route-* packages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…zation

Covers all 4 Entra app-role × 4 route combinations (20 access tests)
plus 3 nav-link visibility tests = 23 tests total.

Strategy: inject a fake OIDC session into sessionStorage via
page.addInitScript() before the app loads. oidc-client-ts restores
stored users without re-validating the JWT signature, so each test
can control the user's roles independently without restarting the
mock auth server.

Test matrix:
- Staff.TechAdmin:       /tech ✓, /finance ✗, /community ✗, /users ✗
- Staff.Finance:         /finance ✓, /tech ✗, /community ✗, /users ✗
- Staff.CaseManager:     /community ✓, /users ✓, /finance ✗, /tech ✗
- Staff.ServiceLineOwner:/community ✓, /users ✓, /finance ✗, /tech ✗
- No roles:              all 4 routes ✗

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…enityJS

feat: add new test commands for end-to-end and acceptance tests in turbo.json

style: format vitest.config.ts for consistency in quotes and indentation
…sion-based routing

- Add StaffRoleSectionPermissions domain value object with 4 permission flags:
  canManageCommunities, canManageUser, canManageFinance, canManageTechAdmin
- Wire sectionPermissions into StaffRolePermissions domain model and persistence adapter
- Add Mongoose schema subdocument for StaffRoleSectionPermissions
- Create idempotent createDefaultRoles app service (4 roles mapped to AAD app roles)
- Create createIfNotExists and queryByExternalId StaffUser app services
- Add StaffUser readonly read-repository with role population
- Wire StaffPortal passport lookup via StaffUserReadRepo.getByExternalId
- Add currentStaffUserAndCreateIfNotExists GraphQL query with full type definitions
- Refactor RequireRole to check backend permissions (permKey) with JWT role fallback
- Refactor StaffRouteShell nav filtering to use permKey for permission-aware links
- Add useStaffPermissions Apollo hook; refactor App.tsx to build StaffAuth from backend
- Add BDD tests for StaffRoleSectionPermissions (12 scenarios, all permission flags)
- Add sectionPermissions scenario to staff-role-permissions BDD test suite
- Fix ReadonlyDataSource index test to include StaffUser mock model and assertions
- Exclude e2e directory from Vitest coverage to fix pre-existing Playwright conflict
- Mock useStaffPermissions in App.test.tsx so unit tests use JWT role fallback path

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Changed  to  in GraphQL queries and components.
- Updated permission checks in  and  to reflect new permission structure.
- Renamed  to  in admin permissions.
- Introduced new finance and tech admin permission features with corresponding tests.
- Added user permissions management with appropriate validation and tests.
- Created Storybook stories for various permission scenarios in .
…aff users

- Implemented GraphQL resolvers for querying and creating staff user entities.
- Added feature tests for staff user resolvers, covering scenarios for JWT verification and AAD roles.
- Created a read repository for staff users with tests for model presence and document retrieval.
- Enhanced staff role domain adapter with additional permission scenarios and tests.
Rohit Kumar and others added 30 commits June 22, 2026 23:47
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.

Implement cohesive Storybook per UI portal application package

3 participants