Skip to content

Error in sd_getAllValues(self, private, input, output, export)  #192

Closed

Description

@shalutiwari
recordTest('107-events',shinyOptions = list(display.mode="normal"))
Listening on http://127.0.0.1:4701
Saved test code to /Users/shalutiwari/shiny-examples-branch/shiny-examples/107-events/tests/mytest.R
Running mytest.R setInputs(app$setInputs(end = "click")): Server did not update any output values within 3 seconds. If this is expected, use `wait_=FALSE, values_=FALSE`, or increase the value of timeout_.
Error in sd_getAllValues(self, private, input, output, export) :
 Unable to fetch all values from server. Is target app running with options(shiny.testmode=TRUE?)
app <- ShinyDriver$new("../", shinyOptions = list(display.mode = "normal"))
app$snapshotInit("mytest")

app$snapshot()
app$setInputs(color1 = "click")
app$snapshot()
app$setInputs(message = "click")
app$setInputs(message = "click")
app$snapshot()
app$setInputs(busy = "click")
app$snapshot()
app$setInputs(end = "click")
app$snapshot()

Activity

  1. ariayi commented on Apr 16, 2019

    @ariayi
  2. LukasK13 commented on Oct 22, 2019

    @LukasK13

    I can confirm, this error happens when the shiny app crashes in the background process. So debugging the shiny app fixed the "bug" in shinytest for me.

  3. alexvpickering commented on Oct 22, 2019

    @alexvpickering
  4. alexvpickering commented on Nov 15, 2019

    @alexvpickering

    I think I found the culprit for my app. Here is how I debugged it:

    library(shinytest)
    app <- ShinyDriver$new("inst/app", loadTimeout = 20000)
    app$snapshotInit("mytest")
    
    # this initially didn't work
    app$snapshot()
    
    # get all inputs, outputs, and exported values
    vals <- app$listWidgets()
    
    # for me, the culprit was an output
    # loop through all output values, print each, and try selective snapshot
    for(val in vals$output) {
      print(val)
      app$snapshot(items = list(output = val))
    }
    ...
    [1] "datasets-cells_plotly-plotly"
    Error: lexical error: invalid char in json text.
                                           ERROR: lexical error: invalid c
                         (right here) ------^
    

    After identifying the culprit output, I modified its output value as described here.

    Not sure why this particular plotly output caused issues as it renders fine (I have a few others in the app as well that cause no issues).

  5. rfaelens commented on Jan 17, 2020

    @rfaelens

    The issue arises from using shiny::req or any other silent error function in combination with plotly. See plotly/plotly.R#1685 for more information.

  6. added
    bug
    on Aug 12, 2020
  7. hadley commented on Aug 12, 2020

    @hadley
    Member

    Reprex:

    path <- "../shiny-examples/107-events"
    dir.create(file.path(path, "tests", "shinytest"), recursive = TRUE)
    writeLines(con = file.path(path, "tests", "shinytest", "mytest.R"),  '
    app <- ShinyDriver$new("../../")
    app$snapshotInit("mytest")
    
    app$snapshot()
    app$setInputs(color1 = "click")
    app$snapshot()
    app$setInputs(message = "click")
    app$setInputs(message = "click")
    app$snapshot()
    app$setInputs(busy = "click")
    app$snapshot()
    app$setInputs(end = "click")
    app$snapshot()
    ')
    shinytest::testApp(path)

    I think two fixes are needed in sd_getAllValues():

    • It should use a more robust technique to confirm that httr::GET() has succeeded, and to bubble the error up to the user

    • The hint is wrong: in most cases it's not that the app hasn't been started correctly, but has stopped or is otherwise busy.

    Also related to #195

  8. hadley commented on Aug 14, 2020

    @hadley
    Member

    Minimal reprex:

    library(shinytest)
    app <- ShinyDriver$new("../shiny-examples/107-events")
    app$setInputs(end = "click")
  9. added a commit that references this issue on Aug 14, 2020
    dd14186
  10. added a commit that references this issue on Aug 19, 2020
    a3bbf0e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ShinyDriver 🏎️bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions