Use YAML files in config/ to store environment variables like URLs, browsers, and credentials.
Example config.yaml:
environment: staging
base_url: "https://staging.example.com"
browser: chrome
Example credentials.yaml (keep private, do not commit secrets):
username: "testuser"
password: "securepassword"
GitHub Actions workflow uses secrets stored in GitHub repository settings for sensitive data.
Workflow example snippet to run tests on multiple Python versions and browsers:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.10, 3.11]
browser: [chrome, firefox]
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Selenium tests
env:
BROWSER: ${{ matrix.browser }}
BASE_URL: ${{ secrets.BASE_URL }}
USERNAME: ${{ secrets.USERNAME }}
PASSWORD: ${{ secrets.PASSWORD }}
run: |
pytest tests/ --html=reports/test_report.html