TealAppDriver {teal} | R Documentation |
Drive a teal
application
Description
Drive a teal
application
Drive a teal
application
Details
Extension of the shinytest2::AppDriver
class with methods for
driving a teal application for performing interactions for shinytest2
tests.
Super class
shinytest2::AppDriver
-> TealAppDriver
Methods
Public methods
Inherited methods
shinytest2::AppDriver$expect_download()
shinytest2::AppDriver$expect_html()
shinytest2::AppDriver$expect_js()
shinytest2::AppDriver$expect_screenshot()
shinytest2::AppDriver$expect_text()
shinytest2::AppDriver$expect_unique_names()
shinytest2::AppDriver$expect_values()
shinytest2::AppDriver$get_chromote_session()
shinytest2::AppDriver$get_dir()
shinytest2::AppDriver$get_download()
shinytest2::AppDriver$get_html()
shinytest2::AppDriver$get_js()
shinytest2::AppDriver$get_logs()
shinytest2::AppDriver$get_screenshot()
shinytest2::AppDriver$get_text()
shinytest2::AppDriver$get_url()
shinytest2::AppDriver$get_value()
shinytest2::AppDriver$get_values()
shinytest2::AppDriver$get_variant()
shinytest2::AppDriver$get_window_size()
shinytest2::AppDriver$log_message()
shinytest2::AppDriver$run_js()
shinytest2::AppDriver$set_inputs()
shinytest2::AppDriver$set_window_size()
shinytest2::AppDriver$stop()
shinytest2::AppDriver$upload_file()
shinytest2::AppDriver$view()
shinytest2::AppDriver$wait_for_idle()
shinytest2::AppDriver$wait_for_js()
shinytest2::AppDriver$wait_for_value()
Method new()
Initialize a TealAppDriver
object for testing a teal
application.
Usage
TealAppDriver$new( data, modules, filter = teal_slices(), title_args = list(), header = tags$p(), footer = tags$p(), landing_popup_args = NULL, timeout = rlang::missing_arg(), load_timeout = rlang::missing_arg(), ... )
Arguments
data, modules, filter
arguments passed to
init
title_args, header, footer, landing_popup_args
to pass into the modifier functions.
timeout
(
numeric
) Default number of milliseconds for any timeout or timeout_ parameter in theTealAppDriver
class. Defaults to 20s.See
shinytest2::AppDriver
new
method for more details on how to change it via options or environment variables.load_timeout
(
numeric
) How long to wait for the app to load, in ms. This includes the time to start R. Defaults to 100s.See
shinytest2::AppDriver
new
method for more details on how to change it via options or environment variables...
Additional arguments to be passed to
shinytest2::AppDriver$new
Returns
Object of class TealAppDriver
Method click()
Append parent shinytest2::AppDriver
click
method with a call to waif_for_idle()
method.
Usage
TealAppDriver$click(...)
Arguments
...
arguments passed to parent
shinytest2::AppDriver
click()
method.
Method expect_no_shiny_error()
Check if the app has shiny errors. This checks for global shiny errors. Note that any shiny errors dependent on shiny server render will only be captured after the teal module tab is visited because shiny will not trigger server computations when the tab is invisible. So, navigate to the module tab you want to test before calling this function. Although, this catches errors hidden in the other module tabs if they are already rendered.
Usage
TealAppDriver$expect_no_shiny_error()
Method expect_no_validation_error()
Check if the app has no validation errors. This checks for global shiny validation errors.
Usage
TealAppDriver$expect_no_validation_error()
Method expect_validation_error()
Check if the app has validation errors. This checks for global shiny validation errors.
Usage
TealAppDriver$expect_validation_error()
Method set_input()
Set the input in the teal
app.
Usage
TealAppDriver$set_input(input_id, value, ...)
Arguments
input_id
(character) The shiny input id with it's complete name space.
value
The value to set the input to.
...
Additional arguments to be passed to
shinytest2::AppDriver$set_inputs
Returns
The TealAppDriver
object invisibly.
Method navigate_teal_tab()
Navigate the teal tabs in the teal
app.
Usage
TealAppDriver$navigate_teal_tab(tabs)
Arguments
tabs
(character) Labels of tabs to navigate to. The order of the tabs is important, and it should start with the most parent level tab. Note: In case the teal tab group has duplicate names, the first tab will be selected, If you wish to select the second tab with the same name, use the suffix "_1". If you wish to select the third tab with the same name, use the suffix "_2" and so on.
Returns
The TealAppDriver
object invisibly.
Method active_ns()
Get the active shiny name space for different components of the teal app.
Usage
TealAppDriver$active_ns()
Returns
(list
) The list of active shiny name space of the teal components.
Method active_module_ns()
Get the active shiny name space for interacting with the module content.
Usage
TealAppDriver$active_module_ns()
Returns
(string
) The active shiny name space of the component.
Method active_module_element()
Get the active shiny name space bound with a custom element
name.
Usage
TealAppDriver$active_module_element(element)
Arguments
element
character(1)
custom element name.
Returns
(string
) The active shiny name space of the component bound with the input element
.
Method active_module_element_text()
Get the text of the active shiny name space bound with a custom element
name.
Usage
TealAppDriver$active_module_element_text(element)
Arguments
element
character(1)
the text of the custom element name.
Returns
(string
) The text of the active shiny name space of the component bound with the input element
.
Method active_filters_ns()
Get the active shiny name space for interacting with the filter panel.
Usage
TealAppDriver$active_filters_ns()
Returns
(string
) The active shiny name space of the component.
Method active_data_summary_ns()
Get the active shiny name space for interacting with the data-summary panel.
Usage
TealAppDriver$active_data_summary_ns()
Returns
(string
) The active shiny name space of the data-summary component.
Method active_data_summary_element()
Get the active shiny name space bound with a custom element
name.
Usage
TealAppDriver$active_data_summary_element(element)
Arguments
element
character(1)
custom element name.
Returns
(string
) The active shiny name space of the component bound with the input element
.
Method get_active_module_input()
Get the input from the module in the teal
app.
This function will only access inputs from the name space of the current active teal module.
Usage
TealAppDriver$get_active_module_input(input_id)
Arguments
input_id
(character) The shiny input id to get the value from.
Returns
The value of the shiny input.
Method get_active_module_output()
Get the output from the module in the teal
app.
This function will only access outputs from the name space of the current active teal module.
Usage
TealAppDriver$get_active_module_output(output_id)
Arguments
output_id
(character) The shiny output id to get the value from.
Returns
The value of the shiny output.
Method get_active_module_table_output()
Get the output from the module's teal.widgets::table_with_settings
or DT::DTOutput
in the teal
app.
This function will only access outputs from the name space of the current active teal module.
Usage
TealAppDriver$get_active_module_table_output(table_id, which = 1)
Arguments
table_id
(
character(1)
) The id of the table in the active teal module's name space.which
(integer) If there is more than one table, which should be extracted. By default it will look for a table that is built using
teal.widgets::table_with_settings
.
Returns
The data.frame with table contents.
Method get_active_module_plot_output()
Get the output from the module's teal.widgets::plot_with_settings
in the teal
app.
This function will only access plots from the name space of the current active teal module.
Usage
TealAppDriver$get_active_module_plot_output(plot_id)
Arguments
plot_id
(
character(1)
) The id of the plot in the active teal module's name space.
Returns
The src
attribute as character(1)
vector.
Method set_active_module_input()
Set the input in the module in the teal
app.
This function will only set inputs in the name space of the current active teal module.
Usage
TealAppDriver$set_active_module_input(input_id, value, ...)
Arguments
input_id
(character) The shiny input id to get the value from.
value
The value to set the input to.
...
Additional arguments to be passed to
shinytest2::AppDriver$set_inputs
Returns
The TealAppDriver
object invisibly.
Method get_active_filter_vars()
Get the active datasets that can be accessed via the filter panel of the current active teal module.
Usage
TealAppDriver$get_active_filter_vars()
Method get_active_data_summary_table()
Get the active data summary table
Usage
TealAppDriver$get_active_data_summary_table()
Returns
data.frame
Method is_visible()
Test if DOM
elements are visible on the page with a JavaScript call.
Usage
TealAppDriver$is_visible( selector, content_visibility_auto = FALSE, opacity_property = FALSE, visibility_property = FALSE )
Arguments
selector
(
character(1)
)CSS
selector to check visibility. ACSS
id will return only one element if the UI is well formed.content_visibility_auto, opacity_property, visibility_property
(
logical(1)
) See more information on https://developer.mozilla.org/en-US/docs/Web/API/Element/checkVisibility.
Returns
Logical vector with all occurrences of the selector.
Method get_active_data_filters()
Get the active filter variables from a dataset in the teal
app.
Usage
TealAppDriver$get_active_data_filters(dataset_name = NULL)
Arguments
dataset_name
(character) The name of the dataset to get the filter variables from. If
NULL
, the filter variables for all the datasets will be returned in a list.
Method add_filter_var()
Add a new variable from the dataset to be filtered.
Usage
TealAppDriver$add_filter_var(dataset_name, var_name, ...)
Arguments
dataset_name
(character) The name of the dataset to add the filter variable to.
var_name
(character) The name of the variable to add to the filter panel.
...
Additional arguments to be passed to
shinytest2::AppDriver$set_inputs
Returns
The TealAppDriver
object invisibly.
Method remove_filter_var()
Remove an active filter variable of a dataset from the active filter variables panel.
Usage
TealAppDriver$remove_filter_var(dataset_name = NULL, var_name = NULL)
Arguments
dataset_name
(character) The name of the dataset to remove the filter variable from. If
NULL
, all the filter variables will be removed.var_name
(character) The name of the variable to remove from the filter panel. If
NULL
, all the filter variables of the dataset will be removed.
Returns
The TealAppDriver
object invisibly.
Method set_active_filter_selection()
Set the active filter values for a variable of a dataset in the active filter variable panel.
Usage
TealAppDriver$set_active_filter_selection(dataset_name, var_name, input, ...)
Arguments
dataset_name
(character) The name of the dataset to set the filter value for.
var_name
(character) The name of the variable to set the filter value for.
input
The value to set the filter to.
...
Additional arguments to be passed to
shinytest2::AppDriver$set_inputs
Returns
The TealAppDriver
object invisibly.
Method get_attr()
Extract html
attribute (found by a selector
).
Usage
TealAppDriver$get_attr(selector, attribute)
Arguments
selector
(
character(1)
) specifying the selector to be used to get the content of a specific node.attribute
(
character(1)
) name of an attribute to retrieve from a node specified byselector
.
Returns
The character
vector.
Method get_html_rvest()
Wrapper around get_html
that passes the output directly to rvest::read_html
.
Usage
TealAppDriver$get_html_rvest(selector)
Arguments
selector
(character(1))
passed toget_html
.
Returns
An XML document.
Wrapper around get_url()
method that opens the app in the browser.
Method open_url()
Usage
TealAppDriver$open_url()
Returns
Nothing. Opens the underlying teal app in the browser.
Method wait_for_active_module_value()
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.
Usage
TealAppDriver$wait_for_active_module_value( input = rlang::missing_arg(), output = rlang::missing_arg(), export = rlang::missing_arg(), ... )
Arguments
input, output, export
A name of an input, output, or export value. Only one of these parameters may be used.
...
Must be empty. Allows for parameter expansion. Parameter with additional value to passed in
wait_for_value
.
Method clone()
The objects of this class are cloneable with this method.
Usage
TealAppDriver$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.