mirror of
https://github.com/redmine/redmine.git
synced 2025-10-30 01:36:04 +01:00
Adds GOOGLE_CHROME_OPTS_ARGS environment variable to define Google Chrome options arguments (#34269).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@20708 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -77,6 +77,8 @@ The following environment variables can be used to configure your system tests s
|
|||||||
`CAPYBARA_SERVER_PORT`: configure server port
|
`CAPYBARA_SERVER_PORT`: configure server port
|
||||||
`SELENIUM_REMOTE_URL`: remote Selenium URL
|
`SELENIUM_REMOTE_URL`: remote Selenium URL
|
||||||
`CAPYBARA_APP_HOST`: by default, the tests expect to have the application running on your localhost. Using this variable, you can set a custom URL
|
`CAPYBARA_APP_HOST`: by default, the tests expect to have the application running on your localhost. Using this variable, you can set a custom URL
|
||||||
|
`GOOGLE_CHROME_OPTS_ARGS`: configure Google Chrome Options arguments as a comma-delimited string. For example, it can be used to run the tests in headless mode:
|
||||||
|
`export GOOGLE_CHROME_OPTS_ARGS="headless,disable-gpu,no-sandbox,disable-dev-shm-usage"`
|
||||||
|
|
||||||
One use case of these variables is to run the system tests on a remote Selenium/ChromeDriver (eg: Docker).
|
One use case of these variables is to run the system tests on a remote Selenium/ChromeDriver (eg: Docker).
|
||||||
|
|
||||||
|
|||||||
@@ -21,16 +21,21 @@ require File.expand_path('../test_helper', __FILE__)
|
|||||||
|
|
||||||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
||||||
DOWNLOADS_PATH = File.expand_path(File.join(Rails.root, 'tmp', 'downloads'))
|
DOWNLOADS_PATH = File.expand_path(File.join(Rails.root, 'tmp', 'downloads'))
|
||||||
|
GOOGLE_CHROME_OPTS_ARGS = []
|
||||||
|
|
||||||
# Allow running Capybara default server on custom IP address and/or port
|
# Allow running Capybara default server on custom IP address and/or port
|
||||||
Capybara.server_host = ENV['CAPYBARA_SERVER_HOST'] if ENV['CAPYBARA_SERVER_HOST']
|
Capybara.server_host = ENV['CAPYBARA_SERVER_HOST'] if ENV['CAPYBARA_SERVER_HOST']
|
||||||
Capybara.server_port = ENV['CAPYBARA_SERVER_PORT'] if ENV['CAPYBARA_SERVER_PORT']
|
Capybara.server_port = ENV['CAPYBARA_SERVER_PORT'] if ENV['CAPYBARA_SERVER_PORT']
|
||||||
|
|
||||||
|
# Allow defining Google Chrome options arguments based on a comma-delimited string environment variable
|
||||||
|
GOOGLE_CHROME_OPTS_ARGS = ENV['GOOGLE_CHROME_OPTS_ARGS'].split(",") if ENV['GOOGLE_CHROME_OPTS_ARGS']
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
# Allow running tests using a remote Selenium hub
|
# Allow running tests using a remote Selenium hub
|
||||||
options[:url] = ENV['SELENIUM_REMOTE_URL'] if ENV['SELENIUM_REMOTE_URL']
|
options[:url] = ENV['SELENIUM_REMOTE_URL'] if ENV['SELENIUM_REMOTE_URL']
|
||||||
options[:desired_capabilities] = Selenium::WebDriver::Remote::Capabilities.chrome(
|
options[:desired_capabilities] = Selenium::WebDriver::Remote::Capabilities.chrome(
|
||||||
'goog:chromeOptions' => {
|
'goog:chromeOptions' => {
|
||||||
|
'args' => GOOGLE_CHROME_OPTS_ARGS,
|
||||||
'prefs' => {
|
'prefs' => {
|
||||||
'download.default_directory' => DOWNLOADS_PATH,
|
'download.default_directory' => DOWNLOADS_PATH,
|
||||||
'download.prompt_for_download' => false,
|
'download.prompt_for_download' => false,
|
||||||
|
|||||||
Reference in New Issue
Block a user