-
Notifications
You must be signed in to change notification settings - Fork 0
Testing
There are several tests you can perform to check Datawrapper is still functional:
All instructions assume that you are in your Datawrapper root directory.
This test calls a couple of API functions to check they're working properly.
❯ cd test
❯ python api.test.py
The result should look something like this, (of source using whatever domain you're testing on):
testing on http://datawrapper.local
...............
----------------------------------------------------------------------
Ran 15 tests in 26.359s
OK
This test simulates an entire user life-cycle, from browsing around as guest, signing up for an account, logging in, creating charts, and finally deleting that account again. Requires casperjs.
❯ cd test/
❯ casperjs session.test.coffee
The result is a long list of actions. Ideally, every test should pass:
testing on http://datawrapper
PASS Website has correct title
PASS modal window has opened
PASS form input for registration exists
PASS account testuser-82358@localhost created
PASS logged in after sign up
PASS logged out
PASS login form exists
PASS logged in
PASS moved to settings page
PASS success message after profile change
PASS name correctly set
...
At first you need to create a few test charts using create-test-charts.php
. The script will add a new user "test" who owns the charts for easier removal.
❯ cd scripts/
❯ php create_test_charts.php
To see the charts, please visit
http://datawrapper.local/admin/charts/12
Then you have several options. One is to login as "test" and check the charts yourself. The other is to use Selenium Grid to run the tests automatically against multiple browsers and operating systems.
❯ cd test/
❯ python charts.test.api
now testing on firefox
now testing on chrome
now testing on xp-internet-explorer