Skip to content

Commit

Permalink
[Test automation] OpenShift Learning Path. The link from the learning…
Browse files Browse the repository at this point in the history
… path should open a new tab (#1320)

* [Test automation] OpenShift Learning Path. The link from the learning path should open a new tab

* Added blank page check for new tab

* learning path new page PR fix

* PR fix timeout

* Changing PR fix

* Changing PR fix

* PR fix

---------

Co-authored-by: Joseph Kim <[email protected]>
  • Loading branch information
teknaS47 and josephca authored Jul 3, 2024
1 parent 95d0e10 commit e38c2e7
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 135 deletions.
2 changes: 1 addition & 1 deletion e2e-tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ site
.idea

# e2e test results
junit-results.xml
junit-results.xml
31 changes: 31 additions & 0 deletions e2e-tests/playwright/e2e/learning-path-page.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { expect, test } from '@playwright/test';
import { UIhelper } from '../utils/UIhelper';
import { Common } from '../utils/Common';

test.describe('Learning Paths', () => {
let common: Common;
let uiHelper: UIhelper;

test.beforeEach(async ({ page }) => {
uiHelper = new UIhelper(page);
common = new Common(page);
await common.loginAsGuest();
});

test('Verify that links in Learning Paths for Backstage opens in a new tab', async ({
page,
}) => {
await uiHelper.openSidebar('Learning Paths');

for (let i = 0; i < 5; i++) {
const popupPromise = page.waitForEvent('popup');
await page.locator(`div[class*="MuiCardHeader-root"]`).nth(i).click();
const popup = await popupPromise;
await popup.waitForLoadState('domcontentloaded', { timeout: 120000 });
const url = await popup.evaluate('location.href');
console.log(url);
expect(url).not.toBe('about:blank');
await popup.close();
}
});
});
Loading

0 comments on commit e38c2e7

Please sign in to comment.