Skip to content

fix(ui): Fix PF6 e2e test failures#19342

Draft
sachaudh wants to merge 7 commits intodv/ROX-28622-pf-6from
sc/fix-e2e-tests
Draft

fix(ui): Fix PF6 e2e test failures#19342
sachaudh wants to merge 7 commits intodv/ROX-28622-pf-6from
sc/fix-e2e-tests

Conversation

@sachaudh
Copy link
Contributor

@sachaudh sachaudh commented Mar 9, 2026

Description

Jira: ROX-28622

Fixes Cypress e2e test failures caused by the PatternFly 6 migration.

  • Update stale PF5/PF6 CSS selectors (pf-v5-*pf-v6-*, chip-grouplabel-group, pf-m-goldpf-m-yellow, PF6/TabPF6/TabButton)
  • Scope getInputByLabel to open modals to prevent matching background labels (PF6 changed Checkbox <span> to <label>)
  • Guard Cypress scrolled handler against non-DOM elements
  • Increase collection results page size from 10 to 20
  • Rewrite imageSingle summary card test to compare severity vs status card totals instead of "results found" text (which differs due to CVE deduplication)
  • Simplify network graph sidebar selectors (expandable sections → h2 headings)

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

  • Test changes are selector/assertion updates only; validated by reviewing PF6 component source to confirm new class names and DOM structure
  • CollectionResults.tsx page size change is a minimal config bump with no logic change

sachaudh added 6 commits March 9, 2026 13:49
Replace last two pf-v5 references in Cypress selector files:
- Clusters.selectors.js: pf-v5 form group classes to pf-v6
- Risk.selectors.js: pf-v5 global CSS variable to pf-v6

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
Update Cypress test selectors to match PF6 component changes:

- Banner: pf-m-gold -> pf-m-yellow (PF6 renamed warning color)
- HelpMenu: Remove sibling selector for portaled dropdown
- NetworkGraph sidebar: ExpandableSection replaced with Title h2
- ChipGroup -> LabelGroup class rename
- OUIA Tab type: PF6/Tab -> PF6/TabButton

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
The deploymentMatching e2e test was failing because "sensor" fell on
page 2 of paginated results. The stackrox namespace now has 11+
deployments (scanner-v4, scanner-v4-db were added), exceeding the
previous page size of 10. Increasing to 20 ensures all typical
stackrox deployments load on the first page.

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
The scrolled event handler in e2e.js calls $el.get(0).scrollIntoView()
but PF6 portaled elements (Select menus rendered on document.body) can
cause $el.get(0) to return a non-DOM object without scrollIntoView,
crashing the handler with "scrollIntoView is not a function". Adding a
type check allows Cypress to fall back to its default scroll behavior.

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
PF6 changed Checkbox labels from <span> to <label>, causing
getInputByLabel('Name') to match "Advisory Name and Advisory Link" in
the background report form instead of the "Name" label inside the
collection modal. Scoping cy.contains to the open modal prevents
matching labels in background content.

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
The test compared the sum of severity card counts against "results
found", but these use different counting methods. A single CVE can
have different severities from different sources, making the
per-severity sum larger than the deduplicated imageVulnerabilityCount.

Also adds the missing Unknown severity to the selector list.

The test now verifies that severity and status card sums are internally
consistent (both derive from imageCVECountBySeverity) and that
"results found" renders with a positive count.

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
@openshift-ci
Copy link

openshift-ci bot commented Mar 9, 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

@sachaudh sachaudh changed the title Sc/fix e2e tests fix(ui): Fix PF6 e2e test failures Mar 9, 2026
@stackrox stackrox deleted a comment from openshift-ci bot Mar 9, 2026
@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.68%. Comparing base (e9f0417) to head (2791d37).

Additional details and impacted files
@@                  Coverage Diff                  @@
##           dv/ROX-28622-pf-6   #19342      +/-   ##
=====================================================
- Coverage              49.68%   49.68%   -0.01%     
=====================================================
  Files                   2693     2693              
  Lines                 202653   202653              
=====================================================
- Hits                  100697   100691       -6     
- Misses                 94445    94450       +5     
- Partials                7511     7512       +1     
Flag Coverage Δ
go-unit-tests 49.68% <ø> (-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.

The status card reduce callback incorrectly reset the accumulator to 0
on NaN instead of preserving it, which could discard the running sum
and cause a false test failure.

Extract COLLECTION_RESULTS_PAGE_SIZE constant to prevent the page size
in fetchMatchingDeployments and usePaginatedQuery from drifting apart.

Signed-off-by: Saif Chaudhry <schaudhr@redhat.com>
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.

1 participant