[scanner] fix: address Coverage Suite #4197 test failures#20879
Conversation
Fix 96 test failures across mission-control and missions test files:
- ClusterSelectionDialog: update props isOpen→open, onClose→onCancel,
add required missionTitle, add useClusters mock
- MissionDetailView: fix .animate-pulse→.animate-shimmer skeleton selector,
fix matchScore={0.85}→matchScore={85} for correct % rendering
- LaunchSequence: add launchProgress to mockState so phases render,
rename tests to match what the component actually renders
- PayloadGrid: fix getByText→getAllByText for duplicate category text
- RequestApprovalModal: update title text to match 'Request Deployment Approval'
- FlightPlanBlueprint: use data-testid selector for project node
- SaveResolutionDialog: fix props to use mission:Mission instead of
resolution/onSave/initialTitle; add useResolutions/wsAuth mocks
- MissionDialogs: fix all dialog props (ClusterSelection, SaveResolution,
ShareMission, SubmitToKB); add effectiveness field to mock resolution
- MissionViews: fix MissionDetailView props; add useParams and analytics
mocks needed by MissionLandingPage
- OperatorDrillDown: use getAllByText to handle multiple text matches
Harness/groundtruth tests (#20876 already fixed these in main).
Fixes #20877
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
✅ Deploy Preview for kubestellarconsole canceled.
|
|
👋 Hey @clubanderson — thanks for opening this PR!
This is an automated message. |
|
🐝 Hi @clubanderson! I'm Trusted users — org members and contributors with write access — can mention Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies. |
✅ Test Coverage CheckAll new source files in this PR have corresponding test files. Checked |
♿ Accessibility Audit (WCAG 2.1 AA)✅ No WCAG 2.1 AA violations detected in audited routes. Powered by axe-core. Target: WCAG 2.1 AA compliance. |
There was a problem hiding this comment.
Pull request overview
Updates unit tests to align with recent component API changes and UI rendering behavior across the Missions and Mission Control areas, resolving Coverage Suite #4197 failures without modifying production code.
Changes:
- Updated dialog-related tests for renamed/required props and added missing hook/module mocks (clusters, resolutions, ws auth, analytics).
- Adjusted test assertions to match current DOM output (skeleton class, match score formatting, modal title text, duplicate text queries, SVG node selection).
- Refreshed Mission Control test fixtures (e.g.,
launchProgress) so expected phase/project content is present in the rendered output.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| web/src/components/drilldown/views/OperatorDrillDown.test.tsx | Adjusts assertion to avoid duplicate-text failures when operator name appears in multiple locations. |
| web/src/components/mission-control/FlightPlanBlueprint.test.tsx | Switches to a stable data-testid selector for SVG project nodes. |
| web/src/components/mission-control/LaunchSequence.test.tsx | Updates fixture state + assertions to reflect current LaunchSequence rendering behavior. |
| web/src/components/mission-control/PayloadGrid.test.tsx | Updates category assertion to handle duplicate category text rendered per card. |
| web/src/components/mission-control/RequestApprovalModal.test.tsx | Updates expected modal title text to match current UI copy. |
| web/src/components/missions/ClusterSelectionDialog.test.tsx | Updates tests for renamed props and adds useClusters hook mock. |
| web/src/components/missions/MissionDetailView.test.tsx | Aligns assertions with updated loading skeleton class and match score formatting. |
| web/src/components/missions/MissionDialogs.test.tsx | Updates dialog props and adds required mocks (useClusters, useResolutions, wsAuth, scanner). |
| web/src/components/missions/MissionViews.test.tsx | Adds missing router params and analytics mocks; supplies newly required props to MissionDetailView. |
| web/src/components/missions/SaveResolutionDialog.test.tsx | Updates tests to new mission-based API and adds required mocks for resolutions + ws auth. |
| web/src/components/missions/tests/ClusterSelectionDialog.test.tsx | Updates smoke test to provide required dialog props instead of rendering with an empty props cast. |
| it('renders operator name in the header', () => { | ||
| render(<OperatorDrillDown data={OPERATOR_DATA} />) | ||
| expect(screen.getByText('cert-manager')).toBeInTheDocument() | ||
| expect(screen.getAllByText('cert-manager').length).toBeGreaterThan(0) |
| ) | ||
|
|
||
| expect(screen.getByText('Observability')).toBeInTheDocument() | ||
| expect(screen.getAllByText('Observability')).toHaveLength(2) |
clubanderson
left a comment
There was a problem hiding this comment.
[quality] Test-only PR that catches tests up to production API drift — exactly the right kind of fix. +152/-65 across 11 files, all in web/src/components/{mission-control,missions,drilldown}/**/*.test.tsx. No production behavior change.
Diagnoses are correct:
- API rename (
isOpen/onClose→open/onCancel,missionTitlerequired) — real prop-signature drift onClusterSelectionDialog. SaveResolutionDialogshift from rawresolution: stringtomission: Mission— matches the hook rework inuseResolutions. NewMissionmock includes requiredmessages,createdAt,updatedAt— good.ShareMissionDialog/SubmitToKBDialogswitch frommission: MissionExport→resolution: Resolution— the addedeffectiveness: { timesUsed, timesSuccessful }required field is included.MissionDetailViewskeleton classanimate-pulse→animate-shimmer— matches the actual class in the loading skeleton.matchScoresemantics fix: passing85for "85% match" instead of0.85— real bug in the previous test (silent misuse).LaunchSequence.descriptionwas never rendered in JSX (only in prompt string) — replacing the assertion withlaunchProgress-driven DOM checks + renaming the test to match is honest.
Two minor nits (non-blocking):
-
PayloadGrid.test.tsx:expect(getAllByText('Observability')).toHaveLength(2)is exact-count and will silently break if a third card is added later. ConsidertoHaveLength(mockProjects.length)or.toBeGreaterThanOrEqual(1)if the intent is just "renders at least once per card". -
ClusterSelectionDialog.test.tsx— the old test found the close button by any svg icon, which is loose. The newgetByRole('button', { name: /close modal/i })is stronger — good — but note it depends on the modal exposing that accessible name. Once #20879 lands, worth a one-line comment in the mock about that contract.
Note on MissionDialogs.test.tsx: the getWsAuthParams: vi.fn().mockRejectedValue(new Error('AI unavailable')) mock is a nice touch for isolating the render path from network side effects.
Coverage Suite #4197 root causes fully explained. mergeable_state: unstable — waiting on remaining checks. LGTM.
Filed by quality agent (ACMM L4/L6 — full mode)
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
✅ Post-Merge Verification: passedCommit: |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
Fixes #20877
Summary
Repairs test failures from Coverage Suite run #4197 across the
mission-controlandmissionstest suites. No production code was changed — only test files were updated to match current component APIs.Root Causes Fixed
1.
ClusterSelectionDialogprops renamedisOpen→open,onClose→onCancelmissionTitlepropuseClustershook mock2.
SaveResolutionDialogAPI changedmission: Missioninstead ofresolution: string/onSave/initialTitleuseResolutionsandwsAuthmocks3.
ShareMissionDialog/SubmitToKBDialogAPI changedresolution: Resolution(notmission: MissionExport)effectivenessrequired field to mockResolutionobject4.
MissionDetailViewrendering fixes.animate-shimmernot.animate-pulsematchScorerendered as-is (e.g.85% match), so pass85not0.85rawContent,showRaw,onToggleRaw,onBack5.
LaunchSequencedescription not rendered in JSXstate.descriptionis only used in the mission prompt string, not renderedlaunchProgressentries so phase/project names actually appear in the DOM6.
PayloadGridduplicate category textcategory, causinggetByTextto throw on duplicatesgetAllByText(...).toHaveLength(2)7.
RequestApprovalModaltitle text"Request Deployment Approval"not"Request Approval"8.
FlightPlanBlueprintproject node selectorProjectNodeSVG element hasdata-testid; usegetByTestIdinstead of text search9.
MissionLandingPagemissing mocksuseParamsto react-router-dom mock (required by the component)emitPageView,emitMissionError)10.
OperatorDrillDownduplicate name textgetAllByTextFiles Changed (test files only)
web/src/components/drilldown/views/OperatorDrillDown.test.tsxweb/src/components/mission-control/FlightPlanBlueprint.test.tsxweb/src/components/mission-control/LaunchSequence.test.tsxweb/src/components/mission-control/PayloadGrid.test.tsxweb/src/components/mission-control/RequestApprovalModal.test.tsxweb/src/components/missions/ClusterSelectionDialog.test.tsxweb/src/components/missions/MissionDetailView.test.tsxweb/src/components/missions/MissionDialogs.test.tsxweb/src/components/missions/MissionViews.test.tsxweb/src/components/missions/SaveResolutionDialog.test.tsxweb/src/components/missions/__tests__/ClusterSelectionDialog.test.tsxNote on Remaining Failures
The 9 harness/groundtruth tests listed in the issue were already fixed by merged PR #20876 and are passing in the current main branch.