Skip to content

Commit 4b5bffc

Browse files
committed
fix(ui-tests): update selectors for OCP 4.20 PatternFly v6
- external link: .pf-v6-c-clipboard-copy a.pf-m-link - dropdown menu: .pf-v6-c-menu button - add oc version logging
1 parent a649013 commit 4b5bffc

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

test/ui-e2e-tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export OCP_VERSION OCP_USERNAME OCP_PASSWORD OCP_LOGIN_PROVIDER CYPRESS_BASE_URL
8080
add_user "$OCP_USERNAME" "$OCP_PASSWORD"
8181

8282
check_node
83+
logger.info "OCP version: $OCP_VERSION"
84+
oc version
8385
enable_dev_perspective
8486
logger.success '🚀 Cluster prepared for testing.'
8587

test/ui/cypress/code/knative/serving/showcase.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@ class ShowcaseKservice {
3737
.should('have.attr', 'value')
3838
.and('include', 'showcase')
3939
}
40-
let selector = '.co-external-link--block a'
40+
41+
// OCP 4.20+ uses ExternalLinkWithCopy inside clipboard-copy component
42+
let selector = '.pf-v6-c-clipboard-copy a.pf-m-link'
43+
44+
// OCP 4.19 and earlier use co-external-link--block
45+
if (environment.ocpVersion().satisfies('<4.20')) {
46+
selector = '.co-external-link--block a'
47+
}
48+
4149
return cy.get(selector)
4250
.last()
4351
.scrollIntoView()

test/ui/cypress/e2e/serving/multiple-revisions.cy.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,21 @@ describe('OCP UI for Serverless Serving', () => {
4343
cy.get('input[name="trafficSplitting.1.tag"]')
4444
.type('v1')
4545
cy.contains('Select a Revision', {matchCase: false}).click()
46-
let selector = `.pf-v6-c-dropdown.pf-m-expanded .pf-v6-c-menu button`
47-
if (environment.ocpVersion().satisfies('<=4.18')) {
46+
47+
// OCP 4.20+ uses PatternFly v6 with new dropdown structure
48+
let selector = `.pf-v6-c-menu button`
49+
50+
// OCP 4.15-4.19 uses PatternFly v5
51+
if (environment.ocpVersion().satisfies('<=4.19')) {
4852
selector = `ul.pf-v5-c-dropdown__menu button`
4953
}
54+
55+
// OCP 4.14 and earlier uses PatternFly v4
5056
if (environment.ocpVersion().satisfies('<=4.14')) {
5157
selector = `ul.pf-c-dropdown__menu button`
5258
}
53-
cy.get(selector).click()
59+
60+
cy.get(selector).first().click()
5461
cy.get('button[type=submit]').click()
5562

5663
cy.log('Verify traffic is routed to both v1 and v2')

0 commit comments

Comments
 (0)