我找到了一个bug in 'shinytest' with 'rhandsontable' when using 'hot_validate_numeric'。
简而言之,这段代码会导致‘shinytest’出现问题:
output[["hot2"]] <- renderRHandsontable({
rhandsontable(head(iris)) %>%
hot_validate_numeric(col = 1, min = 0, max = 100) # <-- problem
})我想用'shinytest‘测试我的应用,但我不想删除hot_validate_numeric(col = 1, min = 0, max = 100)。那么,有没有一种方法可以检测到应用程序是由“shinytest”驱动的,以便执行以下操作:
if(shinytestIsRunning){
output[["hot2"]] <- renderRHandsontable({
rhandsontable(head(iris))
})
}else{
output[["hot2"]] <- renderRHandsontable({
rhandsontable(head(iris)) %>%
hot_validate_numeric(col = 1, min = 0, max = 100)
})
}发布于 2021-09-18 13:25:21
我想我有办法了。
运行'shinytest‘,如下所示:
library(shinytest)
app <- ShinyDriver$new(".", loadTimeout = 1e+05,
shinyOptions = list(test.mode = TRUE))然后,当'shinytest‘运行应用程序时,getOption("shiny.testmode")为TRUE。
https://stackoverflow.com/questions/69234900
复制相似问题