diff --git a/tests/cypress/latest/plugins/index.ts b/tests/cypress/latest/plugins/index.ts index 9d2fbe759..a21a05ece 100644 --- a/tests/cypress/latest/plugins/index.ts +++ b/tests/cypress/latest/plugins/index.ts @@ -44,6 +44,7 @@ module.exports = (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions) config.env.proxy_ip = process.env.PROXY_IP; config.env.proxy = process.env.PROXY; config.env.rancher_version = process.env.RANCHER_VERSION; + config.env.stable_os_version = process.env.STABLE_OS_VERSION; config.env.ui_account = process.env.UI_ACCOUNT; config.env.upgrade_from_version = process.env.UPGRADE_FROM_VERSION; config.env.upgrade_image = process.env.UPGRADE_IMAGE; diff --git a/tests/cypress/latest/support/commands.ts b/tests/cypress/latest/support/commands.ts index c677141b8..19db3061e 100644 --- a/tests/cypress/latest/support/commands.ts +++ b/tests/cypress/latest/support/commands.ts @@ -108,8 +108,8 @@ Cypress.Commands.add('createMachReg', ( cy.contains(Cypress.env('os_version_install')) .click(); } else { - cy.contains('ISO v2.0.2') - .click(); + cy.contains(new RegExp('ISO.*'+ Cypress.env('stable_os_version'))) + .click(); } } else if (utils.isOperatorVersion('registry.suse.com') || utils.isOperatorVersion('marketplace')) { cy.contains(Cypress.env('os_version_install')) diff --git a/tests/scripts/start-cypress-tests b/tests/scripts/start-cypress-tests index 76975b3c8..1d1180b5e 100755 --- a/tests/scripts/start-cypress-tests +++ b/tests/scripts/start-cypress-tests @@ -18,6 +18,19 @@ npm install # Check if we have to report to QASE [[ -n $QASE_RUN_ID ]] && QASE_REPORT=1 +# Install yq for parsing yaml files +# TODO: yq will be added into the next OS image +sudo zypper in -y yq + +# Get latest stable Elemental OS version mainly for upgrade test +OS_IMAGE=$(helm template oci://registry.suse.com/rancher/elemental-operator-chart \ + | yq 'select(.kind=="ManagedOSVersionChannel") .spec.options.image') + +STABLE_OS_VERSION=$(docker run --entrypoint busybox ${OS_IMAGE} cat channel.json \ + | jq -r '.[].spec.version' \ + | sort -V \ + | tail -1) + # Start Cypress tests with docker docker run -v $PWD:/workdir -w /workdir \ -e BOOT_TYPE=$BOOT_TYPE \ @@ -38,6 +51,7 @@ docker run -v $PWD:/workdir -w /workdir \ -e RANCHER_PASSWORD=$RANCHER_PASSWORD \ -e RANCHER_URL=$RANCHER_URL \ -e RANCHER_USER=$RANCHER_USER \ + -e STABLE_OS_VERSION=$STABLE_OS_VERSION \ -e UI_ACCOUNT=$UI_ACCOUNT \ -e UPGRADE_FROM_VERSION=$UPGRADE_FROM_VERSION \ -e UPGRADE_IMAGE=$UPGRADE_IMAGE \