Closed KZARCA closed 6 years ago
Interesting, I think it's because when those calls are in global.R, it prints out a lot of package loading messages before the Listening on http://127.0.0.1:7738
.
Can you try doing this and see if it makes a difference?
suppressPackageStartupMessages({
library(shinyjs)
library(RCurl) #base64
library(Hmisc)
library(boot)
library(car)
library(cowplot)
library(dplyr)
library(purrr)
library(shinydashboard)
})
Actually, I think now that the problem is that the packages take a long time to load, and it's timing out while waiting for the app to start. The reason that it's different between global.R and server.R is that that global.R is sourced before it prints out Listening on http://127.0.0.1:7738
, and server.R is sourced after.
Thanks a lot! With suppressPackageStartupMessages(), it works perfectly.
I have a similar issue using global.R
. My time lag is caused by loading data using the googlesheets
package in the global.R
. Can we look to create a parameter in recordTest()
to increase the wait time to check for a shiny port?
@KZARCA Please, can you explain me how you fixed it? I am having the same issue. When I run recordTest()
on a really small app, it works without any problems. If I run recordTest()
on my really big application, I am getting the same error. I do not understand how you use suppressPackageStartupMessages()
and how is it possible that it fixed the problem.
I've added a loadTimeout
parameter to recordTest()
in 89a0c09.
@alik33 If you have a chance, please try it out and let us know if it works for you.
@wch I tried it, set loadTimeout
to 100000
and it did not work. So I rewrote loadTimeout
's default value from 10000
to 100000
, installed that and it works now.
@alik33 Are you saying that it didn't work to do recordTest(..., loadTimeout=100000)
, but it did work to change the function signature of recordTest()
so that the default value for loadTimeout
was 100000
?
@wch Exactly, completely weird.
@alik33 Very strange. I have no idea why that would make a difference.
I just had the issue during Shiny in producton workshop at RStudio Conf, and I can confirm the loadTimeout
argument work. I use recordTest(..., loadTimeout=100000)
and no more error about shiny port.
I had already recorded a longish test and wanted to use it. My app loads & processes a lot of data before starting the UI.
"testApp("
app <- ShinyDriver$new("../../", loadTimeout=100000)
it works. Thanks all!
ShinyDriver$new("../../", loadTimeout=100000)
also helps avoiding "Cannot find shiny port number" when using gctorture2(999, inhibit_release = TRUE)
Hi, I found a strange behaviour with shinytest. When I run recordTest(), I get an error:
Error in sd_startShiny(self, private, path) : Cannot find shiny port number. Error: Running application in test mode.
I don't know how related this issue is to #99 and #104. It seems due to the presence of a global.R file and package loading. When I load packages in server.R and/or ui.R, I do not get this problem.My minimal reproductible example is this one:
ui.R
server.R
global.R
Session info