Skip to content

Commit

Permalink
Merge pull request #246 from PDOK/html-tests
Browse files Browse the repository at this point in the history
test: add e2e HTML validation tests
  • Loading branch information
rkettelerij authored Oct 1, 2024
2 parents 2542661 + eb7d121 commit 14cfada
Show file tree
Hide file tree
Showing 25 changed files with 689 additions and 75 deletions.
2 changes: 1 addition & 1 deletion internal/engine/templates/layout.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<meta property="og:image:type" content="image/png" />
<meta property="og:image:alt" content="{{ i18n "Logo" }}" />

<script type="text/javascript">
<script>
// match window title to page title
window.addEventListener("load", (event) => {
if (document.getElementById("title")) {
Expand Down
20 changes: 10 additions & 10 deletions internal/engine/testdata/expected_conformance.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<table class="table table-borderless table-sm">
<thead>
<tr>
<th>Conformance</th>
<th>Status</th>
<th scope="col">Conformance</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -38,8 +38,8 @@ <h2 class="card-header h5">Features</h2>
<table class="table table-borderless table-sm">
<thead>
<tr>
<th>Conformance</th>
<th>Status</th>
<th scope="col">Conformance</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -75,8 +75,8 @@ <h2 class="card-header h5">Styles</h2>
<table class="table table-borderless table-sm">
<thead>
<tr>
<th>Conformance</th>
<th>Status</th>
<th scope="col">Conformance</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
Expand All @@ -100,8 +100,8 @@ <h2 class="card-header h5">3D GeoVolumes</h2>
<table class="table table-borderless table-sm">
<thead>
<tr>
<th>Conformance</th>
<th>Status</th>
<th scope="col">Conformance</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
Expand All @@ -121,8 +121,8 @@ <h2 class="card-header h5">Tiles</h2>
<table class="table table-borderless table-sm">
<thead>
<tr>
<th>Conformance</th>
<th>Status</th>
<th scope="col">Conformance</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
Expand Down
24 changes: 12 additions & 12 deletions internal/ogc/common/core/templates/conformance.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ <h2 class="card-header h5">Common</h2>
<table class="table table-borderless table-sm">
<thead>
<tr>
<th>Conformance</th>
<th>Status</th>
<th scope="col">Conformance</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -59,8 +59,8 @@ <h2 class="card-header h5">Features</h2>
<table class="table table-borderless table-sm">
<thead>
<tr>
<th>Conformance</th>
<th>Status</th>
<th scope="col">Conformance</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -125,8 +125,8 @@ <h2 class="card-header h5">Styles</h2>
<table class="table table-borderless table-sm">
<thead>
<tr>
<th>Conformance</th>
<th>Status</th>
<th scope="col">Conformance</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
Expand All @@ -153,8 +153,8 @@ <h2 class="card-header h5">3D GeoVolumes</h2>
<table class="table table-borderless table-sm">
<thead>
<tr>
<th>Conformance</th>
<th>Status</th>
<th scope="col">Conformance</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
Expand All @@ -177,8 +177,8 @@ <h2 class="card-header h5">Tiles</h2>
<table class="table table-borderless table-sm">
<thead>
<tr>
<th>Conformance</th>
<th>Status</th>
<th scope="col">Conformance</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -249,8 +249,8 @@ <h2 class="card-header h5">Processes</h2>
<table class="table table-borderless table-sm">
<thead>
<tr>
<th>Conformance</th>
<th>Status</th>
<th scope="col">Conformance</th>
<th scope="col">Status</th>
</tr>
</thead>
<tbody>
Expand Down
4 changes: 2 additions & 2 deletions internal/ogc/features/templates/feature.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h1 class="title h2" id="title">{{ .Config.Title }} - {{ if and .Params.Metadata
<table class="table table-striped">
<thead>
<tr>
<th colspan="2">{{ .Params.FeatureID }}</th>
<th colspan="2" scope="row">{{ .Params.FeatureID }}</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -86,7 +86,7 @@ <h1 class="title h2" id="title">{{ .Config.Title }} - {{ if and .Params.Metadata
<div class="col-md-4 col-sm-12">
<link rel="stylesheet" type="text/css" href="view-component/styles.css">
<script type="module" src="view-component/main.js"></script>
<script type="text/javascript" src="view-component/polyfills.js"></script>
<script src="view-component/polyfills.js"></script>

{{/* different viewer settings depending on whether features are map sheets or not */}}
{{ if $mapSheetProperties }}
Expand Down
4 changes: 2 additions & 2 deletions internal/ogc/features/templates/features.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ <h2 class="card-header h5">
<div class="col-md-6 col-sm-12">
<link rel="stylesheet" type="text/css" href="view-component/styles.css">
<script type="module" src="view-component/main.js"></script>
<script type="text/javascript" src="view-component/polyfills.js"></script>
<script src="view-component/polyfills.js"></script>

{{/* different viewer settings depending on whether features are map sheets or not */}}
{{ if $mapSheetProperties }}
Expand Down Expand Up @@ -267,7 +267,7 @@ <h2 class="card-header h5">
<table class="table table-striped">
<thead>
<tr>
<th colspan="2"><a href="{{ $baseUrl }}/collections/{{ $.Params.CollectionID }}/items/{{ $feat.ID }}" aria-label="{{ i18n "To" }} feature {{ $feat.ID }}">{{ $feat.ID }}</a></th>
<th colspan="2" scope="row"><a href="{{ $baseUrl }}/collections/{{ $.Params.CollectionID }}/items/{{ $feat.ID }}" aria-label="{{ i18n "To" }} feature {{ $feat.ID }}">{{ $feat.ID }}</a></th>
</tr>
</thead>
<tbody>
Expand Down
2 changes: 1 addition & 1 deletion internal/ogc/features/testdata/expected_feature_4030.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<table class="table table-striped">
<thead>
<tr>
<th colspan="2">4030</th>
<th colspan="2" scope="row">4030</th>
</tr>
</thead>
<tbody>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<table class="table table-striped">
<thead>
<tr>
<th colspan="2"><a href="http://localhost:8080/collections/foo/items/3542" aria-label="Ga naar feature 3542">3542</a></th>
<th colspan="2" scope="row"><a href="http://localhost:8080/collections/foo/items/3542" aria-label="Ga naar feature 3542">3542</a></th>
</tr>
</thead>
<tbody>
Expand Down
2 changes: 1 addition & 1 deletion internal/ogc/styles/templates/style.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1 class="title" id="title">{{ .Config.Title }} - {{ .Params.Title }}</h1>
<div class="col-md-6">
<link rel="stylesheet" type="text/css" href="view-component/styles.css">
<script type="module" src="view-component/main.js"></script>
<script type="text/javascript" src="view-component/polyfills.js"></script>
<script src="view-component/polyfills.js"></script>
<app-legend-view id="style-legend-view" class="card"
style-url="{{ $baseUrl }}/styles/{{ .Params.ID }}?f=mapbox">
</app-legend-view>
Expand Down
2 changes: 1 addition & 1 deletion internal/ogc/styles/templates/styles.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h1 class="title" id="title">{{ .Config.Title }} - {{ i18n "Styles" }}</h1>
<div class="col-md-6">
<link rel="stylesheet" type="text/css" href="view-component/styles.css">
<script type="module" src="view-component/main.js"></script>
<script type="text/javascript" src="view-component/polyfills.js"></script>
<script src="view-component/polyfills.js"></script>
<p>{{ i18n "StylingExample" }}:</p>
<app-vectortile-view id="styles-vectortile-view" class="card vectortile-view"
tile-url="{{ $baseUrl }}/tiles/{{ get $projections $defaultSrs.Srs }}"
Expand Down
4 changes: 2 additions & 2 deletions internal/ogc/tiles/templates/tileMatrixSets.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ <h1 class="title" id="title">{{ .Config.Title }} - {{ i18n "TileMatrixSets" }}</
<table class="table table-striped">
<thead>
<tr>
<th>Tile Matrix Set</th>
<th>{{ i18n "Description" }}</th>
<th scope="col">Tile Matrix Set</th>
<th scope="col">{{ i18n "Description" }}</th>
</tr>
</thead>
<tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ <h1 class="title" id="title">EuropeanETRS89_LAEAQuad</h1>
<table class="table table-striped">
<thead>
<tr>
<th>{{ i18n "ZoomLevel" }}<br/>(tile matrix id)</th>
<th>Tile width</th>
<th>Tile height</th>
<th>Matrix width</th>
<th>Matrix height</th>
<th>Scale</th>
<th>Cell size</th>
<th>Point of origin</th>
<th scope="col">{{ i18n "ZoomLevel" }}<br/>(tile matrix id)</th>
<th scope="col">Tile width</th>
<th scope="col">Tile height</th>
<th scope="col">Matrix width</th>
<th scope="col">Matrix height</th>
<th scope="col">Scale</th>
<th scope="col">Cell size</th>
<th scope="col">Point of origin</th>
</tr>
</thead>
<tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ <h1 class="title" id="title">NetherlandsRDNewQuad</h1>
<table class="table table-striped">
<thead>
<tr>
<th>{{ i18n "ZoomLevel" }}<br/>(tile matrix id)</th>
<th>Tile width</th>
<th>Tile height</th>
<th>Matrix width</th>
<th>Matrix height</th>
<th>Scale</th>
<th>Cell size</th>
<th>Point of origin</th>
<th scope="col">{{ i18n "ZoomLevel" }}<br/>(tile matrix id)</th>
<th scope="col">Tile width</th>
<th scope="col">Tile height</th>
<th scope="col">Matrix width</th>
<th scope="col">Matrix height</th>
<th scope="col">Scale</th>
<th scope="col">Cell size</th>
<th scope="col">Point of origin</th>
</tr>
</thead>
<tbody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ <h1 class="title" id="title">WebMercatorQuad</h1>
<table class="table table-striped">
<thead>
<tr>
<th>{{ i18n "ZoomLevel" }}<br/>(tile matrix id)</th>
<th>Tile width</th>
<th>Tile height</th>
<th>Matrix width</th>
<th>Matrix height</th>
<th>Scale</th>
<th>Cell size</th>
<th>Point of origin</th>
<th scope="col">{{ i18n "ZoomLevel" }}<br/>(tile matrix id)</th>
<th scope="col">Tile width</th>
<th scope="col">Tile height</th>
<th scope="col">Matrix width</th>
<th scope="col">Matrix height</th>
<th scope="col">Scale</th>
<th scope="col">Cell size</th>
<th scope="col">Point of origin</th>
</tr>
</thead>
<tbody>
Expand Down
2 changes: 1 addition & 1 deletion internal/ogc/tiles/templates/tiles.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h1 class="title" id="title">{{ .Config.Title }} - {{ i18n "Tiles" }}</h1>
</table>
<link rel="stylesheet" type="text/css" href="view-component/styles.css">
<script type="module" src="view-component/main.js"></script>
<script type="text/javascript" src="view-component/polyfills.js"></script>
<script src="view-component/polyfills.js"></script>
<app-vectortile-view id="vectortileviewer" class="card vectortile-view"
tile-url="{{ $baseUrlTiles }}/tiles/{{ get $projections $defaultSrs.Srs }}"
{{ if .Config.OgcAPI.Styles }}style-url="{{ $.Config.BaseURL }}/styles/{{ .Config.OgcAPI.Styles.Default }}?f=mapbox"{{ end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ <h2>Tile matrix set limits</h2>
<table class="table table-striped">
<thead>
<tr>
<th>{{ i18n "ZoomLevel" }} {z}</th>
<th>{{ i18n "MinimumValue" }} {y}</th>
<th>{{ i18n "MaximumValue" }} {y}</th>
<th>{{ i18n "MinimumValue" }} {x}</th>
<th>{{ i18n "MaximumValue" }} {x}</th>
<th scope="col">{{ i18n "ZoomLevel" }} {z}</th>
<th scope="col">{{ i18n "MinimumValue" }} {y}</th>
<th scope="col">{{ i18n "MaximumValue" }} {y}</th>
<th scope="col">{{ i18n "MinimumValue" }} {x}</th>
<th scope="col">{{ i18n "MaximumValue" }} {x}</th>
</tr>
</thead>
<tbody>
Expand Down
10 changes: 5 additions & 5 deletions internal/ogc/tiles/templates/tiles/NetherlandsRDNewQuad.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ <h2>Tile matrix set limits</h2>
<table class="table table-striped">
<thead>
<tr>
<th>{{ i18n "ZoomLevel" }} {z}</th>
<th>{{ i18n "MinimumValue" }} {y}</th>
<th>{{ i18n "MaximumValue" }} {y}</th>
<th>{{ i18n "MinimumValue" }} {x}</th>
<th>{{ i18n "MaximumValue" }} {x}</th>
<th scope="col">{{ i18n "ZoomLevel" }} {z}</th>
<th scope="col">{{ i18n "MinimumValue" }} {y}</th>
<th scope="col">{{ i18n "MaximumValue" }} {y}</th>
<th scope="col">{{ i18n "MinimumValue" }} {x}</th>
<th scope="col">{{ i18n "MaximumValue" }} {x}</th>
</tr>
</thead>
<tbody>
Expand Down
10 changes: 5 additions & 5 deletions internal/ogc/tiles/templates/tiles/WebMercatorQuad.go.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ <h2>Tile matrix set limits</h2>
<table class="table table-striped">
<thead>
<tr>
<th>{{ i18n "ZoomLevel" }} {z}</th>
<th>{{ i18n "MinimumValue" }} {y}</th>
<th>{{ i18n "MaximumValue" }} {y}</th>
<th>{{ i18n "MinimumValue" }} {x}</th>
<th>{{ i18n "MaximumValue" }} {x}</th>
<th scope="col">{{ i18n "ZoomLevel" }} {z}</th>
<th scope="col">{{ i18n "MinimumValue" }} {y}</th>
<th scope="col">{{ i18n "MaximumValue" }} {y}</th>
<th scope="col">{{ i18n "MinimumValue" }} {x}</th>
<th scope="col">{{ i18n "MaximumValue" }} {x}</th>
</tr>
</thead>
<tbody>
Expand Down
8 changes: 7 additions & 1 deletion tests/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { defineConfig } from "cypress";
import htmlvalidate from "cypress-html-validate/plugin";

export default defineConfig({
e2e: {
baseUrl: 'http://localhost:8080',
setupNodeEvents(on, config) {
// implement node event listeners here
htmlvalidate.install(on, {
rules: {
"require-sri": "off",
"element-permitted-content": "off" // only because we use RDFa breadcrumbs
},
});
},
},
});
Loading

0 comments on commit 14cfada

Please sign in to comment.