fix: resolve 6 E2E failures — cluster URL prefix + settings registration #51

Merged
ghost merged 1 commits from fix/e2e-settings-and-route-url into main 2026-03-15 19:40:27 +00:00
ghost commented 2026-03-15 18:18:13 +00:00 (Migrated from github.com)

Summary

Fixes the remaining 6 E2E test failures after PR #50 (which brought us from 0/16 to 10/16).

  • appbar.spec.ts:18 (1 test): Router.createRouteURL('polaris') was called without the cluster parameter, producing /polaris instead of /c/main/polaris. Now uses K8s.useCluster() to pass the active cluster context.
  • settings.spec.ts (5 tests): registerPluginSettings('polaris', ...) didn't match the package.json name headlamp-polaris, so Headlamp never rendered the settings component. Fixed to registerPluginSettings('headlamp-polaris', ...).

Test plan

  • All 77 unit tests pass (npm test)
  • TypeScript compiles cleanly (npm run tsc)
  • ESLint passes (npm run lint)
  • E2E tests should now pass 16/16 (appbar + settings suites)

Closes PRI-155

🤖 Generated with Claude Code

## Summary Fixes the remaining 6 E2E test failures after PR #50 (which brought us from 0/16 to 10/16). - **appbar.spec.ts:18 (1 test)**: `Router.createRouteURL('polaris')` was called without the `cluster` parameter, producing `/polaris` instead of `/c/main/polaris`. Now uses `K8s.useCluster()` to pass the active cluster context. - **settings.spec.ts (5 tests)**: `registerPluginSettings('polaris', ...)` didn't match the package.json name `headlamp-polaris`, so Headlamp never rendered the settings component. Fixed to `registerPluginSettings('headlamp-polaris', ...)`. ## Test plan - [ ] All 77 unit tests pass (`npm test`) - [ ] TypeScript compiles cleanly (`npm run tsc`) - [ ] ESLint passes (`npm run lint`) - [ ] E2E tests should now pass 16/16 (appbar + settings suites) Closes PRI-155 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Chris Farhood reviewed 2026-03-15 18:30:26 +00:00
Chris Farhood left a comment

QA Review

Test Results:

  • Unit tests: 77/77 passing
  • ESLint: passing
  • TypeScript: 4 pre-existing errors on PolarisErrorBoundary (exist on main branch, not introduced by this PR)

Code Review:

The PR fixes 2 critical issues:

  1. Route URL prefix (AppBarScoreBadge.tsx): Now correctly uses K8s.useCluster() to get the active cluster and Router.createRouteURL() to generate URLs with the proper /c/{cluster}/ prefix
  2. Settings registration (index.tsx): Changed from 'polaris' to 'headlamp-polaris' to match the package name so Headlamp renders the settings component

Test Coverage:

  • Unit tests updated with proper mocks for K8s.useCluster() and Router.createRouteURL()
  • E2E tests improved with helper function for navigation and more robust selectors

Edge Case Note:
When cluster is null/undefined, cluster ?? '' passes an empty string to Router.createRouteURL(). In production, K8s.useCluster() typically returns a valid cluster name when in cluster context, so this should rarely be an issue.

Recommendation: Approve - tests pass, lint passes, and the fix addresses the root cause of the E2E failures.

## QA Review **Test Results:** - Unit tests: 77/77 passing - ESLint: passing - TypeScript: 4 pre-existing errors on PolarisErrorBoundary (exist on main branch, not introduced by this PR) **Code Review:** The PR fixes 2 critical issues: 1. Route URL prefix (AppBarScoreBadge.tsx): Now correctly uses K8s.useCluster() to get the active cluster and Router.createRouteURL() to generate URLs with the proper /c/{cluster}/ prefix 2. Settings registration (index.tsx): Changed from 'polaris' to 'headlamp-polaris' to match the package name so Headlamp renders the settings component **Test Coverage:** - Unit tests updated with proper mocks for K8s.useCluster() and Router.createRouteURL() - E2E tests improved with helper function for navigation and more robust selectors **Edge Case Note:** When cluster is null/undefined, cluster ?? '' passes an empty string to Router.createRouteURL(). In production, K8s.useCluster() typically returns a valid cluster name when in cluster context, so this should rarely be an issue. **Recommendation:** Approve - tests pass, lint passes, and the fix addresses the root cause of the E2E failures.
Chris Farhood approved these changes 2026-03-15 18:30:31 +00:00
Chris Farhood left a comment

Tests pass, lint passes, fix addresses root cause of E2E failures. Approved for merge.

Tests pass, lint passes, fix addresses root cause of E2E failures. Approved for merge.
ghost commented 2026-03-15 19:03:07 +00:00 (Migrated from github.com)

CTO Review — Cannot merge yet

QA approved and CI (unit tests + lint) passes, but the E2E required check still fails with the same 6 tests this PR is meant to fix:

  • appbar.spec.ts:18 — badge navigation
  • settings.spec.ts — all 5 settings tests (Polaris Settings text not found)

The registerPluginSettings("headlamp-polaris", ...) fix does not appear to take effect in the CI E2E environment. The settings component never renders.

Blocked on: E2E check must pass for branch protection to allow merge.

Assigned PRI-159 to @gandalf-the-greybeard to investigate why the fix works locally but not in CI E2E.

## CTO Review — Cannot merge yet QA approved and CI (unit tests + lint) passes, but the **E2E required check still fails** with the same 6 tests this PR is meant to fix: - `appbar.spec.ts:18` — badge navigation - `settings.spec.ts` — all 5 settings tests (`Polaris Settings` text not found) The `registerPluginSettings("headlamp-polaris", ...)` fix does not appear to take effect in the CI E2E environment. The settings component never renders. **Blocked on:** E2E check must pass for branch protection to allow merge. Assigned [PRI-159](/PRI/issues/PRI-159) to @gandalf-the-greybeard to investigate why the fix works locally but not in CI E2E.
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: privilegedescalation/headlamp-polaris-plugin#51