Basemaps has multiple styles that need to be validated on every change, this tool creates screenshots of the styles to be compared against previous runs.
docker run --rm -v $PWD:$PWD ghcr.io/linz/basemaps-screenshot/cli:v1.1.0 --url http://localhost:5000 --output $PWD/.artifacts/visual-snapshots-
Open a terminal to the root of the repository.
-
Run the following commands:
# Install Node.js dependencies npm install # Transpile the source code npm run build
There are two main ways to run the tool:
For each test, this mode outputs a screenshot of the resulting Basemaps site.
-
Using the default set of tests:
node bms.mjs \ --url "https://basemaps.linz.govt.nz" \ --output ./output-dir -
Using a custom set of tests:
node bms.mjs \ --url "https://basemaps.linz.govt.nz" \ --output ./output-dir \ --tests ./custom-tests.json
For each test, this mode outputs an additional image highlighting any differences between the two resulting Basemaps sites.
In the following examples, note the hardcoded parameters included in the diffUrl URL. The tool will preserve such parameters, overriding those defined in the test set. This allows the url and diffUrl URLs to target different tilesets (i=), matrices (p=), and styles (s=).
-
Using the default set of tests:
node bms.mjs \ --url "https://basemaps.linz.govt.nz" \ --diff-url "https://basemaps.linz.govt.nz/?s=topographic-v2&i=topographic&config=s3://linz-basemaps-staging/config/config-3yPz7p2RBWJBBrx25mZcF55RH8xqxUyFc71D8v4baEYk.json.gz" \ --output ./output-dir
-
Using a custom set of tests:
node bms.mjs \ --url "https://basemaps.linz.govt.nz" \ --diff-url "https://basemaps.linz.govt.nz/?s=topographic-v2&i=topographic&config=s3://linz-basemaps-staging/config/config-3yPz7p2RBWJBBrx25mZcF55RH8xqxUyFc71D8v4baEYk.json.gz" \ --output ./output-dir \ --tests ./custom-tests.json