Skip to content

Commit

Permalink
Remove burgerMenuOpenIfClosed function
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Adamek <julien.adamek@suse.com>
  • Loading branch information
juadk committed Oct 25, 2023
1 parent 54cf101 commit 6c3468b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 34 deletions.
28 changes: 11 additions & 17 deletions cypress/e2e/unit-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ describe('Cypress Library e2e tests', () => {
cypressLib.firstLogin();
});

it('Check burgerMenuOpenIfClosed function', () => {
cy.login();
// Open the menu
cypressLib.burgerMenuOpenIfClosed();
cy.getBySel('side-menu')
.contains('Cluster Management');
// Should do nothing as the menu is already open
cypressLib.burgerMenuOpenIfClosed();
cy.getBySel('side-menu')
.contains('Cluster Management');
});

it('Check burgerMenuToogle function', () => {
cy.login();
// Open the menu
Expand All @@ -52,7 +40,7 @@ describe('Cypress Library e2e tests', () => {

it('Check accessMenu function', () => {
cy.login();
cypressLib.burgerMenuOpenIfClosed();
cypressLib.burgerMenuToggle();
cypressLib.accesMenu('Cluster Management');
});

Expand All @@ -63,48 +51,54 @@ describe('Cypress Library e2e tests', () => {

it('Check clusterStatus function', () => {
cy.login();
cypressLib.burgerMenuToggle();
cypressLib.checkClusterStatus('local', 'Active');
});

it('Check checkNavIcon function', () => {
cy.login();
cypressLib.burgerMenuOpenIfClosed();
cypressLib.burgerMenuToggle();
cypressLib.checkNavIcon('fleet');
});

it('Check confirmDelete function', () => {
cy.login();
cypressLib.burgerMenuToggle();
// confirmDelete function is called in deleteRepository function
cypressLib.deleteRepository('elemental-ui');
});

it('Check createUser/deleteUser function with role', () => {
cy.login();
cypressLib.burgerMenuToggle();
cypressLib.createUser('mytestuserwithrole', 'mytestpassword', 'User-Base');
cypressLib.burgerMenuToggle();
cypressLib.deleteUser('mytestuserwithrole');
});

it('Check createUser/deleteUser function without role', () => {
cy.login();
cypressLib.burgerMenuToggle();
cypressLib.createUser('mytestuserwithoutrole', 'mytestpassword');
cypressLib.burgerMenuToggle();
cypressLib.deleteUser('mytestuserwithoutrole');
});

it('Check enableExtensionSupport function with rancher repo activated', () => {
cy.login();
cypressLib.burgerMenuOpenIfClosed();
cypressLib.burgerMenuToggle();
cypressLib.enableExtensionSupport(true);
});

it('Check disableExtensionSupport function', () => {
cy.login();
cypressLib.burgerMenuOpenIfClosed();
cypressLib.burgerMenuToggle();
cypressLib.disableExtensionSupport();
});

it('Check enableExtensionSupport function without rancher repo activated', () => {
cy.login();
cypressLib.burgerMenuOpenIfClosed();
cypressLib.burgerMenuToggle();
cypressLib.enableExtensionSupport(false, true);
});
});
17 changes: 0 additions & 17 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export function accesMenu(menu) {
* @param repositoryBranch : Branch of the repository
*/
export function addRepository(repositoryName, repositoryURL, repositoryType, repositoryBranch) {
this.burgerMenuOpenIfClosed();
cy.contains('local')
.click();
cy.clickNavMenu(['Apps', 'Repositories'])
Expand Down Expand Up @@ -68,7 +67,6 @@ export function addRepository(repositoryName, repositoryURL, repositoryType, rep
* @param repositoryName : Name of the repository to delete
*/
export function deleteRepository(repositoryName) {
this.burgerMenuOpenIfClosed();
cy.contains('local')
.click();
cy.clickNavMenu(['Apps', 'Repositories'])
Expand All @@ -86,20 +84,8 @@ export function deleteRepository(repositoryName) {
.should('not.exist');
};

/**
* Check if the burger menu is open and open it if it's closed
*/
export function burgerMenuOpenIfClosed() {
cy.get('body').then((body) => {
if (body.find('.menu.raised').length === 0) {
this.burgerMenuToggle();
};
});
};

/**
* Click on the burger menu on the top left of the screen
* @remarks : Used in burgerMenuOpenIfClosed()
*/
export function burgerMenuToggle() {
cy.getBySel('top-level-menu', {timeout: 12000})
Expand All @@ -114,7 +100,6 @@ export function burgerMenuToggle() {
* @param timeout : Timeout for the check
*/
export function checkClusterStatus(clusterName, clusterStatus, timeout) {
this.burgerMenuOpenIfClosed();
cy.contains('Home')
.click();
// The new cluster must be in active state
Expand Down Expand Up @@ -148,7 +133,6 @@ export function confirmDelete() {
*/
// TODO: Add the possibility to add multiple roles
export function createUser(username, password, role) {
this.burgerMenuOpenIfClosed();
cy.contains('Users & Authentication')
.click();
cy.contains('.title', 'Users')
Expand All @@ -174,7 +158,6 @@ export function createUser(username, password, role) {
export function deleteUser(username) {
// Screen has to be big enough to display the 'Delete' button
cy.viewport(1920, 1080);
this.burgerMenuOpenIfClosed();
cy.contains('Users & Authentication')
.click();
cy.contains('.title', 'Users')
Expand Down

0 comments on commit 6c3468b

Please sign in to comment.