Using backstopjs we can get more security how changes to CSS or JS will affect the GeoNode GUI by before-and-after comparison.
The setup uses puppeteer, make sure to have a up-to-date Chrome installation on your machine.
- Clone this repository
- Install dependencies f.e.
yarn
ornpm -install
# create reference images
yarn ref
# test the scenarios
yarn test
# approve changes
yarn approve
# wipe out data
yarn clean
We're using local paver set up for development / testing. Of course, you could also use your local docker stack or even your production environment as a test environment.
- Start you local GeoNode environment
paver setup_data && paver start
- Set base URL in .env (default: http://localhost:8000)
- Login to your GeoNode and save the cookie to
./backstop_data/engine_scripts /cookie.js
(In case you like to test protected views) [*] - Create reference images with
yarn ref
- Do your changes to JS or CSS
- Test you changes
yarn test
- Check the report, if you find unwanted behaviors fix your code or approve changes
yarn approve
Visit the official BackstopJS docs for more: https://github.com/garris/BackstopJS#using-backstopjs
[*] to save the cookie as json we can use a nice extension as suggested here: https://github.com/garris/BackstopJS#setting-cookies
- The manual saving of Cookies could be automated
- The paver test server is sometimes slow. Hence
asyncCaptureLimit
has been set to a low value1
to not get timeouts and a locked database - Delays should be removed and instead DOM selectors used for testing when some ajax request has finished.
- home
- maps
- create Map
- documents
- layers
- layer detail (simple point demo data)
- layer upload
- metadata wizard
- people
- remote services
(Some tests expect the paver setup_data
to be present.)
- Duplicate a file in directory
./tests
- Change it to your needs
- Register it in
./backstopConfig.js