Shinytest2 - Issue executing tests

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!

Hmmmm. If I copy the code locally and run it, it works as expected.

The app is able to be run by itself. And I ran the test with shinytest2::test_app().


Where are you running this test? Within your local machine? Within a local RStudio IDE session? Remotely on Workbench?

Do you mind including the output of sessioninfo::session_info()? Thank you!

I am running it remotely on an RStudio Pro session on Posit Workbench.

Thank you for the info, @emn_mbe !


Unfortunately, there currently is a known bug where Workbench can not launch a browser with {chromote}. This is preventing {shinytest2} from running any tests.

Link to Issue: `chromote::ChromoteSession()` can not be started within Workbench · Issue #12960 · rstudio/rstudio · GitHub
Cross-linked from GitHub to Community post: :ballot_box_with_check:

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.