diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 9590f0b..12dd25b 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -60,7 +60,7 @@ jobs: cp .env.testing app/.env cd app/ mkdir -p static_files - python manage.py test + python manage.py test --exclude-tag=selenium env: DJANGO_SETTINGS_MODULE: app.settings DATABASE_URL: postgres://sadilar:sadilar@localhost:5432/test_db @@ -68,6 +68,43 @@ jobs: run: | cd app/ python manage.py check + selenium: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:16 + env: + POSTGRES_USER: sadilar + POSTGRES_PASSWORD: sadilar + POSTGRES_DB: test_db_1 + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Install Dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-test.txt + sudo apt-get install -y gettext + - name: Create logging folder + run: | + sudo mkdir -p /logging + sudo chown runner:runner /logging + - name: Run Selenium Tests + run: | + cp .env.testing app/.env + cd app/ + mkdir -p static_files + python manage.py test --tag=selenium + env: + DJANGO_SETTINGS_MODULE: app.settings + DATABASE_URL: postgres://sadilar:sadilar@localhost:5432/test_db lighthouse: runs-on: ubuntu-latest # operating system your code will run on services: diff --git a/app/general/tests/test_frontend.py b/app/general/tests/test_frontend.py index 97779cd..adf1eac 100644 --- a/app/general/tests/test_frontend.py +++ b/app/general/tests/test_frontend.py @@ -1,4 +1,5 @@ from django.contrib.staticfiles.testing import StaticLiveServerTestCase +from django.test import tag from selenium.common import TimeoutException from selenium.webdriver.chrome.webdriver import Options, WebDriver from selenium.webdriver.common.by import By @@ -8,6 +9,7 @@ WAIT_TIMEOUT = 5 +@tag("selenium") class TestFrontend(StaticLiveServerTestCase): @classmethod def setUpClass(cls):