Skip to content

Commit ce970d8

Browse files
authored
test: Add make playwright-debug to help debug playwright tests (#1097)
1 parent 337955d commit ce970d8

File tree

17 files changed

+49
-31
lines changed

17 files changed

+49
-31
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ playwright-deploys: install-playwright install-rsconnect ## end-to-end tests on
104104
playwright-examples: install-playwright ## end-to-end tests on examples with playwright
105105
pytest tests/playwright/examples/$(SUB_FILE)
106106

107+
playwright-debug: install-playwright ## All end-to-end tests, chrome only, headed
108+
pytest -c tests/playwright/playwright-pytest.ini tests/playwright/$(SUB_FILE)
109+
107110
testrail-junit: install-playwright install-trcli ## end-to-end tests with playwright and generate junit report
108111
pytest tests/playwright/shiny/$(SUB_FILE) --junitxml=report.xml
109112

pytest.ini

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,3 @@ testpaths=tests/pytest/
44
; ; Debug version of options
55
; addopts = --strict-markers --durations=6 --durations-min=5.0 --browser chromium --numprocesses auto --video=retain-on-failure -vv
66
addopts = --strict-markers --durations=6 --durations-min=5.0 --browser webkit --browser firefox --browser chromium --numprocesses auto
7-
markers =
8-
examples: Suite of tests to validate that examples do not produce errors (deselect with '-m "not examples"')
9-
integrationtest: Suite of tests that check deploys and integration with other services (deselect with '-m "not integrationtest"')

tests/playwright/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This directory contains end-to-end (i.e. browser based) tests for Shiny for Python.
44

5-
The Python files directly in this subdirectory are for Pytest fixtures and helper code
5+
The Python files directly in this subdirectory (and `./utils`) are for Pytest fixtures and helper code
66
to make test writing easier. (Eventually this logic may move to the `shiny` package
77
itself or its own dedicated package, so that Shiny app authors can set up their own e2e
88
tests against their apps.)
@@ -17,14 +17,21 @@ optional, because the tests may also be for apps in the `../examples` or `../shi
1717
The following commands can be run from the repo root:
1818

1919
```sh
20-
# Run all e2e tests
20+
# Run tests related to shiny (in `./shiny` folder)
2121
make playwright-shiny
22+
# Run tests related to examples (in `./examples` folder)
23+
make playwright-examples
24+
# Run tests on apps that should be deployed (in `./deploys` folder)
25+
make playwright-deploys
2226

2327
# Run just the tests in playwright/shiny/async/
2428
make playwright-shiny SUB_FILE=e2e/async
2529

2630
# Run just the tests in playwright/shiny/async/, in headed mode
2731
make playwright-shiny SUB_FILE="--headed e2e/async"
32+
33+
# Run **all** tests on with pytest options best for debugging
34+
make playwright-debug
2835
```
2936

3037
## Shiny app fixtures
@@ -73,3 +80,5 @@ def test_airmass(page: Page, airmass_app: ShinyAppProc):
7380
plot = page.locator("#plot")
7481
expect(plot).to_have_class(re.compile(r"\bshiny-bound-output\b"))
7582
```
83+
84+
However, it is suggested to alter the example app for testing and use a local app for testing.

0 commit comments

Comments
 (0)