From 31c5a723cb54d8dcb6ab06de4a7a65b1036590e9 Mon Sep 17 00:00:00 2001 From: Ryan Liang <109499885+RyanL1997@users.noreply.github.com> Date: Tue, 14 Nov 2023 10:52:03 -0800 Subject: [PATCH] Stabilize SAML integration test cases for security dashboard CIs (#1641) Stabilize SAML integration test cases for security dashboard CIs (#1641) --------- Signed-off-by: Ryan Liang --- test/jest_integration/saml_auth.test.ts | 3 ++- test/jest_integration/saml_multiauth.test.ts | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/test/jest_integration/saml_auth.test.ts b/test/jest_integration/saml_auth.test.ts index 0e963ba68..e48635e41 100644 --- a/test/jest_integration/saml_auth.test.ts +++ b/test/jest_integration/saml_auth.test.ts @@ -48,6 +48,7 @@ describe('start OpenSearch Dashboards server', () => { plugins: { scanDirs: [resolve(__dirname, '../..')], }, + home: { disableWelcomeScreen: true }, server: { host: 'localhost', port: 5601, @@ -267,7 +268,7 @@ describe('start OpenSearch Dashboards server', () => { }); it('Login to Dashboard with Hash', async () => { - const urlWithHash = `http://localhost:5601/app/dashboards#/view/7adfa750-4c81-11e8-b3d7-01146121b73d?_g=(filters:!(),refreshInterval:(pause:!f,value:900000),time:(from:now-24h,to:now))&_a=(description:'Analyze%20mock%20flight%20data%20for%20OpenSearch-Air,%20Logstash%20Airways,%20OpenSearch%20Dashboards%20Airlines%20and%20BeatsWest',filters:!(),fullScreenMode:!f,options:(hidePanelTitles:!f,useMargins:!t),query:(language:kuery,query:''),timeRestore:!t,title:'%5BFlights%5D%20Global%20Flight%20Dashboard',viewMode:view)`; + const urlWithHash = `http://localhost:5601/app/security-dashboards-plugin#/getstarted`; const driver = getDriver(browser, options).build(); await driver.manage().deleteAllCookies(); await driver.get(urlWithHash); diff --git a/test/jest_integration/saml_multiauth.test.ts b/test/jest_integration/saml_multiauth.test.ts index 92defdd1d..cd41a52d4 100644 --- a/test/jest_integration/saml_multiauth.test.ts +++ b/test/jest_integration/saml_multiauth.test.ts @@ -44,6 +44,7 @@ describe('start OpenSearch Dashboards server', () => { plugins: { scanDirs: [resolve(__dirname, '../..')], }, + home: { disableWelcomeScreen: true }, server: { host: 'localhost', port: 5601, @@ -236,8 +237,8 @@ describe('start OpenSearch Dashboards server', () => { }); it('Login to Dashboards and resume from nextUrl', async () => { - const urlWithHash = `http://localhost:5601/app/dashboards#/view/7adfa750-4c81-11e8-b3d7-01146121b73d?_g=(filters:!(),refreshInterval:(pause:!f,value:900000),time:(from:now-24h,to:now))&_a=(description:'Analyze%20mock%20flight%20data%20for%20OpenSearch-Air,%20Logstash%20Airways,%20OpenSearch%20Dashboards%20Airlines%20and%20BeatsWest',filters:!(),fullScreenMode:!f,options:(hidePanelTitles:!f,useMargins:!t),query:(language:kuery,query:''),timeRestore:!t,title:'%5BFlights%5D%20Global%20Flight%20Dashboard',viewMode:view)`; - const loginUrlWithNextUrl = `http://localhost:5601/app/login?nextUrl=%2Fapp%2Fdashboards#/view/7adfa750-4c81-11e8-b3d7-01146121b73d?_g=(filters:!(),refreshInterval:(pause:!f,value:900000),time:(from:now-24h,to:now))&_a=(description:'Analyze%20mock%20flight%20data%20for%20OpenSearch-Air,%20Logstash%20Airways,%20OpenSearch%20Dashboards%20Airlines%20and%20BeatsWest',filters:!(),fullScreenMode:!f,options:(hidePanelTitles:!f,useMargins:!t),query:(language:kuery,query:''),timeRestore:!t,title:'%5BFlights%5D%20Global%20Flight%20Dashboard',viewMode:view)`; + const urlWithHash = `http://localhost:5601/app/security-dashboards-plugin#/getstarted`; + const loginUrlWithNextUrl = `http://localhost:5601/app/login?nextUrl=%2Fapp%2Fsecurity-dashboards-plugin#/getstarted`; const driver = getDriver(browser, options).build(); await driver.manage().deleteAllCookies(); await driver.get(loginUrlWithNextUrl); @@ -260,7 +261,7 @@ describe('start OpenSearch Dashboards server', () => { }); it('Login to Dashboards without nextUrl', async () => { - const urlWithoutHash = `http://localhost:5601/app/home`; + const urlWithoutHash = `http://localhost:5601/app/home#/`; const loginUrl = `http://localhost:5601/app/login`; const driver = getDriver(browser, options).build(); await driver.manage().deleteAllCookies(); @@ -274,6 +275,15 @@ describe('start OpenSearch Dashboards server', () => { until.elementsLocated(By.xpath('/html/body/div[1]/div/header/div/div[2]')), 20000 ); + await driver.wait(until.elementsLocated(By.css('img[data-test-subj="defaultLogo"]')), 20000); + await driver.wait( + until.elementsLocated(By.css('section[aria-labelledby="homDataAdd__title"]')), + 20000 + ); + await driver.wait( + until.elementsLocated(By.css('section[aria-labelledby="homDataManage__title"]')), + 20000 + ); const windowHash = await driver.getCurrentUrl(); console.log('windowHash: ' + windowHash); expect(windowHash).toEqual(urlWithoutHash);