Skip to contents

Wrapper around local_app_driver(). Shows only the shiny app at launch. To show interactions with an app, use a different function.

Usage

get_screenshot_from_app(
  appDir,
  screenshot_args = app_screenshot_args(appDir),
  name = character(1L),
  file = NULL,
  strict = FALSE
)

Arguments

appDir

A shiny app, or a function without arguments returning one, passed to app of local_app_driver().

screenshot_args

Passed to shinytest2::AppDriver$new().

name

If the shiny app is developed inside a package (recommended), the name of that package. The screenshot is created using the (last) installed (not pkgload::load_all()d) version of that package. When the name is provided, the function can test whether it is using the installed version of that package, to avoid confusion (recommended).

file

Path to save the screenshot to; only used for testing. Leave to NULL.

strict

Should the function error out, when the various conditions for creating screenshots are not met? To reduce friction during development, the function will default to just issuing a warning. Instead of the screenshot, it then returns the reason for the failure as a string.

Examples

if (FALSE) { # \dontrun{
get_screenshot_from_app(examples_app())
} # }