Skip to content

Commit

Permalink
ci/ui: fix how staging is tagged in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
juadk committed Sep 1, 2023
1 parent 29df3b4 commit 6bbe084
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions .github/workflows/master-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ jobs:
/workdir/e2e/unit_tests/machine_registration.spec.ts
/workdir/e2e/unit_tests/advanced_filtering.spec.ts
UI_ACCOUNT: ${{ inputs.ui_account }}
UPGRADE_OS_CHANNEL: ${{ inputs.upgrade_os_channel }}
run: cd tests && make start-cypress-tests
- name: Upload Cypress screenshots (Basics)
if: failure() && inputs.test_type == 'ui'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ describe('Machine registration testing', () => {
// In upgrade scenario, we need to add extra channels
if (utils.isCypressTag('upgrade')) {
if (utils.isOperatorVersion('stable')) {
cy.addOsVersionChannel('dev');
cy.addOsVersionChannel('staging');
utils.isUpgradeOsChannel('dev') ? cy.addOsVersionChannel('dev') : cy.addOsVersionChannel('staging');
} else if (utils.isOperatorVersion('staging')) {
cy.addOsVersionChannel('dev');
cy.addOsVersionChannel('stable'); // Not sure it is needed
} else {
cy.addOsVersionChannel('stable');
}
Expand Down
19 changes: 5 additions & 14 deletions tests/cypress/latest/e2e/unit_tests/upgrade.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ describe('Upgrade tests', () => {
const uiAccount = Cypress.env('ui_account');
const uiPassword = "rancherpassword"
const upgradeImage = Cypress.env('upgrade_image')
const upgradeOsChannel = Cypress.env('upgrade_os_channel')

beforeEach(() => {
(uiAccount == "user") ? cy.login(elementalUser, uiPassword) : cy.login();
Expand Down Expand Up @@ -84,19 +83,11 @@ describe('Upgrade tests', () => {
.click();
cy.getBySel('os-version-box')
.click()
// TODO: remove hardcoded staging version
if (upgradeOsChannel == "staging") {
cy.getBySel('os-version-box')
.parents()
.contains('v1.2.1')
.click();
} else {
cy.getBySel('os-version-box')
.parents()
.contains('latest-'+upgradeOsChannel)
.click();
}
}
cy.getBySel('os-version-box')
.parents()
.contains('latest')
.click();
}

cy.getBySel('form-save')
.contains('Create')
Expand Down
10 changes: 8 additions & 2 deletions tests/cypress/latest/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,18 @@ Cypress.Commands.add('createMachReg', (
if (utils.isCypressTag('upgrade')) {
// Stable operator version is hardcoded for now
// Will try to improve it in next version
utils.isOperatorVersion('staging') ? cy.contains('Elemental Teal ISO x86_64 latest-staging').click() : cy.contains('Elemental Teal ISO x86_64 v1.1.5').click();
if (utils.isOperatorVersion('staging')) {
// In rare case, we might want to test upgrading from staging to dev
utils.isUpgradeOsChannel('dev') ? cy.contains('Elemental Teal ISO x86_64 (latest)').click(): null;
} else {
cy.contains('Elemental Teal ISO x86_64 v1.1.5')
.click();
}
} else if (utils.isOperatorVersion('stable')) {
cy.contains('Elemental Teal ISO x86_64 v1.1.5')
.click();
} else if (utils.isOperatorVersion('staging')) {
cy.contains('Elemental Teal ISO x86_64 latest-staging')
cy.contains('Elemental Teal ISO x86_64 (latest)')
.click();
} else {
cy.contains('Elemental Teal ISO x86_64 latest-dev')
Expand Down
5 changes: 5 additions & 0 deletions tests/cypress/latest/support/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ export const isRancherManagerVersion = (version: string) => {
export const isUIVersion = (version: string) => {
return (new RegExp(version)).test(Cypress.env("elemental_ui_version"));
}

// Check the upgrade target
export const isUpgradeOsChannel = (channel: string) => {
return (new RegExp(channel)).test(Cypress.env("upgrade_os_channel"));
}

0 comments on commit 6bbe084

Please sign in to comment.