From 722a7bbd3317e63f981121a161ba1e0d0c71cf6a Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 21 Nov 2023 15:36:13 -0800 Subject: [PATCH] Setup 1st saml test case Signed-off-by: Ryan Liang --- .cypress/e2e/saml/saml_test.spec.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.cypress/e2e/saml/saml_test.spec.js b/.cypress/e2e/saml/saml_test.spec.js index 643c84cc2..7784abdf4 100644 --- a/.cypress/e2e/saml/saml_test.spec.js +++ b/.cypress/e2e/saml/saml_test.spec.js @@ -17,3 +17,30 @@ * Copyright OpenSearch Contributors * SPDX-License-Identifier: Apache-2.0 */ + +afterEach(() => { + cy.clearCookies(); + cy.clearLocalStorage(); + }); + +describe('Log in via SAML', () => { + const samlLogin = () => { + cy.get('input[id=userName]', { timeout: 15000}).should('be.visible'); + cy.get('button[id=btn-sign-in]', { timeout: 15000 }).should('be.visible').click(); + }; + + it('Login to app/opensearch_dashboards_overview#/ when SAML is enabled', () => { + localStorage.setItem("opendistro::security::tenant::saved", "\"__user__\""); + localStorage.setItem("home:newThemeModal:show", "false"); + + cy.visit('http://localhost:5601/app/opensearch_dashboards_overview', { + failOnStatusCode: false, + timeout: 10000, + }); + + samlLogin(); + + cy.get('#osdOverviewPageHeader__title', { timeout: 10000 }).should('be.visible'); + cy.getCookie('security_authentication', { timeout: 10000 }).should('exist'); + }); +});