Commit 15b1870e authored by Dan Davison's avatar Dan Davison

Merge branch 'qa-update-selenium-webdriver' into 'master'

Update qa selenium-webdriver version

See merge request gitlab-org/gitlab!63929
parents db6bb021 02320e4a
......@@ -9,7 +9,7 @@ gem 'capybara', '~> 3.29.0'
gem 'capybara-screenshot', '~> 1.0.23'
gem 'rake', '~> 12.3.3'
gem 'rspec', '~> 3.7'
gem 'selenium-webdriver', '~> 3.12'
gem 'selenium-webdriver', '~> 4.0.0.beta4'
gem 'airborne', '~> 0.3.4'
gem 'rest-client', '~> 2.1.0'
gem 'nokogiri', '~> 1.11.1'
......
......@@ -47,7 +47,7 @@ GEM
watir (~> 6.17)
chemlab-library-www-gitlab-com (0.1.1)
chemlab (~> 0.4)
childprocess (3.0.0)
childprocess (4.1.0)
coderay (1.1.2)
concord (0.1.5)
adamantium (~> 0.2.0)
......@@ -136,6 +136,7 @@ GEM
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.5)
rotp (3.1.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
......@@ -162,9 +163,10 @@ GEM
rspec-core (>= 2, < 4, != 2.12.0)
ruby-debug-ide (0.7.2)
rake (>= 0.8.1)
rubyzip (1.3.0)
selenium-webdriver (3.142.6)
childprocess (>= 0.5, < 4.0)
rubyzip (2.3.0)
selenium-webdriver (4.0.0.beta4)
childprocess (>= 0.5, < 5.0)
rexml (~> 3.2)
rubyzip (>= 1.2.2)
systemu (2.6.5)
thread_safe (0.3.6)
......@@ -218,7 +220,7 @@ DEPENDENCIES
rspec-retry (~> 0.6.1)
rspec_junit_formatter (~> 0.4.1)
ruby-debug-ide (~> 0.7.0)
selenium-webdriver (~> 3.12)
selenium-webdriver (~> 4.0.0.beta4)
timecop (~> 0.9.1)
BUNDLED WITH
......
......@@ -66,58 +66,58 @@ module QA
return if Capybara.drivers.include?(:chrome)
Capybara.register_driver QA::Runtime::Env.browser do |app|
capabilities = Selenium::WebDriver::Remote::Capabilities.send(QA::Runtime::Env.browser,
# This enables access to logs with `page.driver.manage.get_log(:browser)`
loggingPrefs: {
browser: "ALL",
client: "ALL",
driver: "ALL",
server: "ALL"
})
capabilities = Selenium::WebDriver::Remote::Capabilities.send(QA::Runtime::Env.browser)
if QA::Runtime::Env.accept_insecure_certs?
capabilities['acceptInsecureCerts'] = true
end
# 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, false)::Options.new
if QA::Runtime::Env.browser == :chrome
options.add_argument("window-size=1480,2200")
# set logging preferences
# this enables access to logs with `page.driver.manage.get_log(:browser)`
capabilities['goog:loggingPrefs'] = {
browser: 'ALL',
client: 'ALL',
driver: 'ALL',
server: 'ALL'
}
# size window
capabilities['goog:chromeOptions'] = {
args: %w[window-size=1480,2200]
}
# Chrome won't work properly in a Docker container in sandbox mode
options.add_argument("no-sandbox")
capabilities['goog:chromeOptions'][:args] << 'no-sandbox'
# Run headless by default unless WEBDRIVER_HEADLESS is false
if QA::Runtime::Env.webdriver_headless?
options.add_argument("headless")
capabilities['goog:chromeOptions'][:args] << '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")
capabilities['goog:chromeOptions'][:args] << 'disable-gpu'
end
# Disable /dev/shm use in CI. See https://gitlab.com/gitlab-org/gitlab/issues/4252
options.add_argument("disable-dev-shm-usage") if QA::Runtime::Env.running_in_ci?
capabilities['goog:chromeOptions'][:args] << 'disable-dev-shm-usage' if QA::Runtime::Env.running_in_ci?
# Specify the user-agent to allow challenges to be bypassed
# See https://gitlab.com/gitlab-com/gl-infra/infrastructure/-/issues/11938
options.add_argument("user-agent=#{QA::Runtime::Env.user_agent}") if QA::Runtime::Env.user_agent
capabilities['goog:chromeOptions'][:args] << "user-agent=#{QA::Runtime::Env.user_agent}" if QA::Runtime::Env.user_agent
end
# Use the same profile on QA runs if CHROME_REUSE_PROFILE is true.
# Useful to speed up local QA.
if QA::Runtime::Env.reuse_chrome_profile?
qa_profile_dir = ::File.expand_path('../../tmp/qa-profile', __dir__)
options.add_argument("user-data-dir=#{qa_profile_dir}")
capabilities['goog:chromeOptions'][:args] << "user-data-dir=#{qa_profile_dir}"
end
selenium_options = {
browser: QA::Runtime::Env.browser,
clear_local_storage: true,
desired_capabilities: capabilities,
options: options
capabilities: capabilities
}
selenium_options[:url] = QA::Runtime::Env.remote_grid if QA::Runtime::Env.remote_grid
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment