Skip to content

Commit d313238

Browse files
committed
Add Playwright cross-browser test suite
Add end-to-end tests for all supported service types (WMS 1.3.0, WMS 1.1.1, WMTS 1.0.0, ESRI MapServer tiled/dynamic, ESRI ImageServer) using Playwright with Chromium, Firefox, and WebKit. Tests use local fixture files with page.route() interception so no external services are required. 73 tests verify: - Service type detection from XML/JSON responses - Correct layer count and metadata display - MapML viewer generation with proper projection - map-layer, map-extent, map-input element structure - Image link tref with version-specific params (CRS vs SRS, I/J vs X/Y) - BBOX ordering (lat/lon for WMS 1.3.0 + EPSG:4326) - Query link generation for queryable layers - Tile link patterns for WMTS and ESRI tiled services - Export/exportImage link patterns for dynamic services - Dimension selectors and template variables - License and legend links Includes GitHub Actions CI workflow and npm test/test:ui scripts.
1 parent 77d0d67 commit d313238

20 files changed

+1580
-2
lines changed

.github/workflows/playwright.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [main, master]
5+
pull_request:
6+
branches: [main, master]
7+
jobs:
8+
test:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
14+
with:
15+
node-version: lts/*
16+
- name: Install dependencies
17+
run: npm ci
18+
- name: Install Playwright Browsers
19+
run: npx playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: npx playwright test
22+
- uses: actions/upload-artifact@v4
23+
if: ${{ !cancelled() }}
24+
with:
25+
name: playwright-report
26+
path: playwright-report/
27+
retention-days: 30

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
node_modules/
22
dist/
33
.DS_Store
4+
test-results/
5+
playwright-report/
6+
playwright/.cache/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
W3C Software and Document License
2+
3+
This work is being provided by the copyright holders under the following license.
4+
5+
License
6+
7+
By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
8+
9+
Permission to copy, modify, and distribute this work, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the work or portions thereof, including modifications:
10+
11+
- The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
12+
- Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software and Document Short Notice should be included.
13+
- Notice of any changes or modifications, through a copyright statement on the new code or document such as "This software or document includes material copied from or derived from [title and URI of the W3C document]. Copyright © [YEAR] World Wide Web Consortium. https://www.w3.org/copyright/software-license-2023/"
14+
15+
Disclaimers
16+
17+
THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
18+
19+
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT.
20+
21+
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the work without specific, written prior permission. Title to copyright in this work will at all times remain with copyright holders.

node_modules/.package-lock.json

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"scripts": {
77
"format": "prettier --write \"**/*.js\"",
88
"format:check": "prettier --check \"**/*.js\"",
9-
"serve": "npx http-server . -p 8000 -c-1"
9+
"serve": "npx http-server . -p 8000 -c-1",
10+
"test": "npx playwright test",
11+
"test:ui": "npx playwright test --ui"
1012
},
1113
"keywords": [
1214
"mapml",
@@ -15,11 +17,12 @@
1517
"ogc"
1618
],
1719
"author": "",
18-
"license": "ISC",
20+
"license": "W3C",
1921
"dependencies": {
2022
"@maps4html/mapml": "^0.16.0"
2123
},
2224
"devDependencies": {
25+
"@playwright/test": "^1.58.2",
2326
"http-server": "^14.1.1",
2427
"prettier": "^3.2.5"
2528
}

playwright.config.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
3+
export default defineConfig({
4+
testDir: './tests',
5+
fullyParallel: true,
6+
forbidOnly: !!process.env.CI,
7+
retries: process.env.CI ? 2 : 0,
8+
workers: process.env.CI ? 1 : undefined,
9+
reporter: 'html',
10+
use: {
11+
baseURL: 'http://localhost:8000',
12+
trace: 'on-first-retry',
13+
},
14+
projects: [
15+
{
16+
name: 'chromium',
17+
use: { ...devices['Desktop Chrome'] },
18+
},
19+
{
20+
name: 'firefox',
21+
use: { ...devices['Desktop Firefox'] },
22+
},
23+
{
24+
name: 'webkit',
25+
use: { ...devices['Desktop Safari'] },
26+
},
27+
],
28+
webServer: {
29+
command: 'npx http-server . -p 8000 -c-1',
30+
url: 'http://localhost:8000/src/index.html',
31+
reuseExistingServer: !process.env.CI,
32+
},
33+
});

0 commit comments

Comments
 (0)