Skip to content

docs(testing): Update end-to-end testing docs for new app fixture #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions docs/end-to-end-testing.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,17 @@ Now for the exciting part – writing the test code!
2. **Copy and paste this code:**

```python
from playwright.sync_api import Page
from shiny.playwright import controller
from shiny.pytest import create_app_fixture
from shiny.run import ShinyAppProc
from playwright.sync_api import Page

def test_basic_app(page: Page, local_app: ShinyAppProc) -> None:
app = create_app_fixture(["app.py"])


def test_basic_app(page: Page, app: ShinyAppProc) -> None:
# Navigate to the app URL when it's ready
page.goto(local_app.url)
page.goto(app.url)

# Controller objects for interacting with specific Shiny components
txt = controller.OutputText(page, "txt")
Expand All @@ -100,7 +104,7 @@ def test_basic_app(page: Page, local_app: ShinyAppProc) -> None:
- **Understand role of Fixtures**
- **ShinyAppProc**: Manages a Shiny application subprocess, handling lifecycle (startup, shutdown) and providing access to output streams.
- **page**: Playwright object representing the browser tab.
- **local_app**: Running instance of the Shiny application.
- **app**: Running instance of the Shiny application.

- **Understand role of Controllers**

Expand Down
Loading