Added some documentation

This commit is contained in:
Naomi 2018-09-26 16:18:57 +01:00
parent 17f0efd424
commit bc5cddb5ee
2 changed files with 13 additions and 0 deletions

View File

@ -195,12 +195,17 @@ $ python manage.py runserver
# Running The Tests
You will need to install chromedriver, and if you want to test in Firefox (see comments in `ojusomap/tests.py`) you will also need to install geckodriver. To install either of these you need to download the zip file for your architecture from http://chromedriver.chromium.org/downloads or https://github.com/mozilla/geckodriver/releases and unzip it into a place on your `PATH`. Each zip just contains a single binary, so it is very straightforward.
```bash
$ pip install -r requirements-test.txt
$ python manage.py collectstatic
$ pytest -v
```
NB. The "map" tests use selenium with chrome driver, but in headless mode so that they can run in GitLab CI. If you want to see them running, you can comment out the relevant line in `ojusomap/tests.py` (search for "headless")
# Troubleshooting
Sometimes, you see crashes like the following with `psycopg`:

View File

@ -22,8 +22,16 @@ TIMEOUT = 8
class SeleniumTest(LiveServerTestCase):
@classmethod
def setUpClass(cls):
### To test with firefox, uncomment these lines and comment those pertaining
### to Chrome. However, it will not work with GitLab CI because the docker
### container does not have the geckodriver installed.
# profile = webdriver.FirefoxProfile()
# profile.set_preference("dom.forms.number", False)
# cls.sl = webdriver.Firefox(profile)
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
# comment out this next line in order to see the tests running in a browser.
# But be sure to put it back before comitting, or gitlab CI will fail.
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
cls.sl = webdriver.Chrome(chrome_options=chrome_options)