diff --git a/.github/workflows/api-testing.yml b/.github/workflows/api-testing.yml new file mode 100644 index 000000000..35988b05d --- /dev/null +++ b/.github/workflows/api-testing.yml @@ -0,0 +1,45 @@ +name: Run API Tests + +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v4 + with: + python-version: "3.12" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: App Startup with Docker + run: | + docker compose up -d + + - name: Add test user to MongoDB + run: | + docker exec wekan-db mongosh wekan --eval ' + db.users.insertOne({ + username: "omriza5", + password: "123456", + email: "omriza5@gmail.com", + isAdmin: false + }) + ' + + - name: Run API tests + env: + BASE_URL: ${{ secrets.WEKAN_URL }} # Example: Pass API base URL as a secret + run: | + pytest --maxfail=5 --disable-warnings -v diff --git a/.github/workflows/ui-testing.yml b/.github/workflows/ui-testing.yml index cd8797fb2..b37250759 100644 --- a/.github/workflows/ui-testing.yml +++ b/.github/workflows/ui-testing.yml @@ -1,4 +1,4 @@ -name: Selenium UI Tests +name: Run UI Tests on: pull_request: diff --git a/pytest.ini b/pytest.ini index 04ec5a3a7..3a1f42ecf 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,3 @@ [pytest] testpaths = tests -addopts = -s +addopts = -s -v diff --git a/tests/auth/test_login.py b/tests/auth/test_login.py index d38876555..294875ed6 100644 --- a/tests/auth/test_login.py +++ b/tests/auth/test_login.py @@ -1,6 +1,7 @@ +import os import requests -base_url = "http://10.0.0.17" +base_url = os.environ.get("BASE_URL", "http://localhost") class TestLogin: def test_health_check(self): diff --git a/tests/board/test_board.py b/tests/board/test_board.py index 45c22fba9..062721eaf 100644 --- a/tests/board/test_board.py +++ b/tests/board/test_board.py @@ -1,7 +1,8 @@ import pytest import requests +import os -base_url = "http://10.0.0.17" +base_url = os.environ.get("BASE_URL", "http://localhost") class TestBoard: @pytest.fixture(scope="class", autouse=True)