Skip to content

Commit 22501ea

Browse files
committed
use a similar skipping strategy for shinytest
1 parent fb5d2ef commit 22501ea

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

tests/testthat/helper-skip.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ skip_cloud_tests <- function() {
1515
skip("Cloud testing is only run on Windows with the current release of R")
1616
}
1717
}
18+
19+
skip_shinytest_tests <- function() {
20+
skip_on_cran()
21+
skip_if_not_installed("shinytest")
22+
if (!as.logical(Sys.getenv("SHINYTEST", FALSE))) {
23+
skip("shinytest testing requires the SHINYTEST environment variable to be true")
24+
}
25+
}

tests/testthat/helper-vdiffr.R

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ if (enable_vdiffr) {
4646
writeLines(svg_txt, file)
4747
}
4848

49-
# force the vdiffr shiny app to open in a real browser
50-
# (some svg files seem to not render properly in RStudio)
51-
options(shiny.launch.browser = interactive())
5249
}
5350

5451
expect_doppelganger <- function(p, name, ...) {

tests/testthat/test-plotly-shiny.R

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@ test_that("event_unregister() de-registers an event", {
2020
})
2121

2222
test_that("event_data shiny app works", {
23-
skip_on_cran()
24-
skip_if_not_installed("shinytest")
25-
if (enable_vdiffr) skip("shiny testing not performed during visual testing")
23+
skip_shinytest_tests()
2624

27-
# Use compareImages=FALSE because the expected image screenshots were created
28-
# on a Mac, and they will differ from screenshots taken on the CI platform,
29-
# which runs on Linux.
3025
appdir <- system.file(package = "plotly", "examples", "shiny", "event_data")
31-
shinytest::expect_pass(shinytest::testApp(appdir, compareImages = FALSE))
26+
shinytest::expect_pass(shinytest::testApp(appdir))
3227
})

0 commit comments

Comments
 (0)