Skip to content

Commit

Permalink
adding test to check when a user has no roles, clicking button will l…
Browse files Browse the repository at this point in the history
…og them out

Signed-off-by: leanneeliatra <[email protected]>
Signed-off-by: [email protected] <[email protected]>
  • Loading branch information
leanneeliatra committed Sep 7, 2023
1 parent 70d5bb4 commit ce80884
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

if(Cypress.env('SECURITY_ENABLED')){
describe('No role button redirect', () => {
before(() => {
cy.server();
})
});
it('Tests if no role button redirects to logout screen', () => {
// 1. visit missing roles page
cy.visit('/app/customerror/missing-role');

// 2. click the missing role button
cy.contains('button', 'Back to OpenSearch Dashboards Home').should('be.visible').click();

// 3. clicking buttong should logout
cy.intercept({
method: 'POST',
url: '/auth/logout',
});

// 4. check we have logged out and therefore are back at login page
cy.getElementByTestId('submit').should('contain.text', 'Log in');
});
}

0 comments on commit ce80884

Please sign in to comment.