I've found a bug in 'shinytest' with 'rhandsontable' when using 'hot_validate_numeric'.
In short, this code causes a problem with 'shinytest':
output[["hot2"]] <- renderRHandsontable({
rhandsontable(head(iris)) %>%
hot_validate_numeric(col = 1, min = 0, max = 100) # <-- problem
})
I want to test my app with 'shinytest', but I don't want to remove hot_validate_numeric(col = 1, min = 0, max = 100)
. So is there a way to detect that the app is powered by 'shinytest', in order to do something like:
if(shinytestIsRunning){
output[["hot2"]] <- renderRHandsontable({
rhandsontable(head(iris))
})
}else{
output[["hot2"]] <- renderRHandsontable({
rhandsontable(head(iris)) %>%
hot_validate_numeric(col = 1, min = 0, max = 100)
})
}
I think I have a way.
Run 'shinytest' as follows:
library(shinytest)
app <- ShinyDriver$new(".", loadTimeout = 1e+05,
shinyOptions = list(test.mode = TRUE))
Then getOption("shiny.testmode")
is TRUE
when 'shinytest' is running the app.