Skip to content

Commit

Permalink
Stabilize SAML integration test cases for security dashboard CIs (#1641
Browse files Browse the repository at this point in the history
…) (#1660)

Stabilize SAML integration test cases for security dashboard CIs (#1641)
---------

Signed-off-by: Ryan Liang <[email protected]>
(cherry picked from commit 31c5a72)

Co-authored-by: Ryan Liang <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and RyanL1997 authored Nov 20, 2023
1 parent 5def2a4 commit 2af71cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion test/jest_integration/saml_auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe('start OpenSearch Dashboards server', () => {
plugins: {
scanDirs: [resolve(__dirname, '../..')],
},
home: { disableWelcomeScreen: true },
server: {
host: 'localhost',
port: 5601,
Expand Down Expand Up @@ -266,7 +267,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);
Expand Down
16 changes: 13 additions & 3 deletions test/jest_integration/saml_multiauth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('start OpenSearch Dashboards server', () => {
plugins: {
scanDirs: [resolve(__dirname, '../..')],
},
home: { disableWelcomeScreen: true },
server: {
host: 'localhost',
port: 5601,
Expand Down Expand Up @@ -235,8 +236,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);
Expand All @@ -259,7 +260,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();
Expand All @@ -273,6 +274,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);
Expand Down

0 comments on commit 2af71cf

Please sign in to comment.