-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f6b1a6
commit f9fa928
Showing
8 changed files
with
178 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: [ main, master, develop ] | ||
pull_request: | ||
branches: [ main, master, develop ] | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Install yarn | ||
run: npm install -g yarn | ||
- name: Run Veda setup | ||
run: ./.veda/setup | ||
- name: Install Playwright Browsers | ||
run: yarn playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: yarn test:e2e | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: /veda/ui/playwright-report/ | ||
retention-days: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Locator, Page } from '@playwright/test'; | ||
|
||
export default class ExplorePage { | ||
readonly page: Page; | ||
readonly layersHeading: Locator; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
this.layersHeading = this.page.getByRole('heading', { name: 'Layers' }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import fs from 'fs'; | ||
import { test, expect } from '../pages/basePage'; | ||
|
||
const datasetIds = JSON.parse(fs.readFileSync('e2e/playwrightTestData.json', 'utf8')).datasetIds; | ||
|
||
test.describe('explore dataset', () => { | ||
for (const dataset of datasetIds) { | ||
test(`${dataset} explore page functions`, async({ | ||
page, | ||
explorePage, | ||
}) => { | ||
let pageErrorCalled = false; | ||
// Log all uncaught errors to the terminal to be visible in trace | ||
page.on('pageerror', exception => { | ||
console.log(`Uncaught exception: "${JSON.stringify(exception)}"`); | ||
pageErrorCalled = true; | ||
}); | ||
|
||
//mosaic isn't hit on all datasets | ||
const collectionsResponsePromise = page.waitForResponse(response => | ||
response.url().includes('collections') && response.status() === 200 | ||
); | ||
|
||
await page.goto(`data-catalog/${dataset}/explore`); | ||
await expect(explorePage.layersHeading).toBeVisible(); | ||
|
||
const mosaicResponse = await collectionsResponsePromise; | ||
expect(mosaicResponse.ok(), 'mapbox request should be successful').toBeTruthy(); | ||
|
||
// scroll page to bottom | ||
await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight)); | ||
|
||
expect(pageErrorCalled, 'no javascript exceptions thrown on page').toBe(false); | ||
}); | ||
} | ||
|
||
}); |