rstudio / shinytest

Automated testing for shiny apps
https://rstudio.github.io/shinytest/
Other
225 stars 55 forks source link

cannot find values special character in input names #428

Open mtcarsalot opened 2 years ago

mtcarsalot commented 2 years ago

Maybe it is a bad habbit of mine, however I use to have .'s in my shiny input names fx: actionButton("inp.go","GO"). However shinytest cannot find those inputs if I ask to getValue("inp.go") however it does appear if i request getAllValues(). I'm geussing it was to do with css syntax. Is this a conscious choise for shinytest and can I somehow get around it?

library(shinytest)
library(shiny)

ui <- fluidPage(
   actionButton("inp.go","GO WITH DOTS")  
  ,actionButton("inp-go","GO WITH HYPHEN")  
  ,actionButton("inp_go","GO WITH UNDERSCORE")  
  ,actionButton("inp@go","GO WITH ALPHAKRÜL")  
  ,actionButton("inp#go","GO WITH ALPHAKRÜL")  
)
server <- function(input, output, session) {}

app <- shinytest::ShinyDriver$new(shinyApp(ui, server))

app$getAllValues()
app$getValue("inp.go") # cannot find
app$getValue("inp-go") # works
app$getValue("inp_go") # great succes
app$getValue("inp@go") # DOM fail
app$getValue("inp#go") # cannot find

app$finalize()

sessioninfo:

R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=Danish_Denmark.1252  LC_CTYPE=Danish_Denmark.1252    LC_MONETARY=Danish_Denmark.1252 LC_NUMERIC=C                   
[5] LC_TIME=Danish_Denmark.1252    

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] shiny_1.7.1     shinytest_1.5.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3     compiler_4.0.3   later_1.3.0      base64enc_0.1-3  tools_4.0.3      testthat_3.1.4   digest_0.6.29    jsonlite_1.8.0  
 [9] lifecycle_1.0.1  debugme_1.1.0    png_0.1-7        rlang_1.0.2      cli_3.3.0        curl_4.3.2       fastmap_1.1.0    withr_2.5.0     
[17] webdriver_1.0.6  httr_1.4.3       parsedate_1.3.0  showimage_1.0.0  R6_2.5.1         processx_3.5.3   rematch_1.0.1    pingr_2.0.1     
[25] callr_3.7.0      magrittr_2.0.3   ps_1.7.0         promises_1.2.0.1 ellipsis_0.3.2   htmltools_0.5.2  assertthat_0.2.1 mime_0.12       
[33] xtable_1.8-4     renv_0.15.4      httpuv_1.6.5     crayon_1.5.1     brio_1.1.3