Skip to content

Commit 9c99cb1

Browse files
authored
[scanner] πŸ› fix: repair 20 test failures β€” remove empty stubs and fix stale selectors (#19270)
* [scanner] fix: update ClusterCardList test selectors - Change refresh button selector from /refreshClusterData/ to /common.refresh/ - Use getAllByText for multiple '-' elements during loading state Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: update PodDrillDown test selectors to match aria-labels - Change namespace button selector from /drilldown.fields.namespace/ to /View namespace ns1/ - Change cluster button selector from /drilldown.fields.cluster/ to /View cluster c1/ Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub files (1/4) Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - useUniversalStats.hook Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - useSnoozeHooks Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - useTokenUsage Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - useUniversalStats Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - shared-coverage Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - storage Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - kagent_crds Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - kagenti Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - networking Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - kubectlProxy.additional.edge Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - kubectlProxy.core.resources Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - cache-coverage Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - worker Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - AlertsContext.core Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> * [scanner] fix: remove empty test stub - AlertsContext.wave2 Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f96745a commit 9c99cb1

18 files changed

Lines changed: 6 additions & 106 deletions

β€Žweb/src/components/clusters/components/__tests__/ClusterCardList.test.tsxβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ describe('ClusterCardList', () => {
9999
it('calls onRefreshCluster when refresh button is clicked', () => {
100100
const onRefreshCluster = vi.fn()
101101
render(<ClusterCardList {...defaultProps} onRefreshCluster={onRefreshCluster} />)
102-
const refreshButton = screen.getByRole('button', { name: /refreshClusterData/i })
102+
const refreshButton = screen.getByRole('button', { name: /common\.refresh/i })
103103
fireEvent.click(refreshButton)
104104
expect(onRefreshCluster).toHaveBeenCalledTimes(1)
105105
})
@@ -108,7 +108,7 @@ describe('ClusterCardList', () => {
108108
const cluster = createMockCluster({ healthy: false, reachable: false })
109109
const onRefreshCluster = vi.fn()
110110
render(<ClusterCardList {...defaultProps} cluster={cluster} onRefreshCluster={onRefreshCluster} />)
111-
const refreshButton = screen.getByRole('button', { name: /cluster.controlsDisabledOffline/i })
111+
const refreshButton = screen.getByRole('button', { name: /cluster\.controlsDisabledOffline/i })
112112
expect(refreshButton).toBeDisabled()
113113
})
114114

@@ -138,7 +138,7 @@ describe('ClusterCardList', () => {
138138
loading: true,
139139
})
140140
render(<ClusterCardList {...defaultProps} cluster={cluster} />)
141-
// Loading indicator should be present
142-
expect(screen.queryByText('-')).toBeInTheDocument()
141+
// Loading indicator should be present β€” multiple fields show '-'
142+
expect(screen.getAllByText('-').length).toBeGreaterThanOrEqual(1)
143143
})
144144
})

β€Žweb/src/components/drilldown/views/__tests__/PodDrillDown.test.tsxβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,12 @@ metadata:
391391
expect(screen.getByText('drilldown.fields.cluster')).toBeInTheDocument()
392392

393393
// Namespace navigation
394-
const nsBtn = screen.getByRole('button', { name: /drilldown.fields.namespace/ })
394+
const nsBtn = screen.getByRole('button', { name: /View namespace ns1/ })
395395
await userEvent.click(nsBtn)
396396
expect(mockDrillToNamespace).toHaveBeenCalledWith('c1', 'ns1')
397397

398398
// Cluster navigation
399-
const clusterBtn = screen.getByRole('button', { name: /drilldown.fields.cluster/ })
399+
const clusterBtn = screen.getByRole('button', { name: /View cluster c1/ })
400400
await userEvent.click(clusterBtn)
401401
expect(mockDrillToCluster).toHaveBeenCalledWith('c1')
402402
})

β€Žweb/src/contexts/__tests__/AlertsContext.core.test.tsxβ€Ž

Lines changed: 0 additions & 7 deletions
This file was deleted.

β€Žweb/src/contexts/__tests__/AlertsContext.wave2.test.tsxβ€Ž

Lines changed: 0 additions & 7 deletions
This file was deleted.

β€Žweb/src/hooks/__tests__/useDeployMissions.test.tsβ€Ž

Lines changed: 0 additions & 6 deletions
This file was deleted.

β€Žweb/src/hooks/__tests__/useSnoozeHooks.test.tsβ€Ž

Lines changed: 0 additions & 6 deletions
This file was deleted.

β€Žweb/src/hooks/__tests__/useTokenUsage.test.tsβ€Ž

Lines changed: 0 additions & 6 deletions
This file was deleted.

β€Žweb/src/hooks/__tests__/useUniversalStats.hook.test.tsβ€Ž

Lines changed: 0 additions & 6 deletions
This file was deleted.

β€Žweb/src/hooks/__tests__/useUniversalStats.test.tsβ€Ž

Lines changed: 0 additions & 6 deletions
This file was deleted.

β€Žweb/src/hooks/mcp/__tests__/kagent_crds.test.tsβ€Ž

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
Β (0)