1- name : Selenium Tests
1+ name : Build and Run Tests
22
33on :
4- workflow_dispatch : # Allows running manually
5- schedule :
6- - cron : ' 0 0 * * *' # Run each day at 00:00 UTC
4+ pull_request :
75
86jobs :
9- selenium-tests :
10- runs-on : macos-latest
11- env :
12- DEV_URL : ${{ vars.DEV_URL }}
13- STAG_URL : ${{ vars.STAG_URL }}
14-
15- permissions :
16- checks : write
7+ build :
8+ name : Build and Run Tests
9+ runs-on : ubuntu-latest
1710
1811 steps :
19- - name : Checkout repository
12+ - name : Checkout Code
2013 uses : actions/checkout@v3
2114
22- - name : Setup Python
15+ - name : Set up Python
2316 uses : actions/setup-python@v3
2417 with :
2518 python-version : " 3.10"
2619
27- - name : Install Chrome and WebDriver if not already installed
28- run : |
29- if ! command -v google-chrome &>/dev/null; then
30- echo "Installing Chrome"
31- brew install --cask google-chrome
32- else
33- echo "Chrome is already installed"
34- fi
35-
36- - name : Install Poetry
37- run : |
38- python -m pip install --upgrade pip
39- pip install poetry
20+ - name : Cache Dependencies
21+ uses : actions/cache@v3
22+ with :
23+ path : ~/.cache/pip
24+ key : python-cache-${{ runner.os }}-${{ hashFiles('requirements.txt') }}
25+ restore-keys : |
26+ python-cache-${{ runner.os }}-
4027
41- - name : Install dependencies with Poetry
28+ - name : Install Dependencies
4229 run : |
43- poetry install
30+ python -m pip install --upgrade pip
31+ pip install -r requirements.txt
4432
45- - name : Run tests
33+ - name : Run Tests
4634 run : |
47- poetry run pytest --verbose --junit-xml=test-results.xml --capture=tee-sys
48-
49- - name : Publish Test Report
50- uses : mikepenz/action-junit-report@v3
51- if : success() || failure()
52- with :
53- report_paths : ' **/test-results.xml'
54- detailed_summary : true
55- include_passed : true
35+ pytest --junit-xml=build/test-results/test/TEST-results.xml --verbose
36+ continue-on-error : true # Ensures that test results are collected even if some tests fail
5637
57- - name : Upload Screenshots
58- if : failure()
38+ - name : Upload Test Report
5939 uses : actions/upload-artifact@v3
40+ if : always() # Always run this step even if tests fail
6041 with :
61- name : screenshots
62- path : reports/screenshots/*
42+ name : junit-test-results
43+ path : build/test-results/test/TEST-results.xml
44+ retention-days : 1
0 commit comments