diff --git a/cypress/integration/plugins/security-dashboards-plugin/missing_role_button_logout.js b/cypress/integration/plugins/security-dashboards-plugin/missing_role_button_logout.js new file mode 100644 index 000000000..5a575bd8a --- /dev/null +++ b/cypress/integration/plugins/security-dashboards-plugin/missing_role_button_logout.js @@ -0,0 +1,18 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ +if (Cypress.env('SECURITY_ENABLED')) { + it('Tests if no role button redirects to logout screen', () => { + cy.visit('/app/customerror/missing-role'); + + cy.contains('button', 'Logout').should('be.visible').click(); + + cy.intercept({ + method: 'POST', + url: '/auth/logout', + }); + + cy.getElementByTestId('submit').should('contain.text', 'Log in'); + }); +}