From 7f48635edfe35471a2053b64104c6598c1f2b529 Mon Sep 17 00:00:00 2001 From: Chandan Pinjani Date: Tue, 3 Dec 2024 16:12:11 +0530 Subject: [PATCH] Bump & fix code to work with rancher 2.10 Signed-off-by: Chandan Pinjani --- .github/workflows/ui-e2e.yaml | 6 +++--- README.md | 2 +- .../latest/e2e/unit_tests/capa_eks_cluster.spec.ts | 6 +++--- .../latest/e2e/unit_tests/capa_rke2_cluster.spec.ts | 6 +++--- .../e2e/unit_tests/capd_kubeadm_cluster.spec.ts | 4 ++-- .../latest/e2e/unit_tests/capd_rke2_cluster.spec.ts | 4 ++-- .../latest/e2e/unit_tests/capz_cluster.spec.ts | 6 +++--- .../latest/e2e/unit_tests/providers_setup.spec.ts | 10 +++++----- .../latest/e2e/unit_tests/turtles_operator.spec.ts | 2 +- tests/cypress/latest/package.json | 2 +- tests/cypress/latest/support/commands.ts | 12 ++++++------ 11 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ui-e2e.yaml b/.github/workflows/ui-e2e.yaml index 79f25bb..983592d 100644 --- a/.github/workflows/ui-e2e.yaml +++ b/.github/workflows/ui-e2e.yaml @@ -1,6 +1,6 @@ # This workflow calls the master E2E workflow with custom variables name: UI-E2E -run-name: ${{ github.event_name == 'workflow_dispatch' && format('Rancher-`{0}` - `{1}` destroy={2}', inputs.rancher_version, inputs.grep_test_by_tag, inputs.destroy_runner) || github.event_name == 'schedule' && 'UI-E2E on Rancher-latest/devel/2.9' }} +run-name: ${{ github.event_name == 'workflow_dispatch' && format('Rancher-`{0}` - `{1}` destroy={2}', inputs.rancher_version, inputs.grep_test_by_tag, inputs.destroy_runner) || github.event_name == 'schedule' && 'UI-E2E on Rancher-latest/devel/2.10' }} on: workflow_dispatch: @@ -15,7 +15,7 @@ on: type: boolean rancher_version: description: Rancher Manager channel/version/head_version to use for installation - default: latest/devel/2.9 + default: latest/devel/2.10 type: string grep_test_by_tag: description: Grep tags. For multiple selection separate with spaces. Keep always @install @@ -45,7 +45,7 @@ jobs: cluster_name: cluster-k3s destroy_runner: ${{ github.event_name == 'schedule' && true || inputs.destroy_runner }} capi_ui_version: dev - rancher_version: ${{ inputs.rancher_version || 'latest/devel/2.9' }} + rancher_version: ${{ inputs.rancher_version || 'latest/devel/2.10' }} qase_run_id: ${{ inputs.qase_run_id || 'auto' }} grep_test_by_tag: ${{ inputs.grep_test_by_tag || '@install @short' }} diff --git a/README.md b/README.md index 7d73022..63e86f9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # rancher-turtles-e2e -[![UI-E2E_head_2.9](https://github.com/rancher-sandbox/rancher-turtles-e2e/actions/workflows/ui-e2e.yaml/badge.svg?branch=main)](https://github.com/rancher-sandbox/rancher-turtles-e2e/actions/workflows/ui-e2e.yaml) +[![UI-E2E_head_2.10](https://github.com/rancher-sandbox/rancher-turtles-e2e/actions/workflows/ui-e2e.yaml/badge.svg?branch=main)](https://github.com/rancher-sandbox/rancher-turtles-e2e/actions/workflows/ui-e2e.yaml) What tests are doing: 1. Create the infra stack ( GCP runner, cert-manager, rancher ) diff --git a/tests/cypress/latest/e2e/unit_tests/capa_eks_cluster.spec.ts b/tests/cypress/latest/e2e/unit_tests/capa_eks_cluster.spec.ts index 672bd6b..1159550 100644 --- a/tests/cypress/latest/e2e/unit_tests/capa_eks_cluster.spec.ts +++ b/tests/cypress/latest/e2e/unit_tests/capa_eks_cluster.spec.ts @@ -30,18 +30,18 @@ describe('Import CAPA EKS', { tags: '@full' }, () => { // Go to Cluster Management > CAPI > Clusters and check if the cluster has started provisioning cy.checkCAPIMenu(); - cy.contains('Provisioned ' + clusterName, { timeout: timeout }); + cy.contains(new RegExp('Provisioned.*' + clusterName), { timeout: timeout }); }) ); it('Auto import child CAPA cluster', () => { // Check child cluster is created and auto-imported cy.goToHome(); - cy.contains('Pending ' + clusterName); + cy.contains(new RegExp('Pending.*' + clusterName)); // Check cluster is Active cy.clickButton('Manage'); - cy.contains('Active ' + clusterName, { timeout: 300000 }); + cy.contains(new RegExp('Active.*' + clusterName), { timeout: 300000 }); }) qase(32, diff --git a/tests/cypress/latest/e2e/unit_tests/capa_rke2_cluster.spec.ts b/tests/cypress/latest/e2e/unit_tests/capa_rke2_cluster.spec.ts index 8a9d2b6..77ecec6 100644 --- a/tests/cypress/latest/e2e/unit_tests/capa_rke2_cluster.spec.ts +++ b/tests/cypress/latest/e2e/unit_tests/capa_rke2_cluster.spec.ts @@ -30,19 +30,19 @@ describe('Import CAPA RKE2', { tags: '@full' }, () => { // Go to Cluster Management > CAPI > Clusters and check if the cluster has started provisioning cy.checkCAPIMenu(); - cy.contains('Provisioned ' + clusterName, { timeout: timeout }); + cy.contains(new RegExp('Provisioned.*' + clusterName), { timeout: timeout }); }) ); it('Auto import child CAPA cluster', () => { // Check child cluster is created and auto-imported cy.goToHome(); - cy.contains('Pending ' + clusterName) || cy.contains('Active ' + clusterName); + cy.contains(new RegExp('Pending.*' + clusterName)) || cy.contains(new RegExp('Active.*' + clusterName)); // cy.getBySel('sortable-table-list-container') // Check cluster is Active cy.clickButton('Manage'); - cy.contains('Active ' + clusterName, { timeout: 300000 }); + cy.contains(new RegExp('Active.*' + clusterName), { timeout: 300000 }); }) qase(32, diff --git a/tests/cypress/latest/e2e/unit_tests/capd_kubeadm_cluster.spec.ts b/tests/cypress/latest/e2e/unit_tests/capd_kubeadm_cluster.spec.ts index 59418e1..2b4d1d9 100644 --- a/tests/cypress/latest/e2e/unit_tests/capd_kubeadm_cluster.spec.ts +++ b/tests/cypress/latest/e2e/unit_tests/capd_kubeadm_cluster.spec.ts @@ -66,11 +66,11 @@ describe('Import CAPD Kubeadm', { tags: '@short' }, () => { it('Auto import child CAPD cluster', () => { // Check child cluster is created and auto-imported cy.goToHome(); - cy.contains('Pending ' + clusterName, { timeout: timeout }); + cy.contains(new RegExp('Pending.*' + clusterName), { timeout: timeout }); // Check cluster is Active cy.clickButton('Manage'); - cy.contains('Active ' + clusterName, { timeout: timeout }); + cy.contains(new RegExp('Active.*' + clusterName), { timeout: timeout }); // TODO: Check MachineSet unavailable status and use checkCAPIClusterActive cy.checkCAPIClusterProvisioned(clusterName); }) diff --git a/tests/cypress/latest/e2e/unit_tests/capd_rke2_cluster.spec.ts b/tests/cypress/latest/e2e/unit_tests/capd_rke2_cluster.spec.ts index 9aef29f..77be916 100644 --- a/tests/cypress/latest/e2e/unit_tests/capd_rke2_cluster.spec.ts +++ b/tests/cypress/latest/e2e/unit_tests/capd_rke2_cluster.spec.ts @@ -63,11 +63,11 @@ describe('Import CAPD RKE2', { tags: '@short' }, () => { it('Auto import child CAPD cluster', () => { // Check child cluster is created and auto-imported cy.goToHome(); - cy.contains('Pending ' + clusterName, { timeout: timeout }); + cy.contains(new RegExp('Pending.*' + clusterName), { timeout: timeout }); // Check cluster is Active cy.clickButton('Manage'); - cy.contains('Active ' + clusterName, { timeout: timeout }); + cy.contains(new RegExp('Active.*' + clusterName), { timeout: timeout }); // TODO: Check MachineSet unavailable status and use checkCAPIClusterActive cy.checkCAPIClusterProvisioned(clusterName); }) diff --git a/tests/cypress/latest/e2e/unit_tests/capz_cluster.spec.ts b/tests/cypress/latest/e2e/unit_tests/capz_cluster.spec.ts index c9426b2..030df4b 100644 --- a/tests/cypress/latest/e2e/unit_tests/capz_cluster.spec.ts +++ b/tests/cypress/latest/e2e/unit_tests/capz_cluster.spec.ts @@ -84,18 +84,18 @@ describe('Import CAPZ', { tags: '@full' }, () => { // Go to Cluster Management > CAPI > Clusters and check if the cluster has started provisioning cypressLib.burgerMenuToggle(); cy.checkCAPIMenu(); - cy.contains('Provisioned ' + clusterName, { timeout: timeout }); + cy.contains(new RegExp('Provisioned.*' + clusterName), { timeout: timeout }); }) ); qase(22, it('Auto import child CAPZ cluster', () => { // Check child cluster is created and auto-imported cy.goToHome(); - cy.contains('Pending ' + clusterName); + cy.contains(new RegExp('Pending.*' + clusterName)); // Check cluster is Active cy.clickButton('Manage'); - cy.contains('Active ' + clusterName, { timeout: 300000 }); + cy.contains(new RegExp('Active.*' + clusterName), { timeout: 300000 }); }) ); qase(23, it('Install App on imported cluster', { retries: 1 }, () => { diff --git a/tests/cypress/latest/e2e/unit_tests/providers_setup.spec.ts b/tests/cypress/latest/e2e/unit_tests/providers_setup.spec.ts index 19bbb9a..127940d 100644 --- a/tests/cypress/latest/e2e/unit_tests/providers_setup.spec.ts +++ b/tests/cypress/latest/e2e/unit_tests/providers_setup.spec.ts @@ -66,7 +66,7 @@ describe('Enable CAPI Providers', () => { // Create Docker Infrastructure provider cy.addInfraProvider('Docker', dockerProvider, 'capd-system'); var statusReady = 'Ready' - statusReady = statusReady.concat(' ', dockerProvider, ' infrastructure ', dockerProvider, ' ', kubeadmProviderVersion) + statusReady = statusReady.concat(dockerProvider, 'infrastructure', dockerProvider, kubeadmProviderVersion) cy.contains(statusReady); }) ); @@ -89,7 +89,7 @@ describe('Enable CAPI Providers', () => { cy.checkCAPIMenu(); cy.contains('Providers').click(); var statusReady = 'Ready' - statusReady = statusReady.concat(' ', fleetProvider, ' addon ', fleetProvider, ' ', 'v0.4.0') + statusReady = statusReady.concat(fleetProvider, 'addon', fleetProvider, 'v0.4.0') cy.contains(statusReady).scrollIntoView(); }); }); @@ -102,7 +102,7 @@ describe('Enable CAPI Providers', () => { cypressLib.burgerMenuToggle(); cy.addInfraProvider('Amazon', amazonProvider, 'capa-system', amazonProvider); var statusReady = 'Ready' - statusReady = statusReady.concat(' ', amazonProvider, ' infrastructure ', amazonProvider, ' ', 'v2.6.1') + statusReady = statusReady.concat(amazonProvider, 'infrastructure', amazonProvider, 'v2.6.1') cy.contains(statusReady); }) ); @@ -114,7 +114,7 @@ describe('Enable CAPI Providers', () => { cypressLib.burgerMenuToggle(); cy.addInfraProvider('Google', googleProvider, 'capg-system', googleProvider); var statusReady = 'Ready' - statusReady = statusReady.concat(' ', googleProvider, ' infrastructure ', googleProvider, ' ', 'v1.8.0') + statusReady = statusReady.concat(googleProvider, 'infrastructure', googleProvider, 'v1.8.0') cy.contains(statusReady, { timeout: 120000 }); }) ); @@ -125,7 +125,7 @@ describe('Enable CAPI Providers', () => { cypressLib.burgerMenuToggle(); cy.addInfraProvider('Azure', azureProvider, 'capz-system', azureProvider); var statusReady = 'Ready' - statusReady = statusReady.concat(' ', azureProvider, ' infrastructure ', azureProvider) + statusReady = statusReady.concat(azureProvider, 'infrastructure', azureProvider) cy.contains(statusReady, { timeout: 180000 }); }) ); diff --git a/tests/cypress/latest/e2e/unit_tests/turtles_operator.spec.ts b/tests/cypress/latest/e2e/unit_tests/turtles_operator.spec.ts index dd0abc1..bf4e933 100644 --- a/tests/cypress/latest/e2e/unit_tests/turtles_operator.spec.ts +++ b/tests/cypress/latest/e2e/unit_tests/turtles_operator.spec.ts @@ -67,7 +67,7 @@ describe('Install Turtles Operator', { tags: '@install' }, () => { cy.byLabel('Arguments').as('label') cy.get('@label').type(' --insecure-skip-verify=true') cy.clickButton('Save'); - cy.contains('Active' + ' ' + deployment); + cy.contains(new RegExp('Active.*' + deployment)); cy.namespaceReset(); }) diff --git a/tests/cypress/latest/package.json b/tests/cypress/latest/package.json index c39856a..f997c28 100644 --- a/tests/cypress/latest/package.json +++ b/tests/cypress/latest/package.json @@ -22,7 +22,7 @@ "homepage": "https://github.com/rancher/rancher-turtles-e2e", "dependencies": { "@cypress/grep": "^4.1.0", - "@rancher-ecp-qa/cypress-library": "1.1.0", + "@rancher-ecp-qa/cypress-library": "1.2.2", "cy-verify-downloads": "^0.1.8", "cypress": "^13.6.4", "cypress-dark": "^1.8.3", diff --git a/tests/cypress/latest/support/commands.ts b/tests/cypress/latest/support/commands.ts index 67aebc9..1baa2c8 100644 --- a/tests/cypress/latest/support/commands.ts +++ b/tests/cypress/latest/support/commands.ts @@ -61,7 +61,7 @@ Cypress.Commands.add('createNamespace', (namespace) => { cy.contains('Create Namespace').click(); cy.typeValue('Name', namespace); cy.clickButton('Create'); - cy.contains('Active' + ' ' + namespace); + cy.contains(new RegExp('Active.*' + namespace)); cy.namespaceReset(); }); @@ -81,17 +81,17 @@ Cypress.Commands.add('namespaceReset', () => { // Command to check CAPI cluster Active status Cypress.Commands.add('checkCAPIClusterActive', (clusterName) => { cy.checkCAPIMenu(); - cy.contains('Provisioned ' + clusterName, { timeout: 90000 }); + cy.contains(new RegExp('Provisioned.*' + clusterName), { timeout: 90000 }); cy.contains('Machine Deployments').click(); - cy.contains('Running ' + clusterName, { timeout: 90000 }); + cy.contains(new RegExp('Running.*' + clusterName), { timeout: 90000 }); cy.contains('Machine Sets').click(); - cy.contains('Active ' + clusterName, { timeout: 90000 }); + cy.contains(new RegExp('Active.*' + clusterName), { timeout: 90000 }); }); // Command to check CAPI cluster Provisioned status Cypress.Commands.add('checkCAPIClusterProvisioned', (clusterName) => { cy.checkCAPIMenu(); - cy.contains('Provisioned ' + clusterName, { timeout: 90000 }); + cy.contains(new RegExp('Provisioned.*' + clusterName), { timeout: 90000 }); }); // Command to check CAPI cluster deletion status @@ -411,7 +411,7 @@ Cypress.Commands.add('checkFleetGitRepo', (repoName, workspace) => { if (!workspace) { workspace = 'fleet-local'; } - cy.contains(workspace).should('be.visible').click(); + cy.contains(workspace).click(); // Click the repo link cy.contains(repoName).click(); cy.url().should("include", "fleet/fleet.cattle.io.gitrepo/" + workspace + "/" + repoName)