Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci/ui: fix how staging is tagged in UI #992

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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"));
}