Skip to content

Commit

Permalink
Improving locator for devel channel (#246)
Browse files Browse the repository at this point in the history
* Improving locator for devel channel

* Fixing indentation
  • Loading branch information
mmartin24 authored Dec 18, 2024
1 parent c7eca80 commit 1a5123c
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,20 @@ Cypress.Commands.add('nameSpaceMenuToggle', (namespaceName) => {
cy.get('.top > .ns-filter').should('be.visible');

// For some reason I don't understand, click force doesn't work
// in 2.10, but it is mandatory for earlier versions
// TODO: this is a workaround. Please improve it.
if (/\/2\.10/.test(Cypress.env('rancher_version'))) {
cy.get('.top > .ns-filter').click();
}
else {
// in 2.10 an onwards, but it is mandatory for earlier versions
// To be improved in the future

const rancherVersion = Cypress.env('rancher_version');
const old_versions = ["latest/devel/2.7", "latest/devel/2.8", "latest/devel/2.9"];

if (old_versions.includes(rancherVersion)) {
cy.log('Rancher version is: ' + rancherVersion , 'Clicking WITH force:true');
cy.get('.top > .ns-filter').click({ force: true });
}
else {
cy.log('Rancher version is: ' + rancherVersion, 'Clicking WITHOUT force:true');
cy.get('.top > .ns-filter').click();
}
cy.get('div.ns-item').contains(namespaceName).scrollIntoView()
cy.get('div.ns-item').contains(namespaceName).click()
cy.get('div.ns-dropdown.ns-open > i.icon.icon-chevron-up').click({ force: true });
Expand Down

0 comments on commit 1a5123c

Please sign in to comment.