Skip to content

fix: support both OCP 4.20 (PF v5) and 4.22 (PF v6) selectors - #38

Open
talhil-rh wants to merge 2 commits into
flightctl:mainfrom
talhil-rh:fix/ocp-422-cypress-selectors-371
Open

fix: support both OCP 4.20 (PF v5) and 4.22 (PF v6) selectors#38
talhil-rh wants to merge 2 commits into
flightctl:mainfrom
talhil-rh:fix/ocp-422-cypress-selectors-371

Conversation

@talhil-rh

Copy link
Copy Markdown
Collaborator

Root Cause

The flightctl-ui plugin was redesigned in flightctl/flightctl-ui#803 (merged Sep 9, 2026), which:

  1. Removed fctl-device-details-tab__label — Device details now use PF DescriptionListTerm instead of StackItem with a custom class
  2. Renamed "Fleet name" → "Fleet" — The label text changed in the new layout
  3. Moved "Add label" buttonEditableLabelControl now renders the button outside LabelGroup, breaking .pf-v6-c-label-group button[aria-label="Add label"] selectors
  4. PF v5 vs v6 class prefixes — OCP 4.20 console renders pf-v5-c-* classes while OCP 4.22 renders pf-v6-c-*

Fix

  • views/common.js: Added pfV() helper for dual PF v5/v6 selectors and deviceDetailsFleetRow() helper that auto-detects new vs legacy device details layout
  • views/fleetsPage.js: Fixed createFleet to click "Add label" button instead of targeting .pf-v6-c-label-group__list; fixed deleteFleet to use cy.contains("td", fleetname) instead of [data-label="Name"]
  • views/devicesPage.js: Fixed fleet detection in runFleetLabelDetachReattachTest, expectDeviceDetailsFleetConnected/Disconnected to support both DescriptionList and Stack layouts
  • e2e/vulnerability.cy.js: Fixed device selector "Add label" scope; fleet connection verification for both layouts; detach verification
  • All view/e2e files: Replaced hardcoded pf-v6-c-* with dual pf-v5-c-*, pf-v6-c-* selectors

Failing specs addressed

Spec Failures Root cause
vulnerability.cy.js 8 (4 root + 4 cascading hooks) Add label selector + fleet name class removed
fleet.cy.js 2 Label group selector + data-label attribute
deviceApps.cy.js 2 #fctl-applications-table timeout (product/infra — not addressed here)
device.cy.js 1 Fleet name class removed

Note: The 2 deviceApps.cy.js failures (#fctl-applications-table not found after 600s) appear to be a product/infra issue — the KVM VM app never reached Running state. This is not a selector problem.

Build Reference

https://jenkins-csb-kniqe-auto.dno.corp.redhat.com/job/Private_Folders/job/talh/job/job-runner-talh/371/

Attribution

Requested by: <@U02B10JTKDG> (thilzenr)
Channel: DM

QE CI AI Bot and others added 2 commits September 10, 2026 13:17
Root cause: flightctl-ui plugin PR #803 (Device details page redesign, Sep 9)
replaced fctl-device-details-tab__label with DescriptionListTerm, moved
"Add label" button outside LabelGroup via EditableLabelControl, and renamed
"Fleet name" label to "Fleet".

Additionally, OCP 4.20 console renders pf-v5-c-* classes while OCP 4.22
renders pf-v6-c-* classes. All PF-prefixed selectors now match both versions.

Changes:
- views/common.js: Add pfV() helper for dual PF v5/v6 selectors and
  deviceDetailsFleetRow() helper that detects new vs legacy device details layout
- views/fleetsPage.js: Fix createFleet label-group selector to use "Add label"
  button click; fix deleteFleet to use td contains instead of data-label="Name"
- views/devicesPage.js: Fix fleet name detection in runFleetLabelDetachReattachTest,
  expectDeviceDetailsFleetConnected/Disconnected to support both layouts
- e2e/vulnerability.cy.js: Fix device selector "Add label" button scope;
  fix fleet connection verification for both old and new device details layout
- views/securityPage.js: Dual PF v5/v6 selectors for cards, drawers, tables
- All view/e2e files: Replace pf-v6-c-* with dual pf-v5/pf-v6 selectors

Build: https://jenkins-csb-kniqe-auto.dno.corp.redhat.com/job/Private_Folders/job/talh/job/job-runner-talh/371/
Requested-By: <@U02B10JTKDG> (thilzenr)
Co-authored-by: Cursor <cursoragent@cursor.com>
Fixes:

1. common.js — deviceDetailsFleetRow: Wait for either layout element to
   appear before deciding which branch to take. Previously used a synchronous
   cy.get('body') check that could pick the wrong branch if the details tab
   hadn't rendered yet.

2. devicesPage.js — decommissionDevice: Break checkbox click chain to avoid
   'element detached from DOM' race when the enrolled-devices table re-renders
   from API polling. Use .check({ force: true }) on a fresh query.

3. devicesPage.js, repositoriesPage.js, buildImagePage.js — Fix CSS compound
   selector scoping in .find()/.get(). The pattern
   '[data-testid] .pf-v5-class, .pf-v6-class' leaves the PF6 alternative
   unscoped (matches anywhere in the parent element, not just inside the
   data-testid container). Fixed to scope both alternatives.

4. devicesPage.js — loginVmSerialConsole: Add .first() to all
   APP_CONSOLE_XTERM_INPUT queries. On OCP 4.22, xterm.js renders multiple
   .xterm-helper-textarea elements causing cy.click() to fail with 'subject
   contained 10 elements'.

5. securityPage.js — Handle EntitySecurityOverviewCard expandable layout on
   Device/Fleet pages. The upstream flightctl-ui now wraps VulnerabilitiesTable
   inside a collapsed CardExpandableContent. Added _expandSecurityCardIfNeeded()
   helper and severity tile sum fallback for both expectVulnerabilityCount and
   waitForVulnerabilityCountWithReload.

Build: https://jenkins-csb-kniqe-auto.dno.corp.redhat.com/job/Private_Folders/job/talh/job/flightctl-cypress-test/149/
Requested-By: <@U02B10JTKDG> (thilzenr)
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant