Skip to content

Commit 103c3ca

Browse files
committed
feat: execute behave, pytest and nose2 tests in PRs
1 parent ae16741 commit 103c3ca

2 files changed

Lines changed: 196 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 193 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,210 @@ name: build
33
on: [push, pull_request]
44

55
jobs:
6-
test:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v6
10+
- name: Set up python 3.11
11+
uses: actions/setup-python@v6
12+
with:
13+
python-version: '3.11'
14+
- name: Install dependencies
15+
run: |
16+
python -m pip install --upgrade pip
17+
pip install -r requirements.txt
18+
pip install -r requirements_dev.txt
19+
- name: Lint and format check with ruff
20+
run: |
21+
ruff check .
22+
ruff format --check .
23+
24+
behave-tests:
725
runs-on: ubuntu-latest
826
strategy:
927
matrix:
10-
python-version: ['3.13']
28+
python-version: ['3.10', '3.11', '3.12', '3.13']
1129
fail-fast: false
30+
steps:
31+
- uses: actions/checkout@v6
32+
- name: Set up python ${{ matrix.python-version }}
33+
uses: actions/setup-python@v6
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
- name: Install dependencies
37+
run: |
38+
python -m pip install --upgrade pip
39+
pip install -r requirements.txt
40+
pip install -r requirements_dev.txt
41+
- name: Run tests
42+
env:
43+
TOOLIUM_DRIVER_HEADLESS: Driver_headless=true
44+
run: |
45+
behave web_behave/features/ --junit --junit-directory web_behave/output/reports
46+
continue-on-error: true
47+
- name: Upload output folder
48+
uses: actions/upload-artifact@v7
49+
if: always()
50+
with:
51+
name: behave-tests-output-${{ matrix.python-version }}
52+
path: web_behave/output
53+
- name: Publish test results
54+
uses: dorny/test-reporter@v3
55+
if: always()
56+
with:
57+
name: behave tests results (${{ matrix.python-version }})
58+
path: web_behave/output/reports/*.xml
59+
reporter: java-junit
60+
fail-on-error: true
1261

62+
pytest-tests:
63+
runs-on: ubuntu-latest
64+
strategy:
65+
matrix:
66+
python-version: ['3.10', '3.11', '3.12', '3.13']
67+
fail-fast: false
1368
steps:
14-
- uses: actions/checkout@v3
15-
- name: Set up Python ${{ matrix.python-version }}
16-
uses: actions/setup-python@v3
69+
- uses: actions/checkout@v6
70+
- name: Set up python ${{ matrix.python-version }}
71+
uses: actions/setup-python@v6
1772
with:
1873
python-version: ${{ matrix.python-version }}
1974
- name: Install dependencies
2075
run: |
2176
python -m pip install --upgrade pip
2277
pip install -r requirements.txt
2378
pip install -r requirements_dev.txt
24-
- name: Lint and format check with ruff
79+
- name: Run tests
80+
env:
81+
TOOLIUM_DRIVER_HEADLESS: Driver_headless=true
2582
run: |
26-
ruff check .
27-
ruff format --check .
83+
cd web_pytest
84+
python -m pytest --junitxml=output/reports/junit-pytest.xml
85+
continue-on-error: true
86+
- name: Upload output folder
87+
uses: actions/upload-artifact@v7
88+
if: always()
89+
with:
90+
name: pytest-tests-output-${{ matrix.python-version }}
91+
path: web_pytest/output
92+
- name: Publish test results
93+
uses: dorny/test-reporter@v3
94+
if: always()
95+
with:
96+
name: pytest tests results (${{ matrix.python-version }})
97+
path: web_pytest/output/reports/*.xml
98+
reporter: java-junit
99+
fail-on-error: true
100+
101+
nose2-tests:
102+
runs-on: ubuntu-latest
103+
strategy:
104+
matrix:
105+
python-version: ['3.10', '3.11', '3.12', '3.13']
106+
fail-fast: false
107+
steps:
108+
- uses: actions/checkout@v6
109+
- name: Set up python ${{ matrix.python-version }}
110+
uses: actions/setup-python@v6
111+
with:
112+
python-version: ${{ matrix.python-version }}
113+
- name: Install dependencies
114+
run: |
115+
python -m pip install --upgrade pip
116+
pip install -r requirements.txt
117+
pip install -r requirements_dev.txt
118+
- name: Run tests
119+
env:
120+
TOOLIUM_DRIVER_HEADLESS: Driver_headless=true
121+
run: |
122+
mkdir -p web_nose2/output/reports
123+
python -m nose2 web_nose2 -A '!local' --junit-xml-path web_nose2/output/reports/junit-nose.xml || true
124+
continue-on-error: true
125+
- name: Upload output folder
126+
uses: actions/upload-artifact@v7
127+
if: always()
128+
with:
129+
name: nose2-tests-output-${{ matrix.python-version }}
130+
path: web_nose2/output
131+
- name: Publish test results
132+
uses: dorny/test-reporter@v3
133+
if: always()
134+
with:
135+
name: nose2 tests results (${{ matrix.python-version }})
136+
path: web_nose2/output/reports/*.xml
137+
reporter: java-junit
138+
fail-on-error: true
139+
140+
playwright-tests:
141+
runs-on: ubuntu-latest
142+
strategy:
143+
matrix:
144+
python-version: ['3.10', '3.11', '3.12', '3.13']
145+
fail-fast: false
146+
steps:
147+
- uses: actions/checkout@v6
148+
- name: Set up python ${{ matrix.python-version }}
149+
uses: actions/setup-python@v6
150+
with:
151+
python-version: ${{ matrix.python-version }}
152+
- name: Install dependencies
153+
run: |
154+
python -m pip install --upgrade pip
155+
pip install -r requirements.txt
156+
pip install -r requirements_dev.txt
157+
pip install toolium[playwright]
158+
playwright install
159+
- name: Run tests
160+
env:
161+
TOOLIUM_DRIVER_HEADLESS: Driver_headless=true
162+
run: |
163+
behave web_playwright_behave/features --junit --junit-directory web_playwright_behave/output/reports/
164+
continue-on-error: true
165+
- name: Upload output folder
166+
uses: actions/upload-artifact@v7
167+
if: always()
168+
with:
169+
name: playwright-tests-output-${{ matrix.python-version }}
170+
path: web_playwright_behave/output
171+
- name: Publish test results
172+
uses: dorny/test-reporter@v3
173+
if: always()
174+
with:
175+
name: playwright tests results (${{ matrix.python-version }})
176+
path: web_playwright_behave/output/reports/*.xml
177+
reporter: java-junit
178+
fail-on-error: true
179+
180+
combine-artifacts:
181+
runs-on: ubuntu-latest
182+
needs: [behave-tests, pytest-tests, nose2-tests, playwright-tests]
183+
if: always()
184+
steps:
185+
- name: Download all artifacts
186+
uses: actions/download-artifact@v5
187+
with:
188+
path: all-artifacts
189+
- name: Create combined structure
190+
run: |
191+
mkdir -p tests-results
192+
echo "=== Downloaded artifacts ==="
193+
ls -la all-artifacts/
194+
# Organize by framework and Python version
195+
for framework in behave pytest nose2 playwright; do
196+
mkdir -p "tests-results/$framework"
197+
for version in 3.10 3.11 3.12 3.13; do
198+
if [ -d "all-artifacts/${framework}-tests-output-${version}" ]; then
199+
echo "Moving $framework Python $version results..."
200+
mv "all-artifacts/${framework}-tests-output-${version}" "tests-results/$framework/python-${version}"
201+
fi
202+
done
203+
done
204+
echo "=== Combined structure ==="
205+
tree tests-results || find tests-results -type d
206+
echo "=== Total files ==="
207+
find tests-results -type f | wc -l
208+
- name: Upload combined artifacts
209+
uses: actions/upload-artifact@v7
210+
with:
211+
name: tests results
212+
path: tests-results/

web_nose2/tests/test_web_visual_testing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,6 @@ def test_successful_login_logout_visualtesting_examples(self):
8787

8888
# Assert the full screen
8989
self.assert_full_screenshot('login_logout')
90+
91+
# Add local attribute to allow skiping it in CI, it can only be executed locally
92+
test_successful_login_logout_visualtesting_examples.local = 1

0 commit comments

Comments
 (0)