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.Popover Controller for shiny.ui.popover.
playwright.controller.Sidebar Controller for shiny.ui.sidebar.
playwright.controller.Tooltip Controller for shiny.ui.tooltip.

UI Inputs

Methods for interacting with Shiny app input value controller.

playwright.controller.InputActionLink Controller for shiny.ui.input_action_link.
playwright.controller.InputCheckbox Controller for shiny.ui.input_checkbox.
playwright.controller.InputCheckboxGroup Controller for shiny.ui.input_checkbox_group.
playwright.controller.InputDarkMode Controller for shiny.ui.input_dark_mode.
playwright.controller.InputDate
playwright.controller.InputDateRange Controller for shiny.ui.input_date_range.
playwright.controller.InputNumeric Controller for shiny.ui.input_numeric.
playwright.controller.InputPassword Controller for shiny.ui.input_password.
playwright.controller.InputRadioButtons Controller for shiny.ui.input_radio_buttons.
playwright.controller.InputSelect Controller for shiny.ui.input_select.
playwright.controller.InputSelectize Controller for shiny.ui.input_selectize.
playwright.controller.InputSlider Controller for shiny.ui.input_slider.
playwright.controller.InputSliderRange Controller for shiny.ui.input_slider with a slider range.
playwright.controller.InputSwitch Controller for shiny.ui.input_switch.
playwright.controller.InputTaskButton Controller for shiny.ui.input_task_button.
playwright.controller.InputText Controller for shiny.ui.input_text.
playwright.controller.InputTextArea Controller for shiny.ui.input_text_area.

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.OutputTextVerbatim Controller for shiny.ui.output_text_verbatim.
playwright.controller.OutputUi Controller for shiny.ui.output_ui.

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

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.