Shiny Testing API
This page outlines Shiny’s Testing API reference.
For an introduction to Shiny testing, see the unit testing and end to end testing tutorials.
Function reference
UI Layouts
Methods for interacting with Shiny app multiple UI component controller.
| playwright.controller.Accordion | Controller for shiny.ui.accordion. |
| playwright.controller.AccordionPanel | Controller for shiny.ui.accordion_panel. |
| playwright.controller.Card | Controller for shiny.ui.card. |
| playwright.controller.Offcanvas | Controller for shiny.ui.offcanvas. |
| playwright.controller.Popover | Controller for shiny.ui.popover. |
| playwright.controller.Sidebar | Controller for shiny.ui.sidebar. |
| playwright.controller.Toast | Controller for shiny.ui.toast. |
| playwright.controller.Tooltip | Controller for shiny.ui.tooltip. |
UI Inputs
Methods for interacting with Shiny app input value controller.
Value boxes
Methods for interacting with Shiny app valuebox controller.
| playwright.controller.ValueBox | Controller for shiny.ui.value_box. |
Upload and download
Methods for interacting with Shiny app uploading and downloading controller.
| playwright.controller.InputFile | Controller for shiny.ui.input_file. |
| playwright.controller.DownloadButton | Controller for shiny.ui.download_button |
| playwright.controller.DownloadLink | Controller for shiny.ui.download_link. |
Chat interface
Methods for interacting with Shiny app chat controller.
| playwright.controller.Chat | Controller for shiny.ui.chat. |
Rendering Outputs
Render output in a variety of ways.
| playwright.controller.OutputCode | Controller for shiny.ui.output_code. |
| playwright.controller.OutputDataFrame | Controller for shiny.ui.output_data_frame. |
| playwright.controller.OutputImage | Controller for shiny.ui.output_image. |
| playwright.controller.OutputPlot | Controller for shiny.ui.output_plot. |
| playwright.controller.OutputTable | Controller for shiny.ui.output_table. |
| playwright.controller.OutputText | Controller for shiny.ui.output_text. |
| playwright.controller.OutputUi | Controller for shiny.ui.output_ui. |
App test values
Read a session’s test-mode snapshot of input, output, and export values.
| playwright.controller.AppTestValues | Read a Shiny session’s test-mode snapshot of input, output, and export values from a running app. |
Playwright Expect
Methods for testing the state of a locator within a Shiny app.
| playwright.expect.expect_to_change | Context manager that yields when the value returned by func() changes. |
| playwright.expect.expect_not_to_have_attribute | Expect that the attribute does not exist. |
| playwright.expect.expect_to_have_class | Expect a CSS class value is found. |
| playwright.expect.expect_not_to_have_class | Expect a CSS class value is not found. |
| playwright.expect.expect_to_have_style | Expect the style attribute to have a value. |
| playwright.expect.expect_not_to_have_style | Expect a key within style attribute to not exist. |
Pytest
Fixtures used for testing Shiny apps with Pytest.
| pytest.create_app_fixture | Create a fixture for a local Shiny app directory. |
| pytest.ScopeName | Pytest fixture scopes |
Test server
Run a Shiny app’s server function in memory, without a browser.
| testserver.test_server | Run a Shiny server function, Express app, or shiny.App in memory for testing. |
| testserver.test_server_async | The async counterpart to test_server, for use in async tests. |
| testserver.TestServerSession | An in-memory Shiny session driven from ordinary (non-async) test code. |
| testserver.AsyncTestServerSession | An in-memory Shiny session driven from async test code. |
| testserver.TestServerScope | A namespaced view of a TestServerSession. |
| testserver.AsyncTestServerScope | A namespaced view of an AsyncTestServerSession. |
| testserver.TestServerValue | One input, output, or exported value, and how it turned out. |
| testserver.TestServerValues | A point-in-time snapshot of a test session’s input, output, and export values. |
| testserver.DEFAULT_CLIENT_DATA | Stand-ins for what a browser would report, sent when the session starts. |
Run
Methods for starting a local Shiny app in the background
| run.run_shiny_app | Run a Shiny app in a subprocess. |
| run.ShinyAppProc | Class that represents a running Shiny app process. |
Deprecated
| playwright.controller.OutputTextVerbatim | Deprecated. Use OutputCode instead. |