tests/testthat/helper.R

skip_if_no_chromote <- function() {
  skip_on_cran()
  skip_if(lacks_chromote(), "chromote not available")
}

lacks_chromote <- function() {
  # We try twice because in particular Windows on GHA seems to need it,
  # but it doesn't otherwise hurt. More details at
  # https://github.com/rstudio/shinytest2/issues/209
  env_cache(globals, "lacks_chromote", !has_chromote() && !has_chromote())
}

has_chromote <- function() {
  tryCatch(
    {
      default <- default_chromote_object()
      local_bindings(default_timeout = 5, .env = default)
      startup <- default$new_session(wait_ = FALSE)
      default$wait_for(startup)
      TRUE
    },
    error = function(cnd) {
      FALSE
    }
  )
}

Try the chromote package in your browser

Any scripts or data that you put into this service are public.

chromote documentation built on Sept. 11, 2024, 7:21 p.m.