If you have Node.js available on your machine, you can write
end-to-end tests using Cypress and
run them with rhino::test_e2e()
without any additional
setup. If you’d prefer to use the shinytest2
package
instead, you will need to:
- Install
shinytest2
andshinyvalidate
.- Add
library(shinytest2)
andlibrary(shinyvalidate)
lines to yourdependencies.R
. - Install the packages with
renv::install(c("shinytest2", "shinyvalidate"))
. - Update the lockfile with
renv::snapshot()
.
- Add
- Create a test with
shinytest2::record_test()
orshinytest2::use_shinytest2_test()
as usual. - Optionally you can remove the following files created by
shinytest2
, which are unnecessary in Rhino:- Runner (
tests/testthat.R
), used in R packages and executed byR CMD check
. - Setup (
tests/testthat/setup-shinytest2.R
), used in traditional Shiny applications withglobal.R
and sources in theR
directory.
- Runner (
The tests created by shinytest2
are treated as any other
testthat
tests and can be run with
rhino::test_r()
.