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
Stabilize SAML integration test cases for security dashboard CIs (#1641)
---------

Signed-off-by: Ryan Liang <jiallian@amazon.com>
  • Loading branch information
RyanL1997 committed Nov 14, 2023
1 parent 0b72907 commit 31c5a72
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 @@ -48,6 +48,7 @@ describe('start OpenSearch Dashboards server', () => {
plugins: {
scanDirs: [resolve(__dirname, '../..')],
},
home: { disableWelcomeScreen: true },
server: {
host: 'localhost',
port: 5601,
Expand Down Expand Up @@ -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);
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 @@ -44,6 +44,7 @@ describe('start OpenSearch Dashboards server', () => {
plugins: {
scanDirs: [resolve(__dirname, '../..')],
},
home: { disableWelcomeScreen: true },
server: {
host: 'localhost',
port: 5601,
Expand Down Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -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);
Expand Down

0 comments on commit 31c5a72

Please sign in to comment.