Russ Hyde begins a new series:
{shinytest2} builds upon the {shinytest} package and was written by Barret Schloerke and his colleagues at RStudio. Like puppeteer, {shinytest2} uses the Chrome DevTools Protocol to interact with the browser, which is a pretty stable basis for building a browser automation tool (the predecessor {shinytest} was built on a now-unsupported browser library called PhantomJS, so we strongly recommend migrating to {shinytest2} if you are still using {shinytest}). Test scripts are written in R and so should be accessible to R developers who are comfortable with {testthat}. There is an automated tool (described in the next post) for creating these test scripts. Also, {shinytest2} understands the architecture of shiny apps, and so it is simple to access the
input
andoutput
variables that are stored by a shiny app at any given time, theinput
s can be modified easily as well – to access these variables using the more general UI-based end-to-end testing tools is much more difficult.
Read on for the “why” behind this series and the next posts will get into more of the “how.”