Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't make test without snapshot (or how to check if your app starts without errors) #422

Open
burgerga opened this issue Nov 17, 2021 · 0 comments

Comments

@burgerga
Copy link

burgerga commented Nov 17, 2021

Our app is in heavy development and I'm just interested to see if the app starts without errors

So using a shinytest like this won't work:

# file: test-app-runs.R
app <- ShinyDriver$new("../../")

because it doesn't create an current directory:

Error (test-app-runs.R:10:3): runApp() works
Error: Current result directory not found: app/tests/shinytest/app-runs-current
Backtrace:
 1. shinytest::expect_pass(testApp(test_path("app"), compareImages = FALSE)) test-app-runs.R:10:2
 2. shinytest::testApp(test_path("app"), compareImages = FALSE)
 3. shinytest::snapshotCompare(...)
 4. base::lapply(...)
 5. shinytest:::FUN(X[[i]], ...)
 6. shinytest:::snapshotCompareSingle(...)
 7. shinytest::snapshotUpdate(appDir, testname, quiet = quiet, suffix = suffix)
 8. shinytest:::snapshotUpdateSingle(appDir, testname, quiet, suffix)

So I looked at the items option of snapshot, but this also doesn't work

# file: test-app-runs.R
app <- ShinyDriver$new("../../")
app$snapshotInit("app-runs", screenshot = F)
app$waitForShiny()
app$snapshot(items = list(input = F, output = F, export = F))

result:

Running app-runs.R Query failed (400)----------------------
No encoding supplied: defaulting to UTF-8.
None of export, input, or output requested. 
----------------------------------------
x | 1       0 | app-runs [9.7s]                                
---------------------------------------------------------------
Error (test-app-runs.R:10:3): runApp() works
Error in `httr_get(url)`: Unable request data from server
Backtrace:
  1. shinytest::expect_pass(testApp(test_path("app"), compareImages = FALSE)) test-app-runs.R:10:2
  2. shinytest::testApp(test_path("app"), compareImages = FALSE)
  3. base::lapply(...)
  4. shinytest:::FUN(X[[i]], ...)
  5. base::source(testname, local = env)
  7. [ base::eval(...) ] with 1 more call
  9. app$snapshot(items = list(input = F, output = F, export = F))
 10. shinytest:::sd_snapshot(self, private, items, filename, screenshot)
 11. shinytest:::httr_get(url)

If I change any of the items to T, the test starts working, but I am not interested in those values.

Is there a way to fix this (write an empty json?) or is there an easier way to test if an app runs that I am missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant