Skip to content

Commit 902d656

Browse files
docs(testing): Add documentation for all public testing methods (#1456)
Co-authored-by: Barret Schloerke <[email protected]>
1 parent bd5c2e2 commit 902d656

File tree

11 files changed

+2761
-491
lines changed

11 files changed

+2761
-491
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5757

5858
### New features
5959

60+
* Expose shiny.pytest, shiny.run and shiny.playwright modules that allow users to testing their Shiny apps. (#1448, #1456)
61+
6062
* Added busy indicators to provide users with a visual cue when the server is busy calculating outputs or otherwise serving requests to the client. More specifically, a spinner is shown on each calculating/recalculating output, and a pulsing banner is shown at the top of the page when the app is otherwise busy. Use the new `ui.busy_indicator.options()` function to customize the appearance of the busy indicators and `ui.busy_indicator.use()` to disable/enable them. (#918)
6163

6264
* Added support for creating modules using Shiny Express syntax, and using modules in Shiny Express apps. (#1220)

shiny/playwright/__init__.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,24 @@
55
"The shiny.playwright module requires the playwright package to be installed."
66
" Please install it with this command:"
77
"\n\n pip install playwright"
8-
"\n\n",
9-
"If you are using pytest to test your code,"
10-
" you can install the pytest-playwright shim package with this command:",
11-
"\n\n pip install pytest-playwright",
128
)
9+
# If `pytest` is installed...
10+
try:
11+
import pytest # noqa: F401 # pyright: ignore[reportUnusedImport, reportMissingTypeStubs]
12+
13+
# At this point, `playwright` and `pytest` are installed.
14+
# Try to make sure `pytest-playwright` is installed
15+
try:
16+
import pytest_playwright # noqa: F401 # pyright: ignore[reportUnusedImport, reportMissingTypeStubs]
1317

18+
except ImportError:
19+
raise ImportError(
20+
"If you are using pytest to test your app,"
21+
" you can install the pytest-playwright shim package with this command:",
22+
"\n\n pip install pytest-playwright",
23+
)
24+
except ImportError:
25+
pass
1426
from . import controls, expect
1527

1628
__all__ = ["expect", "controls"]

0 commit comments

Comments
 (0)