rstudio / shinytest

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

shinytest::recordTest() does not ork with shinyWidgets::colorPickr() #433

Open ek-2511 opened 1 year ago

ek-2511 commented 1 year ago

Hi everyone,

when running shinytest::recordTest() in order to create automated UI tests, I get the error message "ReferenceError: Can't find variable: Pickr". image The problem seems to be the colorPickr() from shinyWidgets in my app and can be reproduced with the following code:

library(shiny)
library(shinyWidgets)
library(shinytest)

ui <- fluidPage(

  titlePanel("Hello Shiny!"),

  sidebarLayout(

    sidebarPanel(

      sliderInput(inputId = "bins",
                  label = "Number of bins:",
                  min = 1,
                  max = 50,
                  value = 30),

      colorPickr(
        inputId = "color",
        label = "Pick a color",
        selected = "blue" )

    ),

    mainPanel(

      plotOutput(outputId = "distPlot")

    )
  )
)

server <- function(input, output) {

  output$distPlot <- renderPlot({

    x    <- faithful$waiting
    bins <- seq(min(x), max(x), length.out = input$bins + 1)

    hist(x, breaks = bins, col = "#007bc2", border = "white",
         xlab = "Waiting time to next eruption (in mins)",
         main = "Histogram of waiting times")

  })

}

shinyApp(ui, server)

The package versions I use are: shinytest_1.5.1, shinyWidgets_0.6.2, shiny_1.6.0 I am not sure, whether this is a problem caused by shinyWidgets, shinytest, or simply me. ;-) I tried to update my R version and all packages, but it still did not work. Has anybody come across this issue before? Thanks!