fix(ui): Fix PF6 component test failures#19275
Conversation
PF6 changed DOM structure in ways that broke 3 component tests:
- BaseImagesModal: Button text is now wrapped in a span, so
`cy.get('button').contains()` returns the span instead of the
button element. Use `findByRole` to target the button directly.
- NodeComponentsTable: Sort button inside `<th>` doesn't receive
click events when clicking the `<th>` on subsequent clicks. Target
the inner button via `findByRole('columnheader').findByRole('button')`.
- ViolationsByPolicyCategory: Victory v37 (PF charts v8) does not
fire onLegendClick via getInteractiveLegendEvents. This is a known
upstream issue. Skip the affected test until the chart library is
fixed or the legend interaction is rewritten.
Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
|
Skipping CI for Draft Pull Request. |
Update remaining cy.get('button').contains() calls to findByRole in
BaseImagesModal tests for consistency. Replace double type assertion
(as unknown as) with proper tuple wrapping for chartNames.
Partially generated by AI.
Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
|
Images are ready for the commit at a6a1d65. To use with deploy scripts, first |
The PF6 types accept string[][] from [Object.values()] directly, so the explicit cast is not needed. Partially generated by AI. Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
Replace ROX-TBD placeholder with the actual Jira issue tracking the Victory v37 interactive legend click regression. Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dv/ROX-28622-pf-6 #19275 +/- ##
==================================================
Coverage 49.56% 49.56%
==================================================
Files 2675 2675
Lines 201838 201838
==================================================
+ Hits 100031 100033 +2
+ Misses 94348 94346 -2
Partials 7459 7459
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ui/apps/platform/src/Containers/Dashboard/Widgets/ViolationsByPolicyCategory.cy.jsx
Show resolved
Hide resolved
Break chained findByRole calls onto separate lines to satisfy prettier line length rules. Partially generated by AI. Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
dvail
left a comment
There was a problem hiding this comment.
Changes look good aside from the disabled test. If we do not have a short term fix, we should at least document the problem more clearly in the disabled test and create a high-severity bug ticket to figure out alternatives.
ui/apps/platform/src/Containers/Dashboard/Widgets/ViolationsByPolicyCategory.cy.jsx
Show resolved
Hide resolved
dvail
left a comment
There was a problem hiding this comment.
LGTM if a fix is in a follow up!
Description
Fix component test failures caused by the PatternFly 6 migration.
Changes:
findByRoleinstead ofcy.get('button').contains()to match PF6 button structuregetInteractiveLegendEventsdoesn't fireonLegendClick; fixchartNamestype mismatch in the chart componentfindByRole('columnheader')with nested button click instead ofcy.get('th:contains()')for PF6 sortable table headersUser-facing documentation
Testing and quality
Automated testing
How I validated my change
Screenshots