• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..15-Dec-2021-

rendering/ol/H15-Dec-2021-

spec/ol/H15-Dec-2021-15,69815,608

.eslintrcH A D15-Dec-2021354 2019

README.mdH A D15-Dec-20211.9 KiB5734

README.md

1## Included in this directory
2
3- index.html - the web page used to run the test suite.
4
5- spec - includes the OpenLayers test/spec files.
6
7- test-extensions.js - includes OpenLayers-specific extensions to the
8  testing frameworks.
9
10
11## Run the test suite
12
13Install the test dependencies (from the root of the repository):
14
15    npm install
16
17Run the tests once:
18
19    npm test
20
21This will run tests in Chrome.  If you do not have Chrome installed, you can run tests on Firefox instead:
22
23    npm test -- --browsers Firefox
24
25To run tests in other browsers, you need to install [additional Karma launchers](http://karma-runner.github.io/1.0/config/browsers.html).
26
27To run the tests continuously:
28
29    npm run karma
30
31After this, the test server is listening on http://localhost:9876/, and you can
32attach any number of browsers for testing (during development, tests will run
33in Chrome by default).
34
35# Rendering tests
36
37The `test/rendering` directory contains rendering tests which compare a rendered map with a
38reference image using [pixelmatch](https://github.com/mapbox/pixelmatch).
39
40To run the tests in the browser, make sure the development server is running
41(`make serve`) and open the URL
42[http://localhost:3000/test_rendering/index.html](http://localhost:3000/test_rendering/index.html).
43
44From the command-line the tests can be run with the build target `make test-rendering`.
45
46## Adding new tests
47When creating a new test case, a reference image has to be created. By appending `?generate`
48to the URL, a canvas with the rendered map will be shown on the page when calling
49`expectResemble`. Then the reference image can simply be created with a right-click
50and "Save image as".
51
52It is recommended to only run a single test case when generating the reference image.
53
54## Image difference
55When a test fails, an image showing the difference between the reference image and the
56rendered map can be displayed by appending `?showdiff` to the URL.
57