fix: resolve 7 E2E test failures — badge nav + test selectors (#50)
Fix badge navigation to use cluster-scoped path via Router.createRouteURL instead of hardcoded '/polaris'. Remove hardcoded RGB color assertions in badge color test. Scope ambiguous /%/ and 'Resources' selectors in polaris E2E tests. Fix settings tests to click into plugin settings before asserting. Fixes: PRI-151 Co-authored-by: gandalf-the-greybeard[bot] <gandalf-the-greybeard[bot]@users.noreply.github.com> Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit was merged in pull request #50.
This commit is contained in:
committed by
GitHub
parent
0f88a9b19f
commit
fb3d262eb7
@@ -7,6 +7,9 @@ import { makeAuditData, makeResult } from '../test-utils';
|
||||
// Mock Headlamp lib
|
||||
vi.mock('@kinvolk/headlamp-plugin/lib', () => ({
|
||||
ApiProxy: { request: vi.fn() },
|
||||
Router: {
|
||||
createRouteURL: (name: string) => `/c/test-cluster/${name}`,
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('@mui/material/styles', () => ({
|
||||
@@ -110,7 +113,7 @@ describe('AppBarScoreBadge', () => {
|
||||
|
||||
render(<AppBarScoreBadge />);
|
||||
await user.click(screen.getByRole('button'));
|
||||
expect(mockPush).toHaveBeenCalledWith('/polaris');
|
||||
expect(mockPush).toHaveBeenCalledWith('/c/test-cluster/polaris');
|
||||
});
|
||||
|
||||
it('has correct aria-label', () => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Router } from '@kinvolk/headlamp-plugin/lib';
|
||||
import { useTheme } from '@mui/material/styles';
|
||||
import React from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
@@ -34,7 +35,7 @@ export default function AppBarScoreBadge() {
|
||||
};
|
||||
|
||||
const handleClick = () => {
|
||||
history.push('/polaris');
|
||||
history.push(Router.createRouteURL('polaris'));
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user