From 8d94b342a316e9b959256524d0f8f47423d4fba9 Mon Sep 17 00:00:00 2001 From: Alex Rodionov Date: Wed, 1 May 2024 21:14:15 -0700 Subject: [PATCH] [rb] Use no-sandbox on non-Windows This is required on RBE which runs Docker linux --- .../selenium/webdriver/spec_support/test_environment.rb | 2 ++ rb/spec/tests.bzl | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb b/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb index f1864b587dfa3..aafa63bcd17bb 100644 --- a/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb +++ b/rb/spec/integration/selenium/webdriver/spec_support/test_environment.rb @@ -250,6 +250,7 @@ def safari_preview_driver(**opts) def chrome_options(args: [], **opts) opts[:binary] ||= ENV['CHROME_BINARY'] if ENV.key?('CHROME_BINARY') args << '--headless=chrome' if ENV['HEADLESS'] + args << '--no-sandbox' if ENV['NO_SANDBOX'] args << '--disable-gpu' WebDriver::Options.chrome(browser_version: 'stable', args: args, **opts) end @@ -257,6 +258,7 @@ def chrome_options(args: [], **opts) def edge_options(args: [], **opts) opts[:binary] ||= ENV['EDGE_BINARY'] if ENV.key?('EDGE_BINARY') args << '--headless=chrome' if ENV['HEADLESS'] + args << '--no-sandbox' if ENV['NO_SANDBOX'] args << '--disable-gpu' WebDriver::Options.edge(browser_version: 'stable', args: args, **opts) end diff --git a/rb/spec/tests.bzl b/rb/spec/tests.bzl index da6f5f2460e82..9c0f1596de6e9 100644 --- a/rb/spec/tests.bzl +++ b/rb/spec/tests.bzl @@ -30,6 +30,9 @@ BROWSERS = { }) | select({ "@selenium//common:use_headless_browser": {"HEADLESS": "true"}, "//conditions:default": {}, + }) | select({ + "@platforms//os:windows": {}, + "//conditions:default": {"NO_SANDBOX": "true"}, }), }, "edge": { @@ -53,6 +56,9 @@ BROWSERS = { }) | select({ "@selenium//common:use_headless_browser": {"HEADLESS": "true"}, "//conditions:default": {}, + }) | select({ + "@platforms//os:windows": {}, + "//conditions:default": {"NO_SANDBOX": "true"}, }), }, "firefox": {