TealAppDriver | R Documentation |
teal
applicationDrive a teal
application
Drive a teal
application
Extension of the shinytest2::AppDriver
class with methods for
driving a teal application for performing interactions for shinytest2
tests.
shinytest2::AppDriver
-> TealAppDriver
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()
new()
Initialize a TealAppDriver
object for testing a teal
application.
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(), ... )
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 the TealAppDriver
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
Object of class TealAppDriver
click()
Append parent shinytest2::AppDriver
click
method with a call to waif_for_idle()
method.
TealAppDriver$click(...)
...
arguments passed to parent shinytest2::AppDriver
click()
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.
TealAppDriver$expect_no_shiny_error()
expect_no_validation_error()
Check if the app has no validation errors. This checks for global shiny validation errors.
TealAppDriver$expect_no_validation_error()
expect_validation_error()
Check if the app has validation errors. This checks for global shiny validation errors.
TealAppDriver$expect_validation_error()
set_input()
Set the input in the teal
app.
TealAppDriver$set_input(input_id, value, ...)
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
The TealAppDriver
object invisibly.
navigate_teal_tab()
Navigate the teal tabs in the teal
app.
TealAppDriver$navigate_teal_tab(tabs)
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.
The TealAppDriver
object invisibly.
active_ns()
Get the active shiny name space for different components of the teal app.
TealAppDriver$active_ns()
(list
) The list of active shiny name space of the teal components.
active_module_ns()
Get the active shiny name space for interacting with the module content.
TealAppDriver$active_module_ns()
(string
) The active shiny name space of the component.
active_module_element()
Get the active shiny name space bound with a custom element
name.
TealAppDriver$active_module_element(element)
element
character(1)
custom element name.
(string
) The active shiny name space of the component bound with the input element
.
active_module_element_text()
Get the text of the active shiny name space bound with a custom element
name.
TealAppDriver$active_module_element_text(element)
element
character(1)
the text of the custom element name.
(string
) The text of the active shiny name space of the component bound with the input element
.
active_filters_ns()
Get the active shiny name space for interacting with the filter panel.
TealAppDriver$active_filters_ns()
(string
) The active shiny name space of the component.
active_data_summary_ns()
Get the active shiny name space for interacting with the data-summary panel.
TealAppDriver$active_data_summary_ns()
(string
) The active shiny name space of the data-summary component.
active_data_summary_element()
Get the active shiny name space bound with a custom element
name.
TealAppDriver$active_data_summary_element(element)
element
character(1)
custom element name.
(string
) The active shiny name space of the component bound with the input element
.
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.
TealAppDriver$get_active_module_input(input_id)
input_id
(character) The shiny input id to get the value from.
The value of the shiny input.
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.
TealAppDriver$get_active_module_output(output_id)
output_id
(character) The shiny output id to get the value from.
The value of the shiny output.
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.
TealAppDriver$get_active_module_table_output(table_id, which = 1)
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
.
The data.frame with table contents.
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.
TealAppDriver$get_active_module_plot_output(plot_id)
plot_id
(character(1)
) The id of the plot in the active teal module's name space.
The src
attribute as character(1)
vector.
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.
TealAppDriver$set_active_module_input(input_id, value, ...)
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
The TealAppDriver
object invisibly.
get_active_filter_vars()
Get the active datasets that can be accessed via the filter panel of the current active teal module.
TealAppDriver$get_active_filter_vars()
get_active_data_summary_table()
Get the active data summary table
TealAppDriver$get_active_data_summary_table()
data.frame
is_visible()
Test if DOM
elements are visible on the page with a JavaScript call.
TealAppDriver$is_visible( selector, content_visibility_auto = FALSE, opacity_property = FALSE, visibility_property = FALSE )
selector
(character(1)
) CSS
selector to check visibility.
A CSS
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.
Logical vector with all occurrences of the selector.
get_active_data_filters()
Get the active filter variables from a dataset in the teal
app.
TealAppDriver$get_active_data_filters(dataset_name = NULL)
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.
add_filter_var()
Add a new variable from the dataset to be filtered.
TealAppDriver$add_filter_var(dataset_name, var_name, ...)
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
The TealAppDriver
object invisibly.
remove_filter_var()
Remove an active filter variable of a dataset from the active filter variables panel.
TealAppDriver$remove_filter_var(dataset_name = NULL, var_name = NULL)
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.
The TealAppDriver
object invisibly.
set_active_filter_selection()
Set the active filter values for a variable of a dataset in the active filter variable panel.
TealAppDriver$set_active_filter_selection(dataset_name, var_name, input, ...)
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
The TealAppDriver
object invisibly.
get_attr()
Extract html
attribute (found by a selector
).
TealAppDriver$get_attr(selector, attribute)
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 by selector
.
The character
vector.
get_html_rvest()
Wrapper around get_html
that passes the output directly to rvest::read_html
.
TealAppDriver$get_html_rvest(selector)
selector
(character(1))
passed to get_html
.
An XML document.
Wrapper around get_url()
method that opens the app in the browser.
open_url()
TealAppDriver$open_url()
Nothing. Opens the underlying teal app in the browser.
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.
TealAppDriver$wait_for_active_module_value( input = rlang::missing_arg(), output = rlang::missing_arg(), export = rlang::missing_arg(), ... )
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
.
clone()
The objects of this class are cloneable with this method.
TealAppDriver$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.