Added some documentation
This commit is contained in:
parent
17f0efd424
commit
bc5cddb5ee
@ -195,12 +195,17 @@ $ python manage.py runserver
|
|||||||
|
|
||||||
# Running The Tests
|
# 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
|
```bash
|
||||||
|
|
||||||
$ pip install -r requirements-test.txt
|
$ pip install -r requirements-test.txt
|
||||||
$ python manage.py collectstatic
|
$ python manage.py collectstatic
|
||||||
$ pytest -v
|
$ 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
|
# Troubleshooting
|
||||||
|
|
||||||
Sometimes, you see crashes like the following with `psycopg`:
|
Sometimes, you see crashes like the following with `psycopg`:
|
||||||
|
@ -22,8 +22,16 @@ TIMEOUT = 8
|
|||||||
class SeleniumTest(LiveServerTestCase):
|
class SeleniumTest(LiveServerTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
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 = webdriver.ChromeOptions()
|
||||||
chrome_options.add_argument('--no-sandbox')
|
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('--headless')
|
||||||
chrome_options.add_argument('--disable-gpu')
|
chrome_options.add_argument('--disable-gpu')
|
||||||
cls.sl = webdriver.Chrome(chrome_options=chrome_options)
|
cls.sl = webdriver.Chrome(chrome_options=chrome_options)
|
||||||
|
Loading…
Reference in New Issue
Block a user