diff --git a/NEWS.md b/NEWS.md index 0613798..f0b8ecc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -6,7 +6,7 @@ * Breaking change: `Chromote$is_active()` method now reports if there is an active connection to the underlying chrome instance, rather than whether or not that instance is alive (#94). -* `--disable-gpu` is no longer included in the default Chrome arguments. +* `--disable-gpu` is no longer included in the default Chrome arguments, except on windows where empirically it appears to be necessary (otherwise GHA check runs never terminate). * `ChromoteSession` now records the `targetId`. This eliminates one round-trip to the browser when viewing or closing a session. You can now call the `$respawn()` method if a session terminates and you want to reconnect to the same target (#94). diff --git a/R/chromote.R b/R/chromote.R index 8e29f2d..d438dfa 100644 --- a/R/chromote.R +++ b/R/chromote.R @@ -628,23 +628,27 @@ is_missing_linux_user <- cache_value(function() { #' Default chromote arguments are composed of the following values (when #' appropriate): #' +#' * [`"--disable-gpu"`](https://peter.sh/experiments/chromium-command-line-switches/#disable-gpu) +#' * Only added on Windows, as empirically it appears to be needed +#' (if not, check runs on GHA never terminate). +#' * Disables GPU hardware acceleration. If software renderer is not in place, then the GPU process won't launch. #' * [`"--no-sandbox"`](https://peter.sh/experiments/chromium-command-line-switches/#no-sandbox) #' * Only added when `CI` system environment variable is set, when the #' user on a Linux system is not set, or when executing inside a Docker container. -#' * \verb{Disables the sandbox for all process types that are normally sandboxed. Meant to be used as a browser-level switch for testing purposes only} +#' * Disables the sandbox for all process types that are normally sandboxed. Meant to be used as a browser-level switch for testing purposes only #' * [`"--disable-dev-shm-usage"`](https://peter.sh/experiments/chromium-command-line-switches/#disable-dev-shm-usage) #' * Only added when `CI` system environment variable is set or when inside a docker instance. -#' * \verb{The /dev/shm partition is too small in certain VM environments, causing Chrome to fail or crash} +#' * The `/dev/shm` partition is too small in certain VM environments, causing Chrome to fail or crash. #' * [`"--force-color-profile=srgb"`](https://peter.sh/experiments/chromium-command-line-switches/#force-color-profile) #' * This means that screenshots taken on a laptop plugged into an external #' monitor will often have subtly different colors than one taken when #' the laptop is using its built-in monitor. This problem will be even #' more likely across machines. -#' * \verb{Force all monitors to be treated as though they have the specified color profile.} +#' * Force all monitors to be treated as though they have the specified color profile. #' * [`"--disable-extensions"`](https://peter.sh/experiments/chromium-command-line-switches/#disable-extensions) -#' * \verb{Disable extensions.} +#' * Disable extensions. #' * [`"--mute-audio"`](https://peter.sh/experiments/chromium-command-line-switches/#mute-audio) -#' * \verb{Mutes audio sent to the audio device so it is not audible during automated testing} +#' * Mutes audio sent to the audio device so it is not audible during automated testing. #' #' @return A character vector of default command-line arguments to be used with #' every new [`ChromoteSession`] @@ -654,6 +658,9 @@ is_missing_linux_user <- cache_value(function() { #' @export default_chrome_args <- function() { c( + # Empirically, appears to be needed for check runs to terminate on GHA + if (is_windows()) "--disable-gpu", + # > Note: --no-sandbox is not needed if you properly setup a user in the container. # https://developers.google.com/web/updates/2017/04/headless-chrome if (is_inside_ci() || is_missing_linux_user() || is_inside_docker()) { @@ -705,7 +712,7 @@ reset_chrome_args <- function() { #' @examples #' old_chrome_args <- get_chrome_args() #' -#' # Disable the gpu and use `/dev/shm` +#' # Disable the gpu and use of `/dev/shm` #' set_chrome_args(c("--disable-gpu", "--disable-dev-shm-usage")) #' #' #... Make new `Chrome` or `ChromoteSession` instance diff --git a/man/default_chrome_args.Rd b/man/default_chrome_args.Rd index a50c451..b0274fe 100644 --- a/man/default_chrome_args.Rd +++ b/man/default_chrome_args.Rd @@ -32,16 +32,22 @@ list of possible arguments. Default chromote arguments are composed of the following values (when appropriate): \itemize{ +\item \href{https://peter.sh/experiments/chromium-command-line-switches/#disable-gpu}{\code{"--disable-gpu"}} +\itemize{ +\item Only added on Windows, as empirically it appears to be needed +(if not, check runs on GHA never terminate). +\item Disables GPU hardware acceleration. If software renderer is not in place, then the GPU process won't launch. +} \item \href{https://peter.sh/experiments/chromium-command-line-switches/#no-sandbox}{\code{"--no-sandbox"}} \itemize{ \item Only added when \code{CI} system environment variable is set, when the user on a Linux system is not set, or when executing inside a Docker container. -\item \verb{Disables the sandbox for all process types that are normally sandboxed. Meant to be used as a browser-level switch for testing purposes only} +\item Disables the sandbox for all process types that are normally sandboxed. Meant to be used as a browser-level switch for testing purposes only } \item \href{https://peter.sh/experiments/chromium-command-line-switches/#disable-dev-shm-usage}{\code{"--disable-dev-shm-usage"}} \itemize{ \item Only added when \code{CI} system environment variable is set or when inside a docker instance. -\item \verb{The /dev/shm partition is too small in certain VM environments, causing Chrome to fail or crash} +\item The \verb{/dev/shm} partition is too small in certain VM environments, causing Chrome to fail or crash. } \item \href{https://peter.sh/experiments/chromium-command-line-switches/#force-color-profile}{\code{"--force-color-profile=srgb"}} \itemize{ @@ -49,15 +55,15 @@ user on a Linux system is not set, or when executing inside a Docker container. monitor will often have subtly different colors than one taken when the laptop is using its built-in monitor. This problem will be even more likely across machines. -\item \verb{Force all monitors to be treated as though they have the specified color profile.} +\item Force all monitors to be treated as though they have the specified color profile. } \item \href{https://peter.sh/experiments/chromium-command-line-switches/#disable-extensions}{\code{"--disable-extensions"}} \itemize{ -\item \verb{Disable extensions.} +\item Disable extensions. } \item \href{https://peter.sh/experiments/chromium-command-line-switches/#mute-audio}{\code{"--mute-audio"}} \itemize{ -\item \verb{Mutes audio sent to the audio device so it is not audible during automated testing} +\item Mutes audio sent to the audio device so it is not audible during automated testing. } } } @@ -78,7 +84,7 @@ passed when initializing. Returns the updated defaults. \examples{ old_chrome_args <- get_chrome_args() -# Disable the gpu and use `/dev/shm` +# Disable the gpu and use of `/dev/shm` set_chrome_args(c("--disable-gpu", "--disable-dev-shm-usage")) #... Make new `Chrome` or `ChromoteSession` instance diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R index 2381a31..312363d 100644 --- a/tests/testthat/helper.R +++ b/tests/testthat/helper.R @@ -1,6 +1,5 @@ skip_if_no_chromote <- function() { skip_on_cran() - skip_on_os("windows") # currently hangs the test process skip_if(lacks_chromote(), "chromote not available") } diff --git a/tests/testthat/test-default_chromote_args.R b/tests/testthat/test-default_chromote_args.R index 0ac879a..83c38e7 100644 --- a/tests/testthat/test-default_chromote_args.R +++ b/tests/testthat/test-default_chromote_args.R @@ -1,5 +1,5 @@ -min_chrome_arg_length <- if (is_inside_ci()) 4 else 3 +min_chrome_arg_length <- 3 + is_inside_ci() + is_windows() test_that("default args are retrieved", { expect_gte(length(default_chrome_args()), min_chrome_arg_length)