I am trying to use shniytest
to automatically test a couple of app examples in the examples directory of my package and I am running into problems. I will give an easy example which should show the essence of the problem.
We have the following file structure:
app
-app.R
tests
-shinytest.R
-shinytest
-mytest.R
The files are of the following form:
app.R:
library(shiny)
ui <- fluidPage()
server <- function(input, output, session) {}
shinyApp(ui, server)
shinytest.R:
library(shinytest)
shinytest::testApp("../app/")
mytest.R:
app <- ShinyDriver$new("../../app/")
app$snapshotInit("mytest")
app$snapshot()
Furethermore, the package shinytest is attached.
If I run now "runTests()" in the cosole I get the error:
Error in shinytest.R
Error in findTestsDir(appDir, quiet = FALSE): tests/ directory doesn't exist
Error: Shiny App Test Failures detected in
* ./tests/shinytest.R
If I put app.R out of the directory app, i.e. change the directory structure to
app.R
tests
-shinytest.R
-shinytest
-mytest.R
and adapt the paths in shinytest.R and mytest.R to the new structure, runTests
works smoothly without error. But this is not what I need since I want to test several examples in the examples directory of my package.
I use shinytest 1.4.0, shiny 1.5.0, testthat 2.3.2, R version 3.6.3 on Pop!_OS Linux.
Any advice or suggestions how to make my example running are highly appreciated.