Open hijifres opened 4 years ago
hello!
Sure thing, you can do:
golem::add_rstudioconnect_file()
shinytest::recordTest()
See https://engineering-shiny.org/step-secure.html#shinytest for more information
Hi, I'm also using golem and Shinytest.
This works fine when running shiny::runTests()
or devtools::test()
, but I don't get it to work with devtools::check()
(and therefore also not on the CI).
I get this error:
`> pkgload::load_all()
I followed this instructions, to run shinytests within a package: https://rstudio.github.io/shinytest/articles/package.html There another "app.R" file is created within the testfolder which is used for testing (instead of the app.R in the root folder).
Is there a possibility to get this to work? I'm happy to provide a reproducable example, if that helps.
Hey @AlexandraKapp,
This is a known bug that should now be solved in the latest version of golem (git version).
Can you try the following in your app:
remotes::install_github("thinkr-open/golem", force = TRUE)
unlink("tests/testthat/test-golem-recommended.R")
golem::use_recommended_tests()
devtools::check()
Thanks, Colin
Thanks for you're help! I do run into the same problem though after following the steps... I also created a fresh test project with the current golem version (0.2.1.9024) and followed the steps.
I tried the folder setup recommended here: https://rstudio.github.io/shinytest/articles/package.html as well as this setup:
└───tests
│───app.R
│───shinytest.R
├───shinytest
│ └───my_shiny_test.R
│ └───my_shiny_test-expected
Anything I might have forgotten?
Hello,
First, thank you so much for developing this great framework. I think I got a solution for this issue. My setup is:
├── DESCRIPTION
├── NAMESPACE
├── R
├── inst
| ├── app.R
| └── tests/
| ├── shinytest.R
| └── shinytest/
| ├── mytest.R
| └── mytest-expected/
| ├── 001.json
| └── 001.png
└── tests
├── testthat
│ └── test-shinyTest.R
└── testthat.R
The shinytest package needs to be included in the Suggests field of the DESCRIPTION file. I don´t know if it is the best way possible, but it is working using devtools::test() and GitHub actions.
How about testing individual modules?
Hi,
Many thanks for this great framework. I was wondering if there was a way to combine golem and Shinytest, as testApp() only take a "path" argument, in which there must be an app.R file or ui.R / server.R files.
Is that achievable?