Skip to content

fix(ui): Fix PF6 component test failures#19275

Merged
sachaudh merged 5 commits intodv/ROX-28622-pf-6from
sc/fix-pf-v6-component-tests
Mar 5, 2026
Merged

fix(ui): Fix PF6 component test failures#19275
sachaudh merged 5 commits intodv/ROX-28622-pf-6from
sc/fix-pf-v6-component-tests

Conversation

@sachaudh
Copy link
Contributor

@sachaudh sachaudh commented Mar 3, 2026

Description

Fix component test failures caused by the PatternFly 6 migration.

Changes:

  • BaseImagesModal: Use findByRole instead of cy.get('button').contains() to match PF6 button structure
  • ViolationsByPolicyCategory: Skip legend click test due to upstream Victory v37 bug where getInteractiveLegendEvents doesn't fire onLegendClick; fix chartNames type mismatch in the chart component
  • NodeComponentsTable: Use findByRole('columnheader') with nested button click instead of cy.get('th:contains()') for PF6 sortable table headers

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

  • Ran affected component tests locally to confirm they pass with the updated selectors
  • Verified the skipped test documents the upstream Victory v37 issue

Screenshots

Before After

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>
@openshift-ci
Copy link

openshift-ci bot commented Mar 3, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

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>
@rhacs-bot
Copy link
Contributor

rhacs-bot commented Mar 3, 2026

Images are ready for the commit at a6a1d65.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-239-ga6a1d653c1.

sachaudh added 2 commits March 3, 2026 12:58
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
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.56%. Comparing base (5c8ffeb) to head (a6a1d65).
⚠️ Report is 2 commits behind head on dv/ROX-28622-pf-6.

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           
Flag Coverage Δ
go-unit-tests 49.56% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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>
@sachaudh sachaudh marked this pull request as ready for review March 4, 2026 20:42
@sachaudh sachaudh requested a review from a team as a code owner March 4, 2026 20:42
Copy link
Contributor

@dvail dvail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@dvail dvail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if a fix is in a follow up!

@sachaudh sachaudh merged commit dac48f7 into dv/ROX-28622-pf-6 Mar 5, 2026
88 checks passed
@sachaudh sachaudh deleted the sc/fix-pf-v6-component-tests branch March 5, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants