using shinytest2 with leprecahun
Opened this issue · 0 comments
Hi. Thank you for developing such a great package.
I'm trying out leprechaun to develop a new shiny application and I have a question.
I want to use shinytest2 with leprechaun, so I used the record_test('R/')
command and I'm getting an error.
The below logs are a bit specific, but in conclusion, I understand that the problem is caused by ui.R not recognizing the serveAsset function.
> record_test('R/')
`$view()`ing chromote session for debugging purposes
Error in `app_initialize()`:
! Shiny app did not become stable in 15000ms.
Message: Timed out waiting for JavaScript script to return `true`
ℹ `timeout`: 15000
ℹ `script`:
window.shinytest2 && window.shinytest2.ready === true
Caused by error in `chromote_wait_for_condition()`:
! Timed out waiting for JavaScript script to return `true`
ℹ `timeout`: 15000
ℹ `script`:
window.shinytest2 && window.shinytest2.ready === true
ℹ You can inspect the failed AppDriver object via `rlang::last_error()$app`
ℹ AppDriver logs:
{shinytest2} R info 13:55:55.86 Start AppDriver initialization
{shinytest2} R info 13:55:55.86 Starting Shiny app
{shinytest2} R info 13:55:56.28 Creating new ChromoteSession
{shinytest2} R info 13:55:56.33 Navigating to Shiny app
{shinytest2} R info 13:55:56.38 Injecting shiny-tracer.js
{chromote} JS info 13:55:56.39 shinytest2; jQuery not found
{chromote} JS info 13:55:56.39 shinytest2; Loaded
{shinytest2} R info 13:55:56.39 Waiting for Shiny to become ready
{shinytest2} R info 13:56:11.49 Error while initializing AppDriver:
Shiny app did not become stable in 15000ms.
Message: Timed out waiting for JavaScript script to return `true`
ℹ `timeout`: 15000
ℹ `script`:
window.shinytest2 && window.shinytest2.ready === true
Caused by error in `chromote_wait_for_condition()`:
! Timed out waiting for JavaScript script to return `true`
ℹ `timeout`: 15000
ℹ `script`:
window.shinytest2 && window.shinytest2.ready === true
{shinytest2} R info 13:56:11.49 Viewing chromote session for debugging purposes
{shinytest2} R info 13:56:11.49 Viewing chromote session
{shiny} R stderr ----------- Loading required package: shiny
{shiny} R stderr ----------- Running application in test mode.
{shiny} R stderr -----------
{shiny} R stderr ----------- Listening on http://127.0.0.1:4966
{shiny} R stderr ----------- Warning: Error in serveAssets: could not find function "serveAssets"
{shiny} R stderr ----------- 73: ui [/Users/jinhwan/Documents/ssc/R/ui.R#40]
{shiny} R stderr ----------- 14: <Anonymous>
{shiny} R stderr ----------- 12: <Anonymous>
{shiny} R stderr ----------- 11: <Anonymous>
{shiny} R stderr ----------- 10: base::do.call
{shiny} R stderr ----------- 9: base::saveRDS
{shiny} R stderr ----------- 8: base::withCallingHandlers
{shiny} R stderr ----------- 7: doTryCatch
{shiny} R stderr ----------- 6: tryCatchOne
{shiny} R stderr ----------- 5: tryCatchList
{shiny} R stderr ----------- 2: tryCatchList
{shiny} R stderr ----------- 1: base::tryCatch
since R/assets.R
has a serveAsset
function (which I could run shiny itself with the run() function), so I thought it would be loaded when I loaded the files with devtools::load_all(".")
but it was not.
I temporarily removed all the "assets code" from ui.R
and ran shinytest2 (with same command above) again, and got an error that "bs_theme() could not be loaded". (I think this is the part that shouldn't have an error)
What can I try to get shinytest2 to work?
Thanks in advance