Skip to content

Commit

Permalink
tests: Upload trace on failed tests (#1196)
Browse files Browse the repository at this point in the history
  • Loading branch information
schloerke authored Mar 6, 2024
1 parent 999ef40 commit a713119
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ jobs:
timeout-minutes: 20
run: |
make playwright-shiny SUB_FILE=". -vv"
- uses: actions/upload-artifact@v4
if: failure()
with:
name: "playright-shiny-${{ matrix.os }}-${{ matrix.python-version }}-results"
path: test-results/
retention-days: 5

playwright-examples:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -105,6 +111,12 @@ jobs:
timeout-minutes: 20
run: |
make playwright-examples SUB_FILE=". -vv"
- uses: actions/upload-artifact@v4
if: failure()
with:
name: "playright-examples-${{ matrix.os }}-${{ matrix.python-version }}-results"
path: test-results/
retention-days: 5

playwright-deploys:
if: github.event_name != 'release'
Expand Down Expand Up @@ -147,6 +159,13 @@ jobs:
run: |
make playwright-deploys SUB_FILE=". -vv --numprocesses 12"
- uses: actions/upload-artifact@v4
if: failure()
with:
name: "playright-deploys-${{ matrix.os }}-${{ matrix.python-version }}-results"
path: test-results/
retention-days: 5

pypi:
name: "Deploy to PyPI"
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,4 @@ docs/source/reference/
# Developer scratch area
_dev/
tests/playwright/deploys/**/requirements.txt
test-results/
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ playwright-examples: install-playwright ## end-to-end tests on examples with pla
playwright-debug: install-playwright ## All end-to-end tests, chrome only, headed
pytest -c tests/playwright/playwright-pytest.ini tests/playwright/$(SUB_FILE)

playwright-show-trace: ## Show trace of failed tests
npx playwright show-trace test-results/*/trace.zip

testrail-junit: install-playwright install-trcli ## end-to-end tests with playwright and generate junit report
pytest tests/playwright/shiny/$(SUB_FILE) --junitxml=report.xml

Expand Down
4 changes: 1 addition & 3 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
[pytest]
asyncio_mode=strict
testpaths=tests/pytest/
; ; Debug version of options
; addopts = --strict-markers --durations=6 --durations-min=5.0 --browser chromium --numprocesses auto --video=retain-on-failure -vv
addopts = --strict-markers --durations=6 --durations-min=5.0 --browser webkit --browser firefox --browser chromium --numprocesses auto
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
3 changes: 2 additions & 1 deletion tests/playwright/playwright-pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ asyncio_mode=strict
# --browser <name>: browser type to run on playwright
# --numprocesses auto: number of testing workers. auto is number of (virtual) cores
# --video=retain-on-failure: playwright saves recording of any failed test
# --tracing=retain-on-failure: playwright saves trace of any failed test
# -vv: Extra extra verbose output
# # --headed: Headed browser testing
# # -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...
# --maxfail=1: Stop after 1 failure has occurred
addopts = --strict-markers --durations=6 --durations-min=5.0 --browser chromium --numprocesses auto --video=retain-on-failure -vvv --maxfail=1 --headed
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 comments on commit a713119

Please sign in to comment.