Skip to content

Commit

Permalink
ci/ui: adapt code for rancher 2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
juadk committed Jul 8, 2024
1 parent a3035ab commit 52deb64
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
7 changes: 3 additions & 4 deletions tests/cypress/latest/e2e/unit_tests/deploy_app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ 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 * as utils from '~/support/utils';
import { slowCypressDown } from 'cypress-slow-down'

// slow down each command by 500ms
Expand All @@ -38,10 +37,10 @@ filterTests(['main'], () => {
cypressLib.checkClusterStatus(clusterName, 'Active', 600000);
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(20000);
utils.isRancherManagerVersion('2.7') ? cypressLib.burgerMenuToggle(): null;
cypressLib.burgerMenuToggle()
cypressLib.checkClusterStatus(clusterName, 'Active', 600000);
// TODO: function to deploy app?
cy.contains(clusterName)
cy.get('.main-panel').contains(clusterName)
.click();
cy.get('.nav').contains('Apps')
.click();
Expand All @@ -63,7 +62,7 @@ filterTests(['main'], () => {
qase(32,
it('Remove Alerting Drivers application', () => {
cypressLib.checkClusterStatus(clusterName, 'Active', 600000);
cy.contains(clusterName)
cy.get('.main-panel').contains(clusterName)
.click();
cy.get('.nav').contains('Apps')
.click();
Expand Down
4 changes: 3 additions & 1 deletion tests/cypress/latest/e2e/unit_tests/elemental_plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ filterTests(['main', 'upgrade'], () => {

qase(12,
it('Enable extension support', () => {
isUIVersion('stable') ? cypressLib.enableExtensionSupport(true) : cypressLib.enableExtensionSupport(false);
if (!isRancherManagerVersion('2.9')) {
isUIVersion('stable') ? cypressLib.enableExtensionSupport(true) : cypressLib.enableExtensionSupport(false);
}
})
);

Expand Down
29 changes: 21 additions & 8 deletions tests/cypress/latest/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,27 @@ Cypress.Commands.add('addMachInvLabel', (labelName, labelValue, useHardwareLabel
cy.get('[data-testid="add-label-mach-inv"] > .kv-container > .kv-item.key').type(labelName);
cy.get('[data-testid="add-label-mach-inv"] > .kv-container > .kv-item.value').type(labelValue);
if (useHardwareLabels) {
let nthChildIndex = 7;
for (const key in hwLabels) {
cy.get('[data-testid="add-label-mach-inv"] > .footer > .btn')
.click();
cy.get(`[data-testid="add-label-mach-inv"] > .kv-container > :nth-child(${nthChildIndex}) > input`).type(key);
cy.get(`[data-testid="add-label-mach-inv"] > .kv-container > :nth-child(${nthChildIndex + 1})
> .value-container > [data-testid="text-area-auto-grow"]`).type(hwLabels[key], {parseSpecialCharSequences: false});
nthChildIndex += 3;
// Some HTML select tags have changed with in Rancher 2.9
if (!utils.isRancherManagerVersion('2.9')) {
let nthChildIndex = 7;
for (const key in hwLabels) {
cy.get('[data-testid="add-label-mach-inv"] > .footer > .btn')
.click();
cy.get(`[data-testid="add-label-mach-inv"] > .kv-container > :nth-child(${nthChildIndex}) > input`).type(key);
cy.get(`[data-testid="add-label-mach-inv"] > .kv-container > :nth-child(${nthChildIndex + 1})
> .value-container > [data-testid="text-area-auto-grow"]`).type(hwLabels[key], {parseSpecialCharSequences: false});
nthChildIndex += 3;
};
} else {
let itemIndex = 1;
for (const key in hwLabels) {
cy.get('[data-testid="add-label-mach-inv"] > .footer > .btn')
.click();
cy.get(`[data-testid="input-kv-item-key-${itemIndex}"]`).type(key);
cy.get(`[data-testid="kv-item-value-${itemIndex}"] > .value-container > [data-testid="value-multiline"]`)
.type(hwLabels[key], {parseSpecialCharSequences: false});
itemIndex += 1;
}
};
};
});
Expand Down

0 comments on commit 52deb64

Please sign in to comment.