Skip to content

Commit cbd73b2

Browse files
bors[bot]sanders41
andauthored
Merge #135
135: Browser tests r=bidoubiwa a=sanders41 Closes #130 Co-authored-by: Paul Sanders <[email protected]>
2 parents 68cd967 + f298f63 commit cbd73b2

36 files changed

+89
-27
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: Install dependencies
4545
run: pipenv install --dev
4646
- name: Run tests
47-
run: pipenv run pytest ./scraper/src -k "not _browser"
47+
run: pipenv run pytest
4848

4949
integration_tests:
5050
strategy:
@@ -70,13 +70,13 @@ jobs:
7070
env:
7171
MEILISEARCH_HOST_URL: 'http://127.0.0.1:7700'
7272
MEILISEARCH_API_KEY: 'masterKey'
73-
CONFIG_FILE: 'scraper/src/tests/config_files_examples/docs-basics.config.json'
73+
CONFIG_FILE: 'tests/config_files_examples/docs-basics.config.json'
7474
- name: Run the scraper with custom config
7575
run: pipenv run ./docs_scraper $CONFIG_FILE
7676
env:
7777
MEILISEARCH_HOST_URL: 'http://127.0.0.1:7700'
7878
MEILISEARCH_API_KEY: 'masterKey'
79-
CONFIG_FILE: 'scraper/src/tests/config_files_examples/docs-custom.config.json'
79+
CONFIG_FILE: 'tests/config_files_examples/docs-custom.config.json'
8080

8181
image_build:
8282
name: image-build

CONTRIBUTING.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,47 @@ pipenv run ./docs_scraper <path-to-your-config-file>
5656
pipenv install --dev
5757
# Linter
5858
pipenv run pylint scraper
59-
# Tests
60-
pipenv run pytest ./scraper/src -k "not _browser"
6159
```
6260

61+
If you have [a `chromedriver`](https://sites.google.com/chromium.org/driver/), you can run the full test suite by passing the path to your `chromedriver`.
62+
63+
```bash
64+
pipenv run pytest --chromedriver=/path/to/your/chromedriver
65+
```
66+
67+
Where `path/to/your/chromedriver` matches your particular path. If you are unsure of your `chromedriver` path you find it on Linux/Mac with:
68+
69+
70+
```bash
71+
which chromedriver
72+
```
73+
74+
Or on Windwos with:
75+
76+
```bash
77+
where chromedriver
78+
```
79+
80+
It is possible when running the tests that an error occurs if your running chrome browser has a different version than your chromedriver. In which case, please download the adequate [chromedriver](https://sites.google.com/chromium.org/driver/).
81+
82+
If you do not have `chromedriver` installed you can skip the tests that require it by running the tests with:
83+
84+
```bash
85+
pipenv run pytest -m "not chromedriver"
86+
```
87+
88+
Note that these tests will still run in CI when you submit your pull request.
89+
6390
Optionally tox can be used to run test on all supported version of Python and linting.
6491

6592
```bash
66-
pipenv run tox
93+
pipenv run tox -- --chromedriver=/path/to/your/chromedriver
94+
```
95+
96+
Or to run tox if you don't have chromedriver
97+
98+
```bash
99+
pipenv run tox -- -m "not chromedriver"
67100
```
68101

69102
## Git Guidelines

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
markers =
3+
chromedriver: mark a test as a test using chromedriver.

scraper/src/tests/config_files_examples/docs-basics.config.json renamed to tests/config_files_examples/docs-basics.config.json

File renamed without changes.

scraper/src/tests/config_files_examples/docs-custom.config.json renamed to tests/config_files_examples/docs-custom.config.json

File renamed without changes.
File renamed without changes.
File renamed without changes.

scraper/src/tests/config_loader/anchors_test.py renamed to tests/config_loader/anchors_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding: utf-8
2-
from ...config.config_loader import ConfigLoader
2+
from scraper.src.config.config_loader import ConfigLoader
33
from .abstract import config
44

55

scraper/src/tests/config_loader/basic_test.py renamed to tests/config_loader/basic_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding: utf-8
2-
from ...config.config_loader import ConfigLoader
2+
from scraper.src.config.config_loader import ConfigLoader
33
from .abstract import config
44
import pytest
55

0 commit comments

Comments
 (0)