DEV: Add more chrome options for system specs (#22659)

* CHROME_LOAD_EXTENSIONS_MANIFEST - An env var with a path to a file
  that contains one path per line. These are paths to extensions installed
  in chrome that the user wants to load while running system specs.
  Useful to run things like Ember Inspector.
* CHROME_DISABLE_FORCE_DEVICE_SCALE_FACTOR - On some systems the
  --force-device-scale-factor=1 argument makes the UI for chrome
  super small, add a way to disable this.
This commit is contained in:
Martin Brennan 2023-07-19 10:09:34 +10:00 committed by GitHub
parent 6efae69c61
commit 2cc353104e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 1 deletions

View File

@ -676,7 +676,22 @@ def apply_base_chrome_options(options)
options.add_argument("--no-sandbox")
options.add_argument("--disable-dev-shm-usage")
options.add_argument("--mute-audio")
options.add_argument("--force-device-scale-factor=1")
# A file that contains just a list of paths like so:
#
# /home/me/.config/google-chrome/Default/Extensions/bmdblncegkenkacieihfhpjfppoconhi/4.9.1_0
#
# These paths can be found for each individual extension via the
# chrome://extensions/ page.
if ENV["CHROME_LOAD_EXTENSIONS_MANIFEST"].present?
File
.readlines(ENV["CHROME_LOAD_EXTENSIONS_MANIFEST"])
.each { |path| options.add_argument("--load-extension=#{path}") }
end
if ENV["CHROME_DISABLE_FORCE_DEVICE_SCALE_FACTOR"].blank?
options.add_argument("--force-device-scale-factor=1")
end
end
class SpecSecureRandom