title: Using js shiny events in Cypress
body: <p>I need to use Javascript shiny events (e.g. <code>shiny:recalculated</code>) described here <a href="https://shiny.rstudio.com/articles/js-events.html" rel="nofollow noreferrer">https://shiny.rstudio.com/articles/js-events.html</a> to know when to trigger next frontend test action (without sleeps). This makes tests deterministic and reduces testing time.
  However, I cannot use the event from Cypress nor from slave browser developer console. </p>
  
  <p>Consider e.g. simple code taken from <a href="https://github.com/rstudio/shiny-examples/blob/master/084-single-file/app.R" rel="nofollow noreferrer">https://github.com/rstudio/shiny-examples/blob/master/084-single-file/app.R</a> and modified to run app in browser</p>
  
  <pre><code># Global variables can go here
  n &lt;- 200
  
  
  # Define the UI
  ui &lt;- bootstrapPage(
    numericInput('n', 'Number of obs', n),
    plotOutput('plot')
  )
  
  
  # Define the server code
  server &lt;- function(input, output) {
    output$plot &lt;- renderPlot({
      hist(runif(input$n))
    })
  }
  
  # Return a Shiny app object
  shinyApp(ui = ui, server = server, options = list(launch.browser = TRUE))
  </code></pre>
  
  <p>After executing</p>
  
  <pre><code>$(document).on('shiny:recalculated', function (event) {
                  if (event.target.id === "plot") {
                      alert('Output has been just refreshed')
                  }
              })
  </code></pre>
  
  <p>in browser developer console and modifying input (to <code>201</code>) I get</p>
  
  <p><a href="https://i.stack.imgur.com/p5CRq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p5CRq.jpg" alt="Chrome window"></a></p>
  
  <p>However, that's not the case in case of browser runned by Cypress. Any ideas why?</p>