Skip to content

Commit 4ad706b

Browse files
authored
Fix the unit test and move to shinytest2 (#224)
Migrate to `shinytest2`
1 parent 301013d commit 4ad706b

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ Suggests:
1919
future,
2020
httr,
2121
knitr,
22-
shinytest,
23-
testthat (>= 2.0)
22+
shinytest2,
23+
testthat (>= 3.0)
2424
VignetteBuilder:
2525
knitr
2626
biocViews:
2727
Encoding: UTF-8
2828
Language: en-US
2929
LazyData: true
3030
Roxygen: list(markdown = TRUE)
31-
RoxygenNote: 7.3.1
31+
RoxygenNote: 7.3.2

tests/testthat/test-shiny.R

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
test_that("The Shiny App returns a proper greeting", {
2-
library(shinytest)
3-
app <- ShinyDriver$new(
2+
library(shinytest2)
3+
app <- AppDriver$new(
44
"shiny-app/",
5-
loadTimeout = 1e5,
6-
debug = "all",
7-
phantomTimeout = 1e5,
5+
load_timeout = 1e5,
6+
timeout = 1e5,
87
seed = 123
98
)
10-
app$getDebugLog()
9+
app$get_logs()
1110

1211
# Set input
13-
app$setInputs(name = "john")
14-
app$setInputs(greet = "click")
15-
output <- app$getValue(name = "greeting")
12+
app$set_inputs(name = "john")
13+
app$click("greet")
1614

17-
# test
15+
# Get output
16+
output <- app$get_value(output = "greeting")
17+
18+
# Assert
1819
expect_equal(output, "Hello, John")
1920

20-
# wait for the process to close gracefully
21-
# this allows covr to write out the coverage results
22-
p <- app$.__enclos_env__$private$shinyProcess
23-
p$interrupt()
24-
p$wait()
21+
# Stop the app
22+
app$stop()
2523
})

0 commit comments

Comments
 (0)