diff --git a/.github/workflows/master-e2e.yaml b/.github/workflows/master-e2e.yaml index 5a840c8..b2ac842 100644 --- a/.github/workflows/master-e2e.yaml +++ b/.github/workflows/master-e2e.yaml @@ -102,6 +102,9 @@ on: required: true type: string default: '@install @short @full' + turtles_operator_version: + description: Turtles Operator Version; only to be used when nightly chart is set to false; default - latest stable version + type: string jobs: create-runner: @@ -328,6 +331,7 @@ jobs: AZURE_LOCATION: ${{ secrets.AZURE_LOCATION }} QASE_RUN_ID: ${{ needs.pre-qase.outputs.qase_run_id }} GREPTAGS: ${{ inputs.grep_test_by_tag }} + TURTLES_OPERATOR_VERSION: ${{inputs.turtles_operator_version}} SPEC: | e2e/unit_tests/first_connection.spec.ts e2e/unit_tests/user.spec.ts @@ -386,6 +390,7 @@ jobs: if ${{ inputs.ui_account != '' }}; then echo "UI User: ${{ inputs.ui_account }}" >> ${GITHUB_STEP_SUMMARY} fi + echo "Rancher Turtles Operator Version: ${{ inputs.turtles_operator_version }}" >> ${GITHUB_STEP_SUMMARY} echo "### Kubernetes" >> ${GITHUB_STEP_SUMMARY} echo "K3s on Rancher Manager: ${{ env.INSTALL_K3S_VERSION }}" >> ${GITHUB_STEP_SUMMARY} diff --git a/.github/workflows/ui-e2e.yaml b/.github/workflows/ui-e2e.yaml index b497922..b28d9d4 100644 --- a/.github/workflows/ui-e2e.yaml +++ b/.github/workflows/ui-e2e.yaml @@ -17,6 +17,9 @@ on: description: Rancher Manager channel/version/head_version to use for installation default: latest/devel/2.10 type: string + turtles_operator_version: + description: Rancher Turtles operator version to test + type: string grep_test_by_tag: description: Grep tags. For multiple selection separate with spaces. Keep always @install required: true @@ -53,4 +56,5 @@ jobs: qase_run_id: ${{ inputs.qase_run_id || 'auto' }} grep_test_by_tag: ${{ inputs.grep_test_by_tag || '@install @short' }} operator_nightly_chart: ${{ inputs.operator_nightly_chart == true || (github.event_name == 'schedule' && true) }} + turtles_operator_version: ${{ inputs.turtles_operator_version }} 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 cdedef3..86ec022 100644 --- a/tests/cypress/latest/e2e/unit_tests/turtles_operator.spec.ts +++ b/tests/cypress/latest/e2e/unit_tests/turtles_operator.spec.ts @@ -26,6 +26,20 @@ describe('Install Turtles Operator', { tags: '@install' }, () => { cypressLib.burgerMenuToggle(); }); + it("Change helm charts to Include Prerelease Versions", () => { + // this test should be run before the turtles repository is added; so that it can fetch the prereleased versions + + // toggle the navigation menu to a close + cypressLib.burgerMenuToggle(); + + cy.getBySel('nav_header_showUserMenu').click(); + cy.contains('Preferences').click(); + cy.contains("Include Prerelease Versions").click(); + cy.reload(); + // check that the prerelease version is selected by ensuring it does not have `bg-disabled` class + cy.contains("Include Prerelease Versions").should('not.have.class', 'bg-disabled'); + }) + it('Add turtles repo', { retries: 2 }, () => { var turtlesHelmRepo = Cypress.env('chartmuseum_repo') // if the env var is empty or not defined at all; use the normal repo @@ -45,7 +59,16 @@ describe('Install Turtles Operator', { tags: '@install' }, () => { const questions = [ { menuEntry: 'Rancher Turtles Features Settings', checkbox: 'Seamless integration with Fleet and CAPI' } ]; - cy.installApp('Rancher Turtles', 'rancher-turtles-system', questions); + + var turtlesVersion = Cypress.env('turtles_operator_version') + + // if operator nightly chart is to be used, ignore the turtles version + var turtlesHelmRepo = Cypress.env('chartmuseum_repo') + if (turtlesHelmRepo != "" && turtlesHelmRepo != undefined) { + turtlesVersion = "" + } + + cy.installApp('Rancher Turtles', turtlesVersion, 'rancher-turtles-system', questions); }) ); diff --git a/tests/cypress/latest/plugins/index.ts b/tests/cypress/latest/plugins/index.ts index 30c8991..894a1f7 100644 --- a/tests/cypress/latest/plugins/index.ts +++ b/tests/cypress/latest/plugins/index.ts @@ -32,6 +32,7 @@ module.exports = (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) config.baseUrl = url.replace(/\/$/,); config.env.cache_session = process.env.CACHE_SESSION || false; config.env.chartmuseum_repo = process.env.CHARTMUSEUM_REPO; + config.env.turtles_operator_version = process.env.TURTLES_OPERATOR_VERSION; config.env.cluster = process.env.CLUSTER_NAME; config.env.capi_ui_version = process.env.CAPI_UI_VERSION; config.env.k8s_version = process.env.K8S_VERSION_TO_PROVISION; diff --git a/tests/cypress/latest/support/commands.ts b/tests/cypress/latest/support/commands.ts index 1897725..ff89197 100644 --- a/tests/cypress/latest/support/commands.ts +++ b/tests/cypress/latest/support/commands.ts @@ -221,11 +221,16 @@ Cypress.Commands.add('addCloudCredsAzure', (name: string, clientID: string, clie // 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, questions) => { +Cypress.Commands.add('installApp', (appName, version, namespace, questions) => { cy.get('.nav').contains('Apps').click(); cy.contains('Featured Charts').should('be.visible'); cy.contains(appName, { timeout: 60000 }).click(); cy.contains('Charts: ' + appName); + + if (version != undefined && version != "") { + cy.contains(version).click(); + cy.url().should("contain", version) + } cy.clickButton('Install'); cy.contains('.outer-container > .header', appName); cy.clickButton('Next'); diff --git a/tests/cypress/latest/support/e2e.ts b/tests/cypress/latest/support/e2e.ts index 6e81321..94930a7 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, questions?: any): Chainable; + installApp(appName: string, namespace: string, version: string, questions?: any): Chainable; deleteCluster(clusterName: string): Chainable; searchCluster(clusterName: string): Chainable; createNamespace(namespace: string): Chainable; diff --git a/tests/scripts/start-cypress-tests b/tests/scripts/start-cypress-tests index 9e92f4a..2fc3ef8 100755 --- a/tests/scripts/start-cypress-tests +++ b/tests/scripts/start-cypress-tests @@ -21,6 +21,7 @@ docker run -v $PWD:/workdir -w /workdir \ -e CYPRESS_TAGS=$CYPRESS_TAGS \ -e CAPI_UI_VERSION=$CAPI_UI_VERSION \ -e CHARTMUSEUM_REPO=$CHARTMUSEUM_REPO \ + -e TURTLES_OPERATOR_VERSION=$TURTLES_OPERATOR_VERSION \ -e K8S_UPSTREAM_VERSION=$K8S_UPSTREAM_VERSION \ -e OPERATOR_REPO=$OPERATOR_REPO \ -e RANCHER_VERSION=$RANCHER_VERSION \