Skip to content

Commit

Permalink
refactor: move tests/selenium to tests/integration
Browse files Browse the repository at this point in the history
The tests in this package:

- are larger in scope than a unit test
- are not quite end-to-end (as they mock out Datahub)
- may or may not use selenium
  • Loading branch information
MatMoore committed Aug 7, 2024
1 parent f74b189 commit 56bcdca
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/reusable-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ jobs:
# https://github.com/marketplace/actions/setup-chromedriver
uses: nanasess/[email protected]

- name: Run selenium tests
- name: Run integration tests
id: slow-tests
if: steps.fast-tests.outcome == 'success'
run: TESTING=True poetry run pytest tests/selenium --axe-version 4.9.1 --chromedriver-path /usr/local/bin/chromedriver
run: TESTING=True poetry run pytest tests/integration --axe-version 4.9.1 --chromedriver-path /usr/local/bin/chromedriver

javascript-only-tests:
name: Javascript tests
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ unit:
poetry run pytest --cov -m 'not slow'
npm test

# run selenium test - version works with chromedriver 127.0.1 use - `npm install -g [email protected]`
# Run integration tests. Requires chromedriver - version works with chromedriver 127.0.1 use - `npm install -g [email protected]`
integration:
export CHROMEDRIVER_PATH=$(which chromedriver)
poetry run pytest tests/selenium --axe-version 4.9.1 --chromedriver-path ${CHROMEDRIVER_PATH}
poetry run pytest tests/integration --axe-version 4.9.1 --chromedriver-path ${CHROMEDRIVER_PATH}


# Clean up (optional)
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,9 @@ Run `pre-commit install` from inside the poetry environment to set up pre commit
## Testing
- Python unit tests: `pytest -m 'not slow'`
- Javascript unit tests: `npm test`
- Selenium tests: `pytest -m tests/selenium`
- Search benchmarks (these query the real Datahub backend): `pytest tests/benchmarks`
- All tests `make test`
- Unit tests: `make unit`
- Integration tests: `make integration`
Selenium makes use of chromedriver to run a headless browser.
As either the chrome browser or chromedriver are updated,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 56bcdca

Please sign in to comment.