Skip to content

Commit

Permalink
ci/ui: fix code to work with rancher 2.10
Browse files Browse the repository at this point in the history
  • Loading branch information
juadk committed Nov 14, 2024
1 parent 71a832f commit 4802782
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 48 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ui-k3s-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ on:
type: boolean
k8s_downstream_version:
description: Rancher cluster downstream version to use
default: '"v1.28.13+k3s1"'
default: '"v1.30.6+k3s1"'
type: string
k8s_upstream_version:
description: Rancher cluster upstream version to use
default: '"v1.28.13+k3s1"'
default: '"v1.30.6+k3s1"'
type: string
proxy:
description: Deploy a proxy (none/rancher/elemental)
Expand All @@ -37,9 +37,9 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
k8s_downstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_downstream_version || '"v1.28.13+k3s1"')) }}
k8s_upstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_upstream_version || '"v1.28.13+k3s1"')) }}
rancher_version: ${{ fromJSON(format('[{0}]', inputs.rancher_version || '"stable/latest","latest/devel/2.8","latest/devel/2.9"')) }}
k8s_downstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_downstream_version || '"v1.30.6+k3s1"')) }}
k8s_upstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_upstream_version || '"v1.30.6+k3s1"')) }}
rancher_version: ${{ fromJSON(format('[{0}]', inputs.rancher_version || '"stable/latest","latest/devel/2.9","latest/devel/2.10"')) }}
uses: ./.github/workflows/master_e2e.yaml
secrets:
credentials: ${{ secrets.GCP_CREDENTIALS }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ui-k3s-upgrade-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ on:
type: boolean
k8s_downstream_version:
description: Rancher cluster downstream version to use
default: '"v1.28.13+k3s1"'
default: '"v1.30.6+k3s1"'
type: string
k8s_upstream_version:
description: Rancher cluster upstream version to use
default: '"v1.28.13+k3s1"'
default: '"v1.30.6+k3s1"'
type: string
proxy:
description: Deploy a proxy (none/rancher/elemental)
Expand All @@ -37,9 +37,9 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
k8s_downstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_downstream_version || '"v1.28.13+k3s1"')) }}
k8s_upstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_upstream_version || '"v1.28.13+k3s1"')) }}
rancher_version: ${{ fromJSON(format('[{0}]', inputs.rancher_version || '"stable/latest","latest/devel/2.8","latest/devel/2.9"')) }}
k8s_downstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_downstream_version || '"v1.30.6+k3s1"')) }}
k8s_upstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_upstream_version || '"v1.30.6+k3s1"')) }}
rancher_version: ${{ fromJSON(format('[{0}]', inputs.rancher_version || '"stable/latest","latest/devel/2.9","latest/devel/2.10"')) }}
uses: ./.github/workflows/master_e2e.yaml
secrets:
credentials: ${{ secrets.GCP_CREDENTIALS }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ui-rke2-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ on:
type: boolean
k8s_downstream_version:
description: Rancher cluster downstream version to use
default: '"v1.28.13+rke2r1"'
default: '"v1.30.6+rke2r1"'
type: string
k8s_upstream_version:
description: Rancher cluster upstream version to use
default: '"v1.28.13+rke2r1"'
default: '"v1.30.6+rke2r1"'
type: string
proxy:
description: Deploy a proxy (none/rancher/elemental)
Expand All @@ -37,9 +37,9 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
k8s_downstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_downstream_version || '"v1.28.13+rke2r1"')) }}
k8s_upstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_upstream_version || '"v1.28.13+rke2r1"')) }}
rancher_version: ${{ fromJSON(format('[{0}]', inputs.rancher_version || '"prime/latest","latest/devel/2.8","latest/devel/2.9"')) }}
k8s_downstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_downstream_version || '"v1.30.6+rke2r1"')) }}
k8s_upstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_upstream_version || '"v1.30.6+rke2r1"')) }}
rancher_version: ${{ fromJSON(format('[{0}]', inputs.rancher_version || '"prime/latest","latest/devel/2.9","latest/devel/2.10"')) }}
uses: ./.github/workflows/master_e2e.yaml
secrets:
credentials: ${{ secrets.GCP_CREDENTIALS }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ui-rke2-upgrade-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ on:
type: boolean
k8s_downstream_version:
description: Rancher cluster downstream version to use
default: '"v1.28.13+rke2r1"'
default: '"v1.30.6+rke2r1"'
type: string
k8s_upstream_version:
description: Rancher cluster upstream version to use
default: '"v1.28.13+rke2r1"'
default: '"v1.30.6+rke2r1"'
type: string
proxy:
description: Deploy a proxy (none/rancher/elemental)
Expand All @@ -37,9 +37,9 @@ jobs:
fail-fast: false
max-parallel: 4
matrix:
k8s_downstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_downstream_version || '"v1.28.13+rke2r1"')) }}
k8s_upstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_upstream_version || '"v1.28.13+rke2r1"')) }}
rancher_version: ${{ fromJSON(format('[{0}]', inputs.rancher_version || '"prime/latest","latest/devel/2.8","latest/devel/2.9"')) }}
k8s_downstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_downstream_version || '"v1.30.4+rke2r1"')) }}
k8s_upstream_version: ${{ fromJSON(format('[{0}]', inputs.k8s_upstream_version || '"v1.30.4+rke2r1"')) }}
rancher_version: ${{ fromJSON(format('[{0}]', inputs.rancher_version || '"prime/latest","latest/devel/2.9","latest/devel/2.10"')) }}
uses: ./.github/workflows/master_e2e.yaml
secrets:
credentials: ${{ secrets.GCP_CREDENTIALS }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import '~/support/commands';
import filterTests from '~/support/filterTests.js';
import * as cypressLib from '@rancher-ecp-qa/cypress-library';
import { qase } from 'cypress-qase-reporter/dist/mocha';
import { isRancherManagerVersion } from '~/support/utils';

filterTests(['main'], () => {
describe('Advanced filtering testing', () => {
Expand Down Expand Up @@ -67,7 +68,11 @@ filterTests(['main'], () => {
cy.clickNavMenu(['Inventory of Machines']);
cy.get('[width="30"] > .checkbox-outer-container > .checkbox-container > .checkbox-custom').click();
cy.clickButton('Actions');
cy.get('.tooltip-inner > :nth-child(1) > .list-unstyled > :nth-child(3)').click();
if (!isRancherManagerVersion('2.10')) {
cy.get('.tooltip-inner > :nth-child(1) > .list-unstyled > :nth-child(3)').click();
} else {
cy.get('.v-popper__inner').contains('Delete').click();
}
cy.confirmDelete();
}));
});
Expand Down
6 changes: 3 additions & 3 deletions tests/cypress/latest/e2e/unit_tests/deploy_app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ filterTests(['main'], () => {
cy.wait(20000);
isRancherManagerVersion('2.8') && cypressLib.burgerMenuToggle();
cypressLib.checkClusterStatus(clusterName, 'Active', 600000);
if (isRancherManagerVersion('2.9')) {
if (!isRancherManagerVersion('2.8')) {
cy.get('.main-panel').contains(clusterName).click();
} else {
cy.contains(clusterName).click();
Expand All @@ -52,13 +52,13 @@ filterTests(['main'], () => {
cy.clickButton('Install');
cy.contains('SUCCESS: helm install', { timeout: 120000 });
cy.reload();
cy.contains('Deployed rancher-alerting-drivers');
cy.contains(new RegExp('Deployed.*rancher-alerting-drivers'))
}));

qase(32,
it('Remove Alerting Drivers application', () => {
cypressLib.checkClusterStatus(clusterName, 'Active', 600000);
if (isRancherManagerVersion('2.9')) {
if (!isRancherManagerVersion('2.8')) {
cy.get('.main-panel').contains(clusterName).click();
} else {
cy.contains(clusterName).click();
Expand Down
12 changes: 6 additions & 6 deletions tests/cypress/latest/e2e/unit_tests/elemental_plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ filterTests(['main', 'upgrade'], () => {

qase(11,
it('Add elemental-ui repo', () => {
// 1 - TODO: Remove rancher 2-9 condition later
// 2 - UI extension upgrade cannot be tested with rancher manager 2.9 yet
// 1 - TODO: Remove rancher 2-10 condition later
// 2 - UI extension upgrade cannot be tested with rancher manager 2.10 yet
// because we have only one version so far
if (!isUIVersion('stable') || isRancherManagerVersion('2.9')) {
if (!isUIVersion('stable') || isRancherManagerVersion('2.10')) {
cypressLib.addRepository('elemental-ui', 'https://github.com/rancher/elemental-ui.git', 'git', 'gh-pages');
}
})
);

// Add rancher-ui-plugin-charts repo because its part of Rancher Prime in 2.8 and 2.9-head
// Add rancher-ui-plugin-charts repo except for rancher manager 2.7
it('Add rancher-ui-plugin-charts repo', () => {
isRancherManagerVersion('2.8') || isRancherManagerVersion('2.9') ? cypressLib.addRepository('rancher-ui-plugin-charts', 'https://github.com/rancher/ui-plugin-charts.git', 'git', 'main') : null;
!isRancherManagerVersion('2.7') ? cypressLib.addRepository('rancher-ui-plugin-charts', 'https://github.com/rancher/ui-plugin-charts.git', 'git', 'main') : null;
});

qase(12,
it('Enable extension support', () => {
if (!isRancherManagerVersion('2.9')) {
if (isRancherManagerVersion('2.8')) {
isUIVersion('stable') ? cypressLib.enableExtensionSupport(true) : cypressLib.enableExtensionSupport(false);
}
})
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/latest/e2e/unit_tests/os_version.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ filterTests(['main'], () => {

it('Check In Sync column status', () => {
cy.clickNavMenu(["Advanced", "OS Versions"]);
const htmlSelector = isRancherManagerVersion('2.9') ? selectors.sortableTableList : selectors.clusterList;
const htmlSelector = isRancherManagerVersion('2.8') ? selectors.clusterList : selectors.sortableTableList;
cy.getBySel(htmlSelector)
.should('not.contain', 'Unavailable');
cy.getBySel(htmlSelector)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ describe('UI extension upgrade tests', () => {

filterTests(['upgrade'], () => {
// 1 - Enable only with K3S because still too much flaky with RKE2
// 2 - TODO: Remove rancher 2-9 condition later
// UI extension upgrade cannot be upgraded with rancher manager 2.9 yet
// 2 - TODO: Remove rancher 2-10 condition later
// UI extension upgrade cannot be upgraded with rancher manager 2.10 yet
// because we have only one version so far
if (utils.isK8sVersion('k3s') && !utils.isRancherManagerVersion('2.9')) {
if (utils.isK8sVersion('k3s') && !utils.isRancherManagerVersion('2.10')) {
it('Add elemental-ui dev repo', () => {
cypressLib.addRepository('elemental-ui', 'https://github.com/rancher/elemental-ui.git', 'git', 'gh-pages');
});
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/latest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"homepage": "https://github.com/rancher/elemental#readme",
"dependencies": {
"@rancher-ecp-qa/cypress-library": "1.2.0",
"@rancher-ecp-qa/cypress-library": "1.2.1",
"cy-verify-downloads": "^0.1.8",
"cypress": "^13.7.3",
"cypress-dark": "^1.8.3",
Expand Down
20 changes: 12 additions & 8 deletions tests/cypress/latest/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,13 @@ Cypress.Commands.add('createMachReg', (
}

// Try to download the registration file and check it
cy.getBySel(selectors.downloadBtn).click();
cy.verifyDownload(`${machRegName}_registrationURL.yaml`);
cy.contains('Saving').should('not.exist');
// The button is broken in rancher 2.10, bug opened here
// https://github.com/rancher/elemental-ui/issues/229
if (!utils.isRancherManagerVersion('2.10')) {
cy.getBySel(selectors.downloadBtn).click();
cy.verifyDownload(`${machRegName}_registrationURL.yaml`);
cy.contains('Saving').should('not.exist');
}

// Check Cloud configuration
if (checkDefaultCloudConfig) {
Expand Down Expand Up @@ -216,18 +220,18 @@ Cypress.Commands.add('addMachInvLabel', (labelName: string, labelValue: string,
cy.get(`${selectors.addLabelMachInv} > .kv-container > .kv-item.value`).type(labelValue);

if (useHardwareLabels) {
const isRancher29 = utils.isRancherManagerVersion('2.9');
let index = isRancher29 ? 1 : 7;
const isRancher28 = utils.isRancherManagerVersion('2.8');
let index = isRancher28 ? 7 : 1;

for (const key in hwLabels) {
cy.get(`${selectors.addLabelMachInv} > .footer > .btn`).click();
const keySelector = isRancher29 ? selectors.inputKvItemKey(index) : `${selectors.kvContainer}(${index}) > input`;
const valueSelector = isRancher29 ? selectors.kvItemValue(index) : `${selectors.kvContainer}(${index + 1}) > .value-container > ${selectors.textAreaAutoGrow}`;
const keySelector = isRancher28 ? `${selectors.kvContainer}(${index}) > input` : selectors.inputKvItemKey(index);
const valueSelector = isRancher28 ? `${selectors.kvContainer}(${index + 1}) > .value-container > ${selectors.textAreaAutoGrow}` : selectors.kvItemValue(index);

cy.get(keySelector).type(key);
cy.get(valueSelector).type(hwLabels[key], { parseSpecialCharSequences: false });

index += isRancher29 ? 1 : 3;
index += isRancher28 ? 3 : 1;
}
}
});
Expand Down
21 changes: 16 additions & 5 deletions tests/cypress/latest/support/elemental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { isCypressTag, isGitRepo, isOperatorVersion, isRancherPrime } from '~/support/utils';
import { isCypressTag, isGitRepo, isOperatorVersion, isRancherManagerVersion, isRancherPrime } from '~/support/utils';

export class Elemental {
// Go into the cluster creation menu
Expand All @@ -29,7 +29,11 @@ export class Elemental {
// Check all listed options once accordion is opened
cy.get('li.child.nav-type').should(($lis) => {
expect($lis).to.have.length(7);
expect($lis.eq(0)).to.contain('Dashboard');
// There is a bug with Dashboard entry in rancher 2.10
// https://github.com/rancher/elemental-ui/issues/230
if (!isRancherManagerVersion('2.10')) {
expect($lis.eq(0)).to.contain('Dashboard');
}
expect($lis.eq(1)).to.contain('Registration Endpoints');
expect($lis.eq(2)).to.contain('Inventory of Machines');
expect($lis.eq(3)).to.contain('Update Groups');
Expand Down Expand Up @@ -89,8 +93,15 @@ export class Elemental {
cy.clickButton('Install');
cy.contains('SUCCESS: helm', { timeout: 120000 });
cy.reload();
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.contains('Only User Namespaces').click().type('cattle-elemental-system{enter}{esc}');
cy.get('.outlet').contains('Deployed elemental-operator cattle-elemental-system', { timeout: 120000 });
if (!isRancherManagerVersion('2.10')) {
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.contains('Only User Namespaces').click().type('cattle-elemental-system{enter}{esc}');
cy.get('.outlet').contains('Deployed elemental-operator cattle-elemental-system', { timeout: 120000 });
} else {
cy.contains('Only User Namespaces').click()
// Select All Namespaces entry
cy.getBySel('namespaces-option-0').click();
cy.get('.outlet').contains(new RegExp('Deployed.*elemental-operator'), { timeout: 120000 });
}
}
}

0 comments on commit 4802782

Please sign in to comment.