1
- name : Build and Run Tests
1
+ name : Selenium Tests
2
2
3
3
on :
4
- pull_request :
4
+ workflow_dispatch : # Allows running manually
5
+ schedule :
6
+ - cron : ' 0 0 * * *' # Run every day at 00:00 UTC
5
7
6
8
jobs :
7
- build :
8
- name : Build and Run Tests
9
- runs-on : ubuntu-latest
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
10
17
11
18
steps :
12
- - name : Checkout Code
19
+ - name : Checkout repository
13
20
uses : actions/checkout@v3
14
21
15
- - name : Set up Python
22
+ - name : Setup Python
16
23
uses : actions/setup-python@v3
17
24
with :
18
- python-version : " 3.10 "
25
+ python-version : " 3.12 "
19
26
20
27
- name : Cache Dependencies
21
28
uses : actions/cache@v3
22
29
with :
23
- path : ~/.cache/pip
24
- key : python-cache-${{ runner.os }}-${{ hashFiles('requirements.txt') }}
30
+ path : |
31
+ ~/.cache/pip
32
+ .venv
33
+ key : python-cache-${{ runner.os }}-${{ hashFiles('poetry.lock') }}
25
34
restore-keys : |
26
35
python-cache-${{ runner.os }}-
27
36
28
- - name : Install Dependencies
37
+ - name : Install Chrome and WebDriver if not already installed
38
+ run : |
39
+ if ! command -v google-chrome &>/dev/null; then
40
+ echo "Installing Chrome"
41
+ brew install --cask google-chrome
42
+ else
43
+ echo "Chrome is already installed"
44
+ fi
45
+
46
+ - name : Install Poetry
29
47
run : |
30
48
python -m pip install --upgrade pip
31
- pip install -r requirements.txt
49
+ pip install poetry
50
+
51
+ - name : Install dependencies with Poetry
52
+ run : |
53
+ poetry install
32
54
33
- - name : Run Tests
55
+ - name : Run Selenium Tests
34
56
run : |
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
57
+ poetry run pytest --verbose --junit-xml=reports/test-results.xml --capture=tee-sys
58
+ continue-on-error : true # Ensure other steps run even if tests fail
59
+
60
+ - name : Publish Test Report
61
+ uses : mikepenz/action-junit-report@v3
62
+ if : always() # Always run this step, even if tests fail
63
+ with :
64
+ report_paths : ' reports/test-results.xml'
65
+ detailed_summary : true
66
+ include_passed : true
67
+ check_name : ' Test Results'
68
+
69
+ - name : Upload Screenshots
70
+ if : failure()
71
+ uses : actions/upload-artifact@v3
72
+ with :
73
+ name : screenshots
74
+ path : reports/screenshots/*
37
75
38
- - name : Upload Test Report
76
+ - name : Upload Test Results
77
+ if : always()
39
78
uses : actions/upload-artifact@v3
40
- if : always() # Always run this step even if tests fail
41
79
with :
42
80
name : junit-test-results
43
- path : build /test-results/test/TEST -results.xml
81
+ path : reports /test-results.xml
44
82
retention-days : 1
0 commit comments