Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger a snapshot via keyboard? #240

Closed
cpsievert opened this issue Jan 28, 2019 · 1 comment
Closed

Trigger a snapshot via keyboard? #240

cpsievert opened this issue Jan 28, 2019 · 1 comment
Assignees

Comments

@cpsievert
Copy link
Contributor

cpsievert commented Jan 28, 2019

There may be some scenarios where you'd want to snapshot behavior while a certain DOM element is being hovered upon, so in that case, it'd be awesome to triggered a snapshot via the keyboard.

For example, I can't really test a hovered value with plotly via a screenshot:

hover-shinytest

@bersbersbers
Copy link

bersbersbers commented Oct 23, 2021

@cpsievert is there any public tutorial that you were using for the GIF above? For me, the shinytest recorder is not reacting to hover events over a plotly plot at all. I have come across the hover argument of shiny::plotOutput, but ploty::plotlyOutput does not seem to have that.

I also tried some Shiny.onInputChange('hover_data', ...) in the JavaScript code of my hover tooltip, without success. (Although I am aware that I'd probably need something else for shiny to react to shinytest setting hover_data when the recorded test is played out.)

Edit: I think I should add that from your low-res GIF, I am not sure the shinytest recorder behavior is triggered by the hover itself (which is what I would need) or by the hover changing the state of the Shiny app (which I don't do - at least not visibly). So maybe what I want (snapshot the hover itself) is not possible?

Edit2: With the help of textOutput("myplot_text") and output$myplot_text <- renderText(paste(plotly::event_data("plotly_hover"))), I have been able to get output events in the shinytest recorder at least, so I see the recorder behave in a way compatible with your GIF. But these output events don't translate into the generated script. So I think my question is, can I generate shiny input events from a plotly plot?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants