-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add several tests using example maps. Remove nightwatch and old tests.
- Loading branch information
Showing
10 changed files
with
170 additions
and
57 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,27 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: [ main, master ] | ||
pull_request: | ||
branches: [ main, master ] | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: npx playwright test | ||
- uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: playwright-report | ||
path: 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 was deleted.
Oops, something went wrong.
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,59 @@ | ||
// @ts-check | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
/** | ||
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
// require('dotenv').config({ path: path.resolve(__dirname, '.env') }); | ||
|
||
/** | ||
* @see https://playwright.dev/docs/test-configuration | ||
*/ | ||
export default defineConfig({ | ||
testDir: './tests', | ||
/* Run tests in files in parallel */ | ||
fullyParallel: true, | ||
/* Fail the build on CI if you accidentally left test.only in the source code. */ | ||
forbidOnly: !!process.env.CI, | ||
/* Retry on CI only */ | ||
retries: process.env.CI ? 2 : 0, | ||
/* Opt out of parallel tests on CI. */ | ||
workers: process.env.CI ? 1 : undefined, | ||
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ | ||
reporter: 'list', | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Base URL to use in actions like `await page.goto('/')`. */ | ||
// baseURL: 'http://127.0.0.1:3000', | ||
|
||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ | ||
trace: 'on-first-retry', | ||
}, | ||
|
||
/* Configure projects for major browsers */ | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
|
||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
|
||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
], | ||
|
||
/* Run your local dev server before starting the tests */ | ||
// webServer: { | ||
// command: 'npm run serve', | ||
// url: 'http://127.0.0.1:8000', | ||
// reuseExistingServer: !process.env.CI, | ||
// }, | ||
}); | ||
|
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,39 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
const url_world = 'http://localhost:8000/examples/world-choropleth.html'; | ||
|
||
test('has title', async ({ page }) => { | ||
await page.goto(url_world); | ||
await expect(page).toHaveTitle(/World/); | ||
}); | ||
|
||
test('mauritania in world map', async ({ page }) => { | ||
await page.goto(url_world); | ||
|
||
const loc = page.locator('path.unit-MRT'); | ||
await expect(loc).toBeVisible(); | ||
await expect(loc).toHaveAttribute('d'); | ||
await expect(loc).toHaveAttribute('style', /fill/); | ||
|
||
const title = await loc.locator('title').textContent(); | ||
expect(title).toMatch(/Mauritania/); | ||
}); | ||
|
||
test('has legend', async ({ page }) => { | ||
await page.goto(url_world); | ||
|
||
const loc = page.locator('rect.legend-bar'); | ||
await expect(loc).toBeVisible(); | ||
await expect(loc).toHaveAttribute('height'); | ||
await expect(loc).toHaveAttribute('width'); | ||
}); | ||
|
||
test('has annotation', async ({ page }) => { | ||
await page.goto(url_world); | ||
|
||
const loc = page.locator('g.annotation'); | ||
await expect(loc).toBeVisible(); | ||
await expect(loc).toHaveAttribute('height'); | ||
await expect(loc).toHaveAttribute('width'); | ||
await expect(loc).toHaveText(/World Wide/) | ||
}); |
This file was deleted.
Oops, something went wrong.
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,33 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
const url_world_plain = 'http://localhost:8000/examples/world-plain.html' | ||
|
||
test('has title', async ({ page }) => { | ||
await page.goto(url_world_plain); | ||
await expect(page).toHaveTitle(/World/); | ||
}); | ||
|
||
test('spain in world map', async ({ page }) => { | ||
await page.goto(url_world_plain); | ||
|
||
const loc = page.locator('path.unit-ESP'); | ||
await expect(loc).toBeVisible(); | ||
await expect(loc).toHaveAttribute('d'); | ||
await expect(loc).toHaveText('Spain'); | ||
}); | ||
|
||
test('data array', async ({ page }) => { | ||
await page.goto('http://localhost:8000/examples/data-array.html'); | ||
|
||
const loc = page.locator('path.unit-ESP'); | ||
await expect(loc).toBeVisible(); | ||
await expect(loc).toHaveAttribute('style', /fill/); | ||
}); | ||
|
||
test('missing unit id', async ({ page }) => { | ||
await page.goto('http://localhost:8000/examples/missing-unitid.html'); | ||
|
||
const loc = page.locator('path.unit-'); | ||
await expect(loc).toBeVisible(); | ||
await expect(loc).toHaveCSS('fill', 'rgb(0, 0, 0)'); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.