test(awx): Part 3 coverage for administration and main (AAP-72866) #3741
useGetActivityStreamRoute maps many resources in the switch (workflow_job_template, inventory_source, execution_environment, workflow_approval, etc.), but this test only covers a handful plus schedule → null.
A table-driven test over every case in the hook would better lock the mapping and document intentional nulls (including the commented-out schedule case).
This helper is identical to platform/test-utils/collectPageNavigationRoutes.ts. Fine for this PR and consistent with the platform route-hook tests, but we now have two copies that can drift.
Optional follow-up: share one module (e.g. frontend/common or framework test-utils) and import from both workspaces.
Most route hooks assert nested IDs with expect.arrayContaining([...subset...]) (this deprecations case is representative). That catches missing listed routes but not duplicate ids in the tree, unexpected extra routes you might want to forbid, or removals of routes that were never part of the asserted subset.
Consider exact sorted ID lists (like useAwxActivityStreamRoutes does with toEqual) or toHaveLength + full set for bounded trees so refactors can't silently drop unlisted routes.
Toolbar/row assertions rely on fixed array indices ([0], [2], [3]), which break if dropdown/separator ordering changes without behavior change.
Prefer finding actions by label (and type where needed), same pattern as other action hook tests in the repo.
Test-only PR looks good to merge from a product-risk perspective. Left four inline notes from review: tighter route ID assertions, broader useGetActivityStreamRoute cases, shared collectPageNavigationRoutes helper, and less index-based action tests.
 Quality Gate passed
Issues
 0 New issues
 0 Accepted issues
Measures
 0 Security Hotspots
 94.4% Coverage on New Code
 0.0% Duplication on New Code
<!-- sqra-placement-anchor -->
See analysis details on SonarQube Cloud
Approved these changes.
lgalis
acruzgon
Summary
useAwx*Routeshooks (ids, paths, nested route ids).useAwxNavigationstructure tests for infrastructure, administration, access, and settings (superuser vs regular user).frontend/awx/test-utils/collectPageNavigationRoutes(mirrors platform pattern) for route tree assertions.Part 3 of the awx coverage epic (AAP-70839); more administration hook/page tests will follow in subsequent PRs to reach the 90% target.
Type of Change
Risk Analysis - REQUIRED
Dependencies
None.
Testing
Ephemeral E2E Tests
Once PR is ready and preliminary checks pass, trigger tests by posting a comment
/run-playwrighton this PR.External Server E2E Runs
N/A — test-only change.
Manual Testing
cd frontend/awx && npx vitest run test-utils/collectPageNavigationRoutes.test.tsx main/routes/awxRouteHooks.test.tsx main/useAwxNavigation.structure.test.tsx administration/execution-environments/hooks/useExecutionEnvironmentsColumns.test.tsx administration/instance-groups/hooks/useInstanceGroupsColumns.test.tsx administration/notifiers/hooks/useNotifiersColumns.test.tsxScreenshots
N/A
Made with Cursor