Skip to content

Commit 4a1ee07

Browse files
committed
use a similar skipping strategy for shinytest
1 parent fb5d2ef commit 4a1ee07

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
- {os: windows-latest, r: 'release'}
3131
- {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"}
3232
- {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.1.0 (ubuntu-18.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
33-
# visual tests are only run on linux r-release since the svg generator (orca) isn't cross-platform
34-
- {os: ubuntu-18.04, r: 'release', vdiffr: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
33+
# vdiffr & shinytest only runs on linux r-release since the results aren't cross-platform
34+
- {os: ubuntu-18.04, r: 'release', vdiffr: true, shinytest: true, rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
3535
- {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
3636
- {os: ubuntu-18.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
3737
- {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
@@ -40,6 +40,7 @@ jobs:
4040
env:
4141
RSPM: ${{ matrix.config.rspm }}
4242
VDIFFR: ${{ matrix.config.vdiffr }}
43+
SHINYTEST: ${{ matrix.config.shinytest }}
4344
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
4445

4546
steps:

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)