diff --git a/DESCRIPTION b/DESCRIPTION index e20d364a..8e014af2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,8 +19,8 @@ Suggests: future, httr, knitr, - shinytest, - testthat (>= 2.0) + shinytest2, + testthat (>= 3.0) VignetteBuilder: knitr biocViews: @@ -28,4 +28,4 @@ Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 diff --git a/tests/testthat/test-shiny.R b/tests/testthat/test-shiny.R index 6fed2d67..4d8692cd 100644 --- a/tests/testthat/test-shiny.R +++ b/tests/testthat/test-shiny.R @@ -1,25 +1,23 @@ test_that("The Shiny App returns a proper greeting", { - library(shinytest) - app <- ShinyDriver$new( + library(shinytest2) + app <- AppDriver$new( "shiny-app/", - loadTimeout = 1e5, - debug = "all", - phantomTimeout = 1e5, + load_timeout = 1e5, + timeout = 1e5, seed = 123 ) - app$getDebugLog() + app$get_logs() # Set input - app$setInputs(name = "john") - app$setInputs(greet = "click") - output <- app$getValue(name = "greeting") + app$set_inputs(name = "john") + app$click("greet") - # test + # Get output + output <- app$get_value(output = "greeting") + + # Assert expect_equal(output, "Hello, John") - # wait for the process to close gracefully - # this allows covr to write out the coverage results - p <- app$.__enclos_env__$private$shinyProcess - p$interrupt() - p$wait() + # Stop the app + app$stop() })