Skip to content

Commit

Permalink
[ci] Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Aug 3, 2024
1 parent e544242 commit 01f78c6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 7 deletions.
36 changes: 30 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ jobs:
fail-fast: false
matrix:
python-version:
- "3.8"
- "3.9"
# - "3.8"
# - "3.9"
- "3.10"
django-version:
- django~=3.2.0
- django~=4.1.0
# - django~=3.2.0
# - django~=4.1.0
- django~=4.2.0

steps:
Expand All @@ -50,6 +50,25 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
requirements.txt
requirements-test.txt
- uses: browser-actions/setup-chrome@v1
# Using a fixed version, see here for more information on why:
# https://github.com/openwisp/openwisp-controller/issues/902#issuecomment-2266219715
# TODO: find a solution to allow using recent versions
with:
chrome-version: 125
install-chromedriver: true
id: setup-chrome

- run: |
${{ steps.setup-chrome.outputs.chrome-path }} --version
- name: Checkout code
uses: actions/checkout@v2

- name: Install Dependencies
id: deps
Expand All @@ -63,19 +82,24 @@ jobs:
pip install -U -r requirements-test.txt
pip install -U -e .
pip install ${{ matrix.django-version }}
pip install -U --no-deps --force-reinstall https://github.com/openwisp/openwisp-utils/tarball/chrome_bin
- name: QA checks
run: ./run-qa-checks

- name: Tests
if: ${{ !cancelled() && steps.deps.conclusion == 'success' }}
run: |
coverage run runtests.py --parallel
chromedriver --version
export CHROME_BIN=${{ steps.setup-chrome.outputs.chrome-path }}
cd tests
POSTGRESQL=1 DJANGO_SETTINGS_MODULE=openwisp2.postgresql_settings ./manage.py test --tag selenium_tests openwisp_controller.config.tests.test_selenium.TestDeviceAdmin.test_unsaved_changes
# coverage run runtests.py --parallel
# the following command runs tests with Postgres/PostGIS but
# only for specific test cases which are tagged with "db_tests"
POSTGRESQL=1 coverage run runtests.py --parallel --keepdb
# tests the extension capability
SAMPLE_APP=1 coverage run ./runtests.py --parallel --keepdb
# SAMPLE_APP=1 coverage run ./runtests.py --parallel --keepdb
coverage combine
coverage xml
env:
Expand Down
2 changes: 2 additions & 0 deletions openwisp_controller/config/tests/test_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ def test_unsaved_changes(self):
try:
WebDriverWait(self.web_driver, 1).until(EC.alert_is_present())
except TimeoutException:
for entry in self.web_driver.get_log('browser'):
print(entry)
self.fail('Timed out wating for unsaved changes alert')
else:
alert = Alert(self.web_driver)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ django-x509 @ https://github.com/openwisp/django-x509/tarball/master
django-loci @ https://github.com/openwisp/django-loci/tarball/master
django-flat-json-widget @ https://github.com/openwisp/django-flat-json-widget/tarball/master
openwisp-users @ https://github.com/openwisp/openwisp-users/tarball/master
openwisp-utils[celery] @ https://github.com/openwisp/openwisp-utils/tarball/master
openwisp-utils[celery] @ https://github.com/openwisp/openwisp-utils/tarball/chrome_bin
openwisp-notifications @ https://github.com/openwisp/openwisp-notifications/tarball/master
openwisp-ipam @ https://github.com/openwisp/openwisp-ipam/tarball/master
djangorestframework-gis~=0.18.0
Expand Down

0 comments on commit 01f78c6

Please sign in to comment.