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 d11794d1..fbc15eb0 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 @@ -50,7 +50,7 @@ describe('Import CAPA EKS', { tags: '@full' }, () => { cy.contains(clusterName).click(); // Install App - cy.installApp('Monitoring', 'cattle-monitoring'); + cy.checkApp('Install', 'Monitoring', 'cattle-monitoring'); }) ); 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 1ac4ab48..85512e21 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 @@ -51,7 +51,7 @@ describe('Import CAPA RKE2', { tags: '@full' }, () => { cy.contains(clusterName).click(); // Install App - cy.installApp('Monitoring', 'cattle-monitoring'); + cy.checkApp('Install', 'Monitoring', 'cattle-monitoring'); }) ); 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 a49c4756..de32bc0c 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 @@ -83,7 +83,7 @@ describe('Import CAPD Kubeadm', { tags: '@short' }, () => { // Click on imported CAPD cluster cy.contains(clusterName).click(); // Install App - cy.installApp('Monitoring', 'cattle-monitoring'); + cy.checkApp('Install', 'Monitoring', 'cattle-monitoring'); }) ); 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 910b7428..9f3553a3 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 @@ -26,6 +26,7 @@ describe('Import CAPD RKE2', { tags: '@short' }, () => { const basePath = '/tests/assets/rancher-turtles-fleet-example/' const pathNames = ['rke2_namespace_autoimport', 'rke2_clusterclass_autoimport'] const branch = 'main' + const questions = [{ menuEntry: 'Rancher Turtles Features Settings', inputBoxTitle: 'Kubectl Image', inputBoxValue: 'registry.k8s.io/kubernetes/kubectl:v1.31.0' }]; beforeEach(() => { cy.login(); @@ -81,7 +82,7 @@ describe('Import CAPD RKE2', { tags: '@short' }, () => { cy.contains(clusterName).click(); // Install App - cy.installApp('Monitoring', 'cattle-monitoring'); + cy.checkApp('Install', 'Monitoring', 'cattle-monitoring'); }) ); @@ -107,6 +108,17 @@ describe('Import CAPD RKE2', { tags: '@short' }, () => { cy.checkCAPIClusterProvisioned(clusterName); }) ); + + qase(41, + it('Update chart and check cluster status', () => { + cy.contains('local').click(); + cy.checkApp('Update', 'Rancher Turtles', 'rancher-turtles-system', '', questions); + + // Check cluster is Active + cy.searchCluster(clusterName); + cy.contains(new RegExp('Active.*' + clusterName), { timeout: timeout }); + }) + ); } qase(9, diff --git a/tests/cypress/latest/e2e/unit_tests/capg_cluster.spec.ts b/tests/cypress/latest/e2e/unit_tests/capg_cluster.spec.ts index ea2a1c4b..cfa240d3 100644 --- a/tests/cypress/latest/e2e/unit_tests/capg_cluster.spec.ts +++ b/tests/cypress/latest/e2e/unit_tests/capg_cluster.spec.ts @@ -52,7 +52,7 @@ describe('Import CAPG GKE', { tags: '@full' }, () => { cy.contains(clusterName).click(); // Install App - cy.installApp('Monitoring', 'cattle-monitoring'); + cy.checkApp('Install', 'Monitoring', 'cattle-monitoring'); }) ); 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 de6bf753..090a0f2d 100644 --- a/tests/cypress/latest/e2e/unit_tests/capz_cluster.spec.ts +++ b/tests/cypress/latest/e2e/unit_tests/capz_cluster.spec.ts @@ -103,7 +103,7 @@ describe('Import CAPZ', { tags: '@full' }, () => { cy.contains(clusterName).click(); // Install App - cy.installApp('Monitoring', 'cattle-monitoring'); + cy.checkApp('Install', 'Monitoring', 'cattle-monitoring'); }) ); 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 b9c80f5b..2f474b3a 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' }, () => { turtlesVersion = "" } - cy.installApp('Rancher Turtles', 'rancher-turtles-system', turtlesVersion, questions); + cy.checkApp('Install', 'Rancher Turtles', 'rancher-turtles-system', turtlesVersion, questions); }) ); }); diff --git a/tests/cypress/latest/support/commands.ts b/tests/cypress/latest/support/commands.ts index 6dc0bfc6..d5428890 100644 --- a/tests/cypress/latest/support/commands.ts +++ b/tests/cypress/latest/support/commands.ts @@ -217,29 +217,33 @@ Cypress.Commands.add('addCloudCredsAzure', (name: string, clientID: string, clie cy.contains(name).should('be.visible'); }); -// Command to Install App from Charts menu +// Command to Install or Update App from Charts menu +// Opration types: Install, Update // You can optionally provide an array of questions and answer them before the installation starts -// Example1: cy.installApp('Alerting', 'default', [{ menuEntry: '(None)', checkbox: 'Enable Microsoft Teams' }]); -// Example2: cy.installApp('Rancher Turtles', 'rancher-turtles-system', [{ menuEntry: 'Rancher Turtles Features Settings', checkbox: 'Seamless integration with Fleet and CAPI'},{ menuEntry: 'Rancher webhook cleanup settings', inputBoxTitle: 'Webhook Cleanup Image', inputBoxValue: 'registry.k8s.io/kubernetes/kubectl:v1.28.0'}]); -Cypress.Commands.add('installApp', (appName, namespace, version, questions) => { +// Example1: cy.checkApp('Alerting', 'default', [{ menuEntry: '(None)', checkbox: 'Enable Microsoft Teams' }]); +// Example2: cy.checkApp('Rancher Turtles', 'rancher-turtles-system', [{ menuEntry: 'Rancher Turtles Features Settings', checkbox: 'Seamless integration with Fleet and CAPI'},{ menuEntry: 'Rancher webhook cleanup settings', inputBoxTitle: 'Webhook Cleanup Image', inputBoxValue: 'registry.k8s.io/kubernetes/kubectl:v1.28.0'}]); +Cypress.Commands.add('checkApp', (operation, chartName, namespace, version, questions) => { cy.get('.nav').contains('Apps').click(); cy.contains('Featured Charts').should('be.visible'); - cy.contains(appName, { timeout: 60000 }).click(); - cy.contains('Charts: ' + appName); + cy.contains(chartName, { timeout: 60000 }).click(); + cy.contains('Charts: ' + chartName); if (version != undefined && version != "") { cy.contains(version).click(); cy.url().should("contain", version) } - cy.clickButton('Install'); - cy.contains('.outer-container > .header', appName); + cy.clickButton(operation); + // During update, chart name changes to App name + if (operation == "Install") { + cy.contains('.outer-container > .header', chartName); + } cy.clickButton('Next'); // Used for entering questions and answering them if (questions != undefined) { // Some apps like Alerting show questions page directly so no further action needed here // Some other apps like Turtles have a 'Customize install settings' checkbox or its variant which needs to be clicked - if (appName == 'Rancher Turtles') { + if (chartName == 'Rancher Turtles' && operation == "Install") { cy.contains('Customize install settings').should('be.visible').click(); } @@ -254,7 +258,7 @@ Cypress.Commands.add('installApp', (appName, namespace, version, questions) => { }); } - cy.clickButton('Install'); + cy.clickButton(operation); // Close the shell to avoid conflict cy.get('.closer').click(); diff --git a/tests/cypress/latest/support/e2e.ts b/tests/cypress/latest/support/e2e.ts index 94930a72..42cc12de 100644 --- a/tests/cypress/latest/support/e2e.ts +++ b/tests/cypress/latest/support/e2e.ts @@ -26,7 +26,7 @@ declare global { forceUpdateFleetGitRepo(repoName: string, workspace?: string): Chainable; checkFleetGitRepo(repoName: string, workspace?: string): Chainable; accesMenuSelection(firstAccessMenu: string, secondAccessMenu?: string): Chainable; - installApp(appName: string, namespace: string, version: string, questions?: any): Chainable; + checkApp(operation: string, chartName: string, namespace: string, version?: string, questions?: any): Chainable; deleteCluster(clusterName: string): Chainable; searchCluster(clusterName: string): Chainable; createNamespace(namespace: string): Chainable;