diff --git a/R/TealAppDriver.R b/R/TealAppDriver.R index 2a1b5bbf5c..3130b78a58 100644 --- a/R/TealAppDriver.R +++ b/R/TealAppDriver.R @@ -407,6 +407,31 @@ TealAppDriver <- R6::R6Class( # nolint: object_name. #' @return Nothing. Opens the underlying teal app in the browser. open_url = function() { browseURL(self$get_url()) + }, + #' @description + #' Waits until a specified input, output, or export value. + #' This function serves as a wrapper around the `wait_for_value` method, + #' providing a more flexible interface for waiting on different types of values within the active module namespace. + #' @param input,output,export A name of an input, output, or export value. + #' Only one of these parameters may be used. + #' @param ... Must be empty. Allows for parameter expansion. + #' Parameter with additional value to passed in `wait_for_value`. + wait_for_active_module_value = function(input = rlang::missing_arg(), + output = rlang::missing_arg(), + export = rlang::missing_arg(), + ...) { + ns <- shiny::NS(self$active_module_ns()) + + if (!rlang::is_missing(input) && checkmate::test_string(input, min.chars = 1)) input <- ns(input) + if (!rlang::is_missing(output) && checkmate::test_string(output, min.chars = 1)) output <- ns(output) + if (!rlang::is_missing(export) && checkmate::test_string(export, min.chars = 1)) export <- ns(export) + + self$wait_for_value( + input = input, + output = output, + export = export, + ... + ) } ), # private members ---- diff --git a/man/TealAppDriver.Rd b/man/TealAppDriver.Rd index a2f2db3ef2..3a3e482dbc 100644 --- a/man/TealAppDriver.Rd +++ b/man/TealAppDriver.Rd @@ -41,6 +41,7 @@ driving a teal application for performing interactions for \code{shinytest2} tes \item \href{#method-TealAppDriver-get_attr}{\code{TealAppDriver$get_attr()}} \item \href{#method-TealAppDriver-get_html_rvest}{\code{TealAppDriver$get_html_rvest()}} \item \href{#method-TealAppDriver-open_url}{\code{TealAppDriver$open_url()}} +\item \href{#method-TealAppDriver-wait_for_active_module_value}{\code{TealAppDriver$wait_for_active_module_value()}} \item \href{#method-TealAppDriver-clone}{\code{TealAppDriver$clone()}} } } @@ -493,6 +494,34 @@ Nothing. Opens the underlying teal app in the browser. } } \if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-TealAppDriver-wait_for_active_module_value}{}}} +\subsection{Method \code{wait_for_active_module_value()}}{ +Waits until a specified input, output, or export value. +This function serves as a wrapper around the \code{wait_for_value} method, +providing a more flexible interface for waiting on different types of values within the active module namespace. +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{TealAppDriver$wait_for_active_module_value( + input = rlang::missing_arg(), + output = rlang::missing_arg(), + export = rlang::missing_arg(), + ... +)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{input, output, export}}{A name of an input, output, or export value. +Only one of these parameters may be used.} + +\item{\code{...}}{Must be empty. Allows for parameter expansion. +Parameter with additional value to passed in \code{wait_for_value}.} +} +\if{html}{\out{
}} +} +} +\if{html}{\out{
}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-TealAppDriver-clone}{}}} \subsection{Method \code{clone()}}{