From 7b3f6ceae326db6f9650752e413e0b8aa78cfad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Mart=C3=ADn?= Date: Tue, 14 May 2024 10:04:52 +0200 Subject: [PATCH] Adding unit test for standard user role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Martín --- cypress/e2e/unit-tests.spec.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cypress/e2e/unit-tests.spec.ts b/cypress/e2e/unit-tests.spec.ts index ca33b3f..56d3eb8 100644 --- a/cypress/e2e/unit-tests.spec.ts +++ b/cypress/e2e/unit-tests.spec.ts @@ -102,6 +102,26 @@ describe('Cypress Library e2e tests', () => { cypressLib.deleteUser('mytestuserwithrole'); }); +it('Check createUser/deleteUser function with "Standard User" role', () => { + cy.login(); + cypressLib.burgerMenuToggle(); + // Given that Standard User is checked by default, no need to add role + cy.createUser('mytestuserwithrole', 'mytestpassword'); + // Log out with admin role and login with "Standard User" role to check + // "Standard User" does not have some options available and has some others + cy.logout(); + cy.login('mytestuserwithrole', 'mytestpassword'); + cypressLib.burgerMenuToggle(); + cy.contains('Continue Delivery').should('not.exist'); + cy.contains('Extensions').should('not.exist'); + cy.contains('Cluster Management').should('exist'); + // Log out as user and login back as admin to delete created user + cy.logout(); + cy.login(); + cypressLib.burgerMenuToggle(); + cypressLib.deleteUser('mytestuserwithrole'); +}); + it('Check enableExtensionSupport function with rancher repo activated', () => { cy.login(); cypressLib.burgerMenuToggle();