Skip to content

Commit 327ed62

Browse files
authored
tests: Upload trace on failed tests (#1177)
1 parent f31051e commit 327ed62

File tree

5 files changed

+26
-4
lines changed

5 files changed

+26
-4
lines changed

.github/workflows/pytest.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ jobs:
7373
timeout-minutes: 20
7474
run: |
7575
make playwright-shiny SUB_FILE=". -vv"
76+
- uses: actions/upload-artifact@v4
77+
if: failure()
78+
with:
79+
name: "playright-shiny-${{ matrix.os }}-${{ matrix.python-version }}-results"
80+
path: test-results/
81+
retention-days: 5
7682

7783
playwright-examples:
7884
runs-on: ${{ matrix.os }}
@@ -105,6 +111,12 @@ jobs:
105111
timeout-minutes: 20
106112
run: |
107113
make playwright-examples SUB_FILE=". -vv"
114+
- uses: actions/upload-artifact@v4
115+
if: failure()
116+
with:
117+
name: "playright-examples-${{ matrix.os }}-${{ matrix.python-version }}-results"
118+
path: test-results/
119+
retention-days: 5
108120

109121
playwright-deploys:
110122
# Only allow one `playwright-deploys` job to run at a time. (Independent of branch / PR)
@@ -146,6 +158,13 @@ jobs:
146158
run: |
147159
make playwright-deploys SUB_FILE=". -vv --numprocesses 12"
148160
161+
- uses: actions/upload-artifact@v4
162+
if: failure()
163+
with:
164+
name: "playright-deploys-${{ matrix.os }}-${{ matrix.python-version }}-results"
165+
path: test-results/
166+
retention-days: 5
167+
149168
pypi:
150169
name: "Deploy to PyPI"
151170
runs-on: ubuntu-latest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,4 @@ docs/source/reference/
114114
# Developer scratch area
115115
_dev/
116116
tests/playwright/deploys/**/requirements.txt
117+
test-results/

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ playwright-examples: install-playwright ## end-to-end tests on examples with pla
124124
playwright-debug: install-playwright ## All end-to-end tests, chrome only, headed
125125
pytest -c tests/playwright/playwright-pytest.ini tests/playwright/$(SUB_FILE)
126126

127+
playwright-show-trace: ## Show trace of failed tests
128+
npx playwright show-trace test-results/*/trace.zip
129+
127130
testrail-junit: install-playwright install-trcli ## end-to-end tests with playwright and generate junit report
128131
pytest tests/playwright/shiny/$(SUB_FILE) --junitxml=report.xml
129132

pytest.ini

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
[pytest]
22
asyncio_mode=strict
33
testpaths=tests/pytest/
4-
; ; Debug version of options
5-
; addopts = --strict-markers --durations=6 --durations-min=5.0 --browser chromium --numprocesses auto --video=retain-on-failure -vv
6-
addopts = --strict-markers --durations=6 --durations-min=5.0 --browser webkit --browser firefox --browser chromium --numprocesses auto
4+
addopts = --strict-markers --durations=6 --durations-min=5.0 --browser webkit --browser firefox --browser chromium --numprocesses auto --tracing=retain-on-failure --video=retain-on-failure

tests/playwright/playwright-pytest.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ asyncio_mode=strict
66
# --browser <name>: browser type to run on playwright
77
# --numprocesses auto: number of testing workers. auto is number of (virtual) cores
88
# --video=retain-on-failure: playwright saves recording of any failed test
9+
# --tracing=retain-on-failure: playwright saves trace of any failed test
910
# -vv: Extra extra verbose output
1011
# # --headed: Headed browser testing
1112
# # -r P: Show extra test summary info: (f)ailed, (E)rror, (s)kipped, (x)failed, (X)passed, (p)assed, (P)assed with output, (a)ll except passed (p/P), or (A)ll. (w)arnings...
1213
# --maxfail=1: Stop after 1 failure has occurred
13-
addopts = --strict-markers --durations=6 --durations-min=5.0 --browser chromium --numprocesses auto --video=retain-on-failure -vvv --maxfail=1 --headed
14+
addopts = --strict-markers --durations=6 --durations-min=5.0 --browser chromium --numprocesses auto -vvv --maxfail=1 --headed --tracing=retain-on-failure --video=retain-on-failure

0 commit comments

Comments
 (0)