diff options
author | ddavison <ddavison@gitlab.com> | 2019-01-07 14:20:23 -0800 |
---|---|---|
committer | Sanad Liaquat <sliaquat@gitlab.com> | 2019-01-09 12:02:56 +0500 |
commit | 8677d408ee4686ddc6f9b49779de226d1dba08c7 (patch) | |
tree | 5c9c6e5fcf80dea630e013a617931a4b517db804 /qa | |
parent | 2620efaf149fb5ea670812432a0acea41a9c01d9 (diff) | |
download | gitlab-ce-8677d408ee4686ddc6f9b49779de226d1dba08c7.tar.gz |
Dont pass extraneous chrome variables to other browsers
Extract remote_grid_credentials
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/runtime/browser.rb | 21 | ||||
-rw-r--r-- | qa/qa/runtime/env.rb | 9 |
2 files changed, 20 insertions, 10 deletions
diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb index 8ef1b003b25..0bcf5e693f0 100644 --- a/qa/qa/runtime/browser.rb +++ b/qa/qa/runtime/browser.rb @@ -57,18 +57,21 @@ module QA # QA::Runtime::Env.browser.capitalize will work for every driver type except PhantomJS. # We will have no use to use PhantomJS so this shouldn't be a problem. options = Selenium::WebDriver.const_get(QA::Runtime::Env.browser.capitalize)::Options.new - options.add_argument("window-size=1240,1680") - # Chrome won't work properly in a Docker container in sandbox mode - options.add_argument("no-sandbox") + if QA::Runtime::Env.browser == :chrome + options.add_argument("window-size=1240,1680") - # Run headless by default unless CHROME_HEADLESS is false - if QA::Runtime::Env.chrome_headless? - options.add_argument("headless") + # Chrome won't work properly in a Docker container in sandbox mode + options.add_argument("no-sandbox") - # Chrome documentation says this flag is needed for now - # https://developers.google.com/web/updates/2017/04/headless-chrome#cli - options.add_argument("disable-gpu") + # Run headless by default unless CHROME_HEADLESS is false + if QA::Runtime::Env.chrome_headless? + options.add_argument("headless") + + # Chrome documentation says this flag is needed for now + # https://developers.google.com/web/updates/2017/04/headless-chrome#cli + options.add_argument("disable-gpu") + end end # Use the same profile on QA runs if CHROME_REUSE_PROFILE is true. diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 2e7ad193337..1e293c3a0de 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -62,7 +62,10 @@ module QA # - "http://user:pass@somehost.com/wd/hub" # - "https://user:pass@somehost.com:443/wd/hub" # - "http://localhost:4444/wd/hub" - "#{remote_grid_protocol}://#{"#{remote_grid_username}:#{remote_grid_access_key}@" if remote_grid_username}#{ENV['QA_REMOTE_GRID']}/wd/hub" if ENV['QA_REMOTE_GRID'] + + return unless ENV['QA_REMOTE_GRID'] + + "#{remote_grid_protocol}://#{remote_grid_credentials}#{ENV['QA_REMOTE_GRID']}/wd/hub" end def remote_grid_username @@ -183,6 +186,10 @@ module QA private + def remote_grid_credentials + remote_grid_username ? "#{remote_grid_username}:#{remote_grid_access_key}@" : '' + end + def enabled?(value, default: true) return default if value.nil? |