Skip to content

Commit 383f663

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

2 files changed

Lines changed: 165 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 162 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,180 @@ 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 behave tests
42+
env:
43+
TOOLIUM_DRIVER_HEADLESS: Driver_headless=true
44+
run: |
45+
behave web_behave/features/ --junit --junit-directory output/reports/behave
46+
continue-on-error: true
47+
- name: Upload behave test reports
48+
uses: actions/upload-artifact@v5
49+
if: always()
50+
with:
51+
name: behave-test-reports-${{ matrix.python-version }}
52+
path: output/reports/behave/
53+
retention-days: 30
54+
- name: Publish behave test results
55+
uses: dorny/test-reporter@v1
56+
if: always()
57+
with:
58+
name: behave test results (${{ matrix.python-version }})
59+
path: output/reports/behave/*.xml
60+
reporter: java-junit
61+
fail-on-error: true
1262

63+
pytest-tests:
64+
runs-on: ubuntu-latest
65+
strategy:
66+
matrix:
67+
python-version: ['3.10', '3.11', '3.12', '3.13']
68+
fail-fast: false
1369
steps:
14-
- uses: actions/checkout@v3
70+
- uses: actions/checkout@v6
1571
- name: Set up Python ${{ matrix.python-version }}
16-
uses: actions/setup-python@v3
72+
uses: actions/setup-python@v6
1773
with:
1874
python-version: ${{ matrix.python-version }}
1975
- name: Install dependencies
2076
run: |
2177
python -m pip install --upgrade pip
2278
pip install -r requirements.txt
2379
pip install -r requirements_dev.txt
24-
- name: Lint and format check with ruff
80+
- name: Run pytest tests
81+
env:
82+
TOOLIUM_DRIVER_HEADLESS: Driver_headless=true
2583
run: |
26-
ruff check .
27-
ruff format --check .
84+
cd web_pytest
85+
python -m pytest --junitxml=../output/reports/pytest/junit-pytest.xml
86+
continue-on-error: true
87+
- name: Upload pytest test reports
88+
uses: actions/upload-artifact@v5
89+
if: always()
90+
with:
91+
name: pytest-test-reports-${{ matrix.python-version }}
92+
path: output/reports/pytest/
93+
retention-days: 30
94+
- name: Publish pytest test results
95+
uses: dorny/test-reporter@v1
96+
if: always()
97+
with:
98+
name: pytest test results (${{ matrix.python-version }})
99+
path: output/reports/pytest/*.xml
100+
reporter: java-junit
101+
fail-on-error: true
102+
103+
nose2-tests:
104+
runs-on: ubuntu-latest
105+
strategy:
106+
matrix:
107+
python-version: ['3.10', '3.11', '3.12', '3.13']
108+
fail-fast: false
109+
steps:
110+
- uses: actions/checkout@v6
111+
- name: Set up Python ${{ matrix.python-version }}
112+
uses: actions/setup-python@v6
113+
with:
114+
python-version: ${{ matrix.python-version }}
115+
- name: Install dependencies
116+
run: |
117+
python -m pip install --upgrade pip
118+
pip install -r requirements.txt
119+
pip install -r requirements_dev.txt
120+
- name: Run nose2 tests
121+
env:
122+
TOOLIUM_DRIVER_HEADLESS: Driver_headless=true
123+
run: |
124+
mkdir -p output/reports/nose2
125+
python -m nose2 web_nose2 -A '!local' --junit-xml-path output/reports/nose2/junit-nose.xml || true
126+
continue-on-error: true
127+
- name: Upload nose2 test reports
128+
uses: actions/upload-artifact@v5
129+
if: always()
130+
with:
131+
name: nose2-test-reports-${{ matrix.python-version }}
132+
path: output/reports/nose2/
133+
retention-days: 30
134+
- name: Publish nose2 test results
135+
uses: dorny/test-reporter@v1
136+
if: always()
137+
with:
138+
name: nose2 test results (${{ matrix.python-version }})
139+
path: output/reports/nose2/*.xml
140+
reporter: java-junit
141+
fail-on-error: true
142+
143+
playwright-tests:
144+
runs-on: ubuntu-latest
145+
strategy:
146+
matrix:
147+
python-version: ['3.10', '3.11', '3.12', '3.13']
148+
fail-fast: false
149+
steps:
150+
- uses: actions/checkout@v6
151+
- name: Set up Python ${{ matrix.python-version }}
152+
uses: actions/setup-python@v6
153+
with:
154+
python-version: ${{ matrix.python-version }}
155+
- name: Install dependencies
156+
run: |
157+
python -m pip install --upgrade pip
158+
pip install -r requirements.txt
159+
pip install -r requirements_dev.txt
160+
pip install toolium[playwright]
161+
playwright install
162+
- name: Run Playwright tests
163+
env:
164+
TOOLIUM_DRIVER_HEADLESS: Driver_headless=true
165+
run: |
166+
behave web_playwright_behave/features --junit --junit-directory output/reports/playwright/
167+
continue-on-error: true
168+
- name: Upload Playwright test reports
169+
uses: actions/upload-artifact@v5
170+
if: always()
171+
with:
172+
name: playwright-test-reports-${{ matrix.python-version }}
173+
path: output/reports/playwright/
174+
retention-days: 30
175+
- name: Publish Playwright test results
176+
uses: dorny/test-reporter@v1
177+
if: always()
178+
with:
179+
name: Playwright test results (${{ matrix.python-version }})
180+
path: output/reports/playwright/*.xml
181+
reporter: java-junit
182+
fail-on-error: true

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)