Selenium Tests #133
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Selenium Tests | |
on: | |
workflow_dispatch: # Allows running manually | |
schedule: | |
- cron: '0 0 * * *' # Run every day at 00:00 UTC | |
jobs: | |
selenium-tests: | |
runs-on: macos-latest | |
env: | |
DEV_URL: ${{ vars.DEV_URL }} | |
STAG_URL: ${{ vars.STAG_URL }} | |
permissions: | |
checks: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.12" | |
- name: Cache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
.venv | |
key: python-cache-${{ runner.os }}-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
python-cache-${{ runner.os }}- | |
- name: Install Chrome and WebDriver if not already installed | |
run: | | |
if ! command -v google-chrome &>/dev/null; then | |
echo "Installing Chrome" | |
brew install --cask google-chrome | |
else | |
echo "Chrome is already installed" | |
fi | |
- name: Install Poetry | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
- name: Install dependencies with Poetry | |
run: | | |
poetry install | |
- name: Run Selenium Tests | |
run: | | |
poetry run pytest --verbose --junit-xml=reports/test-results.xml --capture=tee-sys | |
continue-on-error: true # Ensure other steps run even if tests fail | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v3 | |
if: always() # Always run this step, even if tests fail | |
with: | |
report_paths: 'reports/test-results.xml' | |
detailed_summary: true | |
include_passed: true | |
check_name: 'Test Results' | |
follow_symlink: True | |
- name: Upload Screenshots | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: screenshots | |
path: reports/screenshots/* | |
- name: Upload Test Results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: junit-test-results | |
path: reports/test-results.xml | |
retention-days: 1 |