Defer a shiny app to shinytest2's background process
Source:R/shinytest2_app_fn.R
shinytest2_app_fn.RdWraps code that returns a shiny app into a function
from your package's namespace,
to pass to shinytest2::AppDriver's $new() method.
Usage
shinytest2_app_fn(code, package = utils::packageName(rlang::caller_env()))Details
Exported functions which return a shiny.appobj
(such as those created with module2app())
can be passed to shinytest2::AppDriver$new() as is,
e.g. AppDriver$new(my_app).
shinytest2 then calls them in its background process
after loading your package from source,
as described in its
package testing guide.
Use shinytest2_app_fn() when the app needs arguments,
or comes from other package code.
Do not pass pre-created app objects (my_app()),
nor functions defined in a test file:
both can run code from an outdated, installed version of your package,
instead of its working tree.
See also
Other modules:
abort_if_reactive(),
get_screenshot_args_attr(),
mixed_react_tree,
module2app()
Examples
if (FALSE) { # \dontrun{
shinytest2::AppDriver$new(
shinytest2_app_fn(module2app(counter_button_ui))
)
} # }