I am attempting to test my shiny application using the shinytest2 package. To get started, I followed along with the example found here: https://rstudio.github.io/shinytest2/articles/shinytest2.html.
However, when I ran the test, I received the following error.
My code:
app.R
library(shiny)
ui <- fluidPage(
textInput("name", "What is your name?"),
actionButton("greet", "Greet"),
textOutput("greeting")
)
server <- function(input, output, session) {
output$greeting <- renderText({
req(input$greet)
paste0("Hello ", isolate(input$name), "!")
})
}
shinyApp(ui, server)
/tests/testthat.R (auto-generated)
shinytest2::test_app()
/tests/testthat/setup-shinytest2.R (auto-generated)
# Load application support files into testing environment
shinytest2::load_app_env()
/tests/testthat/test-shinytest2.R
library(shinytest2)
test_that("{shinytest2} recording: ShinyTest2Example", {
app <- AppDriver$new(name = "ShinyTest2Example", height = 987, width = 609)
app$set_inputs(name = "Name")
app$click("greet")
app$expect_values()
})
I am unable to determine why I am experiencing this issue. Any help would be appreciated. Thanks!