From c3500f7314a8e76c0e1dcf482b8e88b50c40e321 Mon Sep 17 00:00:00 2001 From: cyril-ui-developer Date: Tue, 4 Aug 2026 11:32:11 -0400 Subject: [PATCH] OCPBUGS-100307: Re-enable Knative Cypress e2e tests Manual backport of #16889 for release-4.19. Package path is integration-tests-cypress (not integration-tests). Re-enable knative Cypress suites and harden perspective-switcher waits in initAdmin/nav. Co-Authored-By: Claude Opus 4.5 --- frontend/integration-tests/test-cypress.sh | 4 ++-- .../support/admin.ts | 7 ++++++ .../integration-tests-cypress/views/nav.ts | 24 +++++++++---------- test-prow-e2e.sh | 5 ++-- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/frontend/integration-tests/test-cypress.sh b/frontend/integration-tests/test-cypress.sh index cc4bbcc7565..0835a732978 100755 --- a/frontend/integration-tests/test-cypress.sh +++ b/frontend/integration-tests/test-cypress.sh @@ -83,7 +83,7 @@ if [ -n "${nightly-}" ] && [ -z "${pkg-}" ]; then # yarn run test-cypress-shipwright-nightly yarn run test-cypress-pipelines-nightly yarn run test-cypress-topology-nightly - # yarn run test-cypress-knative-nightly + yarn run test-cypress-knative-nightly yarn run test-cypress-webterminal-nightly exit $err; @@ -95,7 +95,7 @@ if [ -n "${headless-}" ] && [ -z "${pkg-}" ]; then yarn run test-cypress-olm-headless yarn run test-cypress-webterminal-headless yarn run test-cypress-helm-headless - # yarn run test-cypress-knative-headless + yarn run test-cypress-knative-headless yarn run test-cypress-topology-headless yarn run test-cypress-pipelines-headless # yarn run test-cypress-shipwright-headless diff --git a/frontend/packages/integration-tests-cypress/support/admin.ts b/frontend/packages/integration-tests-cypress/support/admin.ts index 304367ca2dc..e6e84cf2978 100644 --- a/frontend/packages/integration-tests-cypress/support/admin.ts +++ b/frontend/packages/integration-tests-cypress/support/admin.ts @@ -16,6 +16,10 @@ Cypress.Commands.add('initAdmin', () => { cy.log('redirect to home'); cy.visit('/'); cy.byTestID('loading-indicator').should('not.exist'); + cy.document().its('readyState').should('eq', 'complete'); + // Wait for perspective switcher to be rendered - this requires React to finish + // loading the NavHeader component and the perspective extensions + cy.byLegacyTestID('perspective-switcher-toggle', { timeout: 60000 }).should('be.visible'); cy.log('ensure perspective switcher is set to Administrator'); nav.sidenav.switcher.changePerspectiveTo('Administrator'); nav.sidenav.switcher.shouldHaveText('Administrator'); @@ -27,6 +31,9 @@ Cypress.Commands.add('initDeveloper', () => { cy.visit('/add'); cy.byTestID('loading-indicator').should('not.exist'); cy.document().its('readyState').should('eq', 'complete'); + // Wait for perspective switcher to be rendered - this requires React to finish + // loading the NavHeader component and the perspective extensions + cy.byLegacyTestID('perspective-switcher-toggle', { timeout: 60000 }).should('be.visible'); cy.log('ensure perspective switcher is set to Developer'); guidedTour.close(); nav.sidenav.switcher.changePerspectiveTo('Developer'); diff --git a/frontend/packages/integration-tests-cypress/views/nav.ts b/frontend/packages/integration-tests-cypress/views/nav.ts index 62b966df9b0..9b9cdeb368c 100644 --- a/frontend/packages/integration-tests-cypress/views/nav.ts +++ b/frontend/packages/integration-tests-cypress/views/nav.ts @@ -38,11 +38,11 @@ export const nav = { .scrollIntoView() .contains(newPerspective); } else { - cy.byLegacyTestID('perspective-switcher-toggle') - .click() - .byLegacyTestID('perspective-switcher-menu-option') + cy.byLegacyTestID('perspective-switcher-toggle').click(); + cy.byLegacyTestID('perspective-switcher-menu-option', { timeout: 10000 }) + .should('be.visible') .contains(newPerspective) - .click({ force: true }); + .click(); } }); break; @@ -60,20 +60,20 @@ export const nav = { .contains(newPerspective); } else { checkDeveloperPerspective(); - cy.byLegacyTestID('perspective-switcher-toggle') - .click() - .byLegacyTestID('perspective-switcher-menu-option') + cy.byLegacyTestID('perspective-switcher-toggle').click(); + cy.byLegacyTestID('perspective-switcher-menu-option', { timeout: 10000 }) + .should('be.visible') .contains(newPerspective) - .click({ force: true }); + .click(); } }); break; default: - cy.byLegacyTestID('perspective-switcher-toggle') - .click() - .byLegacyTestID('perspective-switcher-menu-option') + cy.byLegacyTestID('perspective-switcher-toggle').click(); + cy.byLegacyTestID('perspective-switcher-menu-option', { timeout: 10000 }) + .should('be.visible') .contains(newPerspective) - .click({ force: true }); + .click(); } }, }, diff --git a/test-prow-e2e.sh b/test-prow-e2e.sh index 9d542447295..bb9f159e139 100755 --- a/test-prow-e2e.sh +++ b/test-prow-e2e.sh @@ -34,9 +34,8 @@ elif [ "$SCENARIO" == "pipelines" ]; then ./integration-tests/test-cypress.sh -p pipelines -h true # elif [ "$SCENARIO" == "gitops" ]; then # ./integration-tests/test-cypress.sh -p gitops -h true -# Disabled: knative-ci.feature failing in CI (OCPBUGS-99226) -# elif [ "$SCENARIO" == "knative" ]; then -# ./integration-tests/test-cypress.sh -p knative -h true +elif [ "$SCENARIO" == "knative" ]; then + ./integration-tests/test-cypress.sh -p knative -h true fi env NO_SANDBOX=true yarn test-puppeteer-csp