Refactor API and UI test workflows to improve readability and consistency; update base URL retrieval to use environment variable for flexibility

This commit is contained in:
omri zaher 2025-08-11 11:44:56 +03:00
parent 6b3560c8d3
commit 97fb01f3bc
4 changed files with 19 additions and 7 deletions

View file

@ -1,25 +1,35 @@
name: Run Tests with coverage name: Run API Tests
on: on:
pull_request: pull_request:
branches: branches:
- main - main
workflow_dispatch: # Allows manual triggering of the workflow
jobs: jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 # Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up Python
- name: Set up Python 3.12 - name: Set up Python 3.12
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: "3.12" python-version: "3.12"
# Step 3: Install dependencies
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Run tests # Step 4: Run API tests
run: pytest - name: Run API tests
env:
BASE_URL: ${{ secrets.BASE_URL }} # Example: Pass API base URL as a secret
run: |
pytest --maxfail=5 --disable-warnings -v

View file

@ -1,4 +1,4 @@
name: Selenium UI Tests name: Run UI Tests
on: on:
pull_request: pull_request:

View file

@ -1,6 +1,7 @@
import os
import requests import requests
base_url = "http://10.0.0.17" base_url = os.environ.get("WEKAN_URL", "http://localhost")
class TestLogin: class TestLogin:
def test_health_check(self): def test_health_check(self):

View file

@ -1,7 +1,8 @@
import pytest import pytest
import requests import requests
import os
base_url = "http://10.0.0.17" base_url = os.environ.get("WEKAN_URL", "http://localhost")
class TestBoard: class TestBoard:
@pytest.fixture(scope="class", autouse=True) @pytest.fixture(scope="class", autouse=True)