Commit 017b5a34 authored by Andrejs Cunskis's avatar Andrejs Cunskis

Automatically manage webdrivers via webdrivers gem

Add webdrivers gem dependecy
Replace manual chromedriver installation with automated via rake task
Require chromedriver and geckodriver only for now
parent 7946d895
......@@ -6,9 +6,6 @@ ENV DOCKER_VERSION="17.09.0-ce"
# https://s3.amazonaws.com/gitlab-google-chrome-stable
ENV CHROME_VERSION="91.0.4472.77-1"
# https://chromedriver.chromium.org/downloads
ENV CHROME_DRIVER_VERSION="91.0.4472.101"
ENV CHROME_DEB="google-chrome-stable_${CHROME_VERSION}_amd64.deb"
ENV CHROME_URL="https://s3.amazonaws.com/gitlab-google-chrome-stable/${CHROME_DEB}"
......@@ -34,13 +31,6 @@ RUN curl --silent --show-error --fail -O "${CHROME_URL}" && \
apt-get install -f -y && \
rm -f "./${CHROME_DEB}"
##
# Install chromedriver to make it work with Selenium
#
RUN wget -q "https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip"
RUN unzip chromedriver_linux64.zip -d /usr/local/bin
RUN rm -f chromedriver_linux64.zip
##
# Install client certificate - Bug in Chrome Headless: https://gitlab.com/gitlab-org/gitlab/-/issues/331492
#
......@@ -71,6 +61,7 @@ RUN export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \
apt-get update -y && apt-get install google-cloud-sdk kubectl -y
WORKDIR /home/gitlab/qa
COPY ./qa/Gemfile* /home/gitlab/qa/
COPY ./config/initializers/0_inject_enterprise_edition_module.rb /home/gitlab/config/initializers/
# Copy VERSION to ensure the COPY succeeds to copy at least one file since ee/app/models/license.rb isn't present in FOSS
......@@ -79,7 +70,13 @@ COPY VERSION ./ee/app/models/license.r[b] /home/gitlab/ee/app/models/
COPY ./lib/gitlab.rb /home/gitlab/lib/
COPY ./lib/gitlab/utils.rb /home/gitlab/lib/gitlab/
COPY ./INSTALLATION_TYPE ./VERSION /home/gitlab/
RUN cd /home/gitlab/qa/ && bundle install --jobs=$(nproc) --retry=3 --without=development --quiet
RUN bundle install --jobs=$(nproc) --retry=3 --without=development --quiet
COPY ./qa /home/gitlab/qa
# Fetch chromedriver version based on version of chrome
# https://github.com/titusfortner/webdrivers
RUN bundle exec rake webdrivers:chromedriver:update
ENTRYPOINT ["bin/test"]
......@@ -23,6 +23,7 @@ gem 'timecop', '~> 0.9.1'
gem 'parallel', '~> 1.19'
gem 'rspec-parameterized', '~> 0.4.2'
gem 'github_api', '~> 0.18.2'
gem "webdrivers", "~> 4.6"
gem 'chemlab', '~> 0.7'
gem 'chemlab-library-www-gitlab-com', '~> 0.1'
......
......@@ -192,6 +192,10 @@ GEM
watir (6.19.1)
regexp_parser (>= 1.2, < 3)
selenium-webdriver (>= 3.142.7)
webdrivers (4.6.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.2)
......@@ -225,6 +229,7 @@ DEPENDENCIES
ruby-debug-ide (~> 0.7.0)
selenium-webdriver (~> 4.0.0.beta4)
timecop (~> 0.9.1)
webdrivers (~> 4.6)
BUNDLED WITH
2.2.22
# frozen_string_literal: true
# rubocop:disable Rails/RakeEnvironment
require 'webdrivers'
load 'webdrivers/Rakefile'
require_relative 'qa/tools/revoke_all_personal_access_tokens'
require_relative 'qa/tools/delete_subgroups'
......@@ -34,7 +38,9 @@ task :run_artillery_load_tests do
urls_file = ENV['URLS_FILE_PATH'] || 'urls.yml'
unless File.exist?(urls_file)
raise "\n#{urls_file} file is missing. Please provide correct URLS_FILE_PATH or all of HOST_URL, LARGE_ISSUE_URL and LARGE_MR_URL\n\n"
raise(<<~ERR)
#{urls_file} file is missing. Please provide correct URLS_FILE_PATH or all of HOST_URL, LARGE_ISSUE_URL and LARGE_MR_URL\n
ERR
end
urls = YAML.safe_load(File.read(urls_file))
......@@ -59,3 +65,4 @@ desc "Deletes projects directly under the provided group"
task :delete_projects do
QA::Tools::DeleteProjects.new.run
end
# rubocop:enable Rails/RakeEnvironment
......@@ -5,6 +5,8 @@ require 'rspec/expectations'
require 'capybara/rspec'
require 'capybara-screenshot/rspec'
require 'selenium-webdriver'
require 'webdrivers/chromedriver'
require 'webdrivers/geckodriver'
require 'gitlab_handbook'
......
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