Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-18 18:10:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-18 18:10:46 +0300
commit346c2ebb5a818524c5d8d95dc6b9fc8c892e3b5c (patch)
tree63bf068a9d8cedf0b7f9e80cf99e491813617db1 /qa
parent5f287a8e306da1e0b6152a0b7f8621a8e71a3fe4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/Gemfile3
-rw-r--r--qa/Gemfile.lock11
-rw-r--r--qa/qa.rb8
-rw-r--r--qa/qa/page/alert/free_trial.rb12
-rw-r--r--qa/qa/page/group/menu.rb10
-rw-r--r--qa/qa/page/group/settings/billing.rb13
-rw-r--r--qa/qa/page/merge_request/show.rb8
-rw-r--r--qa/qa/page/trials/new.rb23
-rw-r--r--qa/qa/page/trials/select.rb18
-rw-r--r--qa/qa/runtime/browser.rb10
-rw-r--r--qa/qa/scenario/template.rb9
-rw-r--r--qa/spec/scenario/template_spec.rb25
-rw-r--r--qa/spec/support/shared_examples/scenario_shared_examples.rb1
13 files changed, 139 insertions, 12 deletions
diff --git a/qa/Gemfile b/qa/Gemfile
index 21ca945a500..8b3a9802000 100644
--- a/qa/Gemfile
+++ b/qa/Gemfile
@@ -23,6 +23,9 @@ gem 'parallel', '~> 1.19'
gem 'rspec-parameterized', '~> 0.4.2'
gem 'github_api', '~> 0.18.2'
+gem 'chemlab', '~> 0.5'
+gem 'chemlab-library-www-gitlab-com', '~> 0.1'
+
group :development do
gem 'pry-byebug', '~> 3.5.1', platform: :mri
gem "ruby-debug-ide", "~> 0.7.0"
diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock
index 4eeaca1f1a6..9bac86bad08 100644
--- a/qa/Gemfile.lock
+++ b/qa/Gemfile.lock
@@ -33,6 +33,12 @@ GEM
capybara-screenshot (1.0.23)
capybara (>= 1.0, < 4)
launchy
+ chemlab (0.5.0)
+ rake (~> 12.3.0)
+ selenium-webdriver (~> 3.12)
+ watir (~> 6.17)
+ chemlab-library-www-gitlab-com (0.1.1)
+ chemlab (~> 0.4)
childprocess (3.0.0)
coderay (1.1.2)
concord (0.1.5)
@@ -163,6 +169,9 @@ GEM
equalizer (~> 0.0.9)
parser (>= 2.6.5)
procto (~> 0.0.2)
+ watir (6.18.0)
+ regexp_parser (>= 1.2, < 3)
+ selenium-webdriver (>= 3.8)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.2)
@@ -175,6 +184,8 @@ DEPENDENCIES
airborne (~> 0.3.4)
capybara (~> 3.29.0)
capybara-screenshot (~> 1.0.23)
+ chemlab (~> 0.5)
+ chemlab-library-www-gitlab-com (~> 0.1)
faker (~> 1.6, >= 1.6.6)
github_api (~> 0.18.2)
gitlab-qa
diff --git a/qa/qa.rb b/qa/qa.rb
index dc730e555dd..fafa428be41 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -8,6 +8,8 @@ require_relative '../lib/gitlab'
require_relative '../lib/gitlab/utils'
require_relative '../config/initializers/0_inject_enterprise_edition_module'
+require 'chemlab'
+
module QA
##
# Helper classes to represent frequently used sequences of actions
@@ -428,6 +430,7 @@ module QA
module Alert
autoload :AutoDevopsAlert, 'qa/page/alert/auto_devops_alert'
+ autoload :FreeTrial, 'qa/page/alert/free_trial'
end
module Layout
@@ -539,6 +542,11 @@ module QA
end
end
+ module Trials
+ autoload :New, 'qa/page/trials/new'
+ autoload :Select, 'qa/page/trials/select'
+ end
+
module Modal
autoload :DeleteWiki, 'qa/page/modal/delete_wiki'
end
diff --git a/qa/qa/page/alert/free_trial.rb b/qa/qa/page/alert/free_trial.rb
new file mode 100644
index 00000000000..4a48d4ca277
--- /dev/null
+++ b/qa/qa/page/alert/free_trial.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Alert
+ class FreeTrial < Chemlab::Page
+ # TODO: Supplant with data-qa-selectors
+ h4 :trial_activated_message, class: 'gl-banner-title'
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/group/menu.rb b/qa/qa/page/group/menu.rb
index fced598a5c6..66e8b5d5863 100644
--- a/qa/qa/page/group/menu.rb
+++ b/qa/qa/page/group/menu.rb
@@ -11,7 +11,7 @@ module QA
element :group_issues_item
element :group_members_item
element :group_milestones_link
- element :group_settings_item
+ element :group_settings
end
view 'app/views/groups/sidebar/_packages_settings.html.haml' do
@@ -31,7 +31,7 @@ module QA
def click_settings
within_sidebar do
- click_element(:group_settings_item)
+ click_element(:group_settings)
end
end
@@ -44,7 +44,7 @@ module QA
end
def click_group_general_settings_item
- hover_element(:group_settings_item) do
+ hover_element(:group_settings) do
within_submenu(:group_sidebar_submenu) do
click_element(:general_settings_link)
end
@@ -60,8 +60,8 @@ module QA
end
def go_to_package_settings
- scroll_to_element(:group_settings_item)
- hover_element(:group_settings_item) do
+ scroll_to_element(:group_settings)
+ hover_element(:group_settings) do
within_submenu(:group_sidebar_submenu) do
click_element(:group_package_settings_link)
end
diff --git a/qa/qa/page/group/settings/billing.rb b/qa/qa/page/group/settings/billing.rb
new file mode 100644
index 00000000000..a83af47fc35
--- /dev/null
+++ b/qa/qa/page/group/settings/billing.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Group
+ module Settings
+ class Billing < Chemlab::Page
+ link :start_your_free_trial
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb
index 3da001786c5..5f52d48e9f6 100644
--- a/qa/qa/page/merge_request/show.rb
+++ b/qa/qa/page/merge_request/show.rb
@@ -115,6 +115,10 @@ module QA
element :diffs_tab
end
+ view 'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_enabled.vue' do
+ element :cancel_auto_merge_button
+ end
+
def start_review
click_element(:start_review_button)
@@ -348,6 +352,10 @@ module QA
click_element(:revert_button, Page::Component::CommitModal)
click_element(:submit_commit_button)
end
+
+ def cancel_auto_merge!
+ click_element(:cancel_auto_merge_button)
+ end
end
end
end
diff --git a/qa/qa/page/trials/new.rb b/qa/qa/page/trials/new.rb
new file mode 100644
index 00000000000..268f3b71717
--- /dev/null
+++ b/qa/qa/page/trials/new.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Trials
+ class New < Chemlab::Page
+ path '/-/trials/new'
+
+ # TODO: Supplant with data-qa-selectors
+ text_field :first_name, id: 'first_name'
+ text_field :last_name, id: 'last_name'
+ text_field :company_name, id: 'company_name'
+ select :number_of_employees, id: 'company_size'
+ text_field :telephone_number, id: 'phone_number'
+ text_field :number_of_users, id: 'number_of_users'
+
+ select :country, id: 'country_select'
+
+ button :continue, value: 'Continue'
+ end
+ end
+ end
+end
diff --git a/qa/qa/page/trials/select.rb b/qa/qa/page/trials/select.rb
new file mode 100644
index 00000000000..3da0fb46322
--- /dev/null
+++ b/qa/qa/page/trials/select.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Trials
+ class Select < Chemlab::Page
+ path '/-/trials/select'
+
+ # TODO: Supplant with data-qa-selectors
+ select :subscription_for, id: 'namespace_id'
+ text_field :new_group_name, id: 'new_group_name'
+ button :start_your_free_trial, value: 'Start your free trial'
+ radio :trial_company, id: 'trial_entity_company'
+ radio :trial_individual, id: 'trial_entity_individual'
+ end
+ end
+ end
+end
diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb
index 6694d9c9469..3fe8552c063 100644
--- a/qa/qa/runtime/browser.rb
+++ b/qa/qa/runtime/browser.rb
@@ -6,6 +6,8 @@ require 'capybara/rspec'
require 'capybara-screenshot/rspec'
require 'selenium-webdriver'
+require 'gitlab_handbook'
+
module QA
module Runtime
class Browser
@@ -151,6 +153,12 @@ module QA
# fail because of unexpected line breaks and other white space
config.default_normalize_ws = true
end
+
+ Chemlab.configure do |config|
+ config.browser = Capybara.current_session.driver.browser # reuse Capybara session
+ config.libraries = [GitlabHandbook]
+ config.base_url = Runtime::Scenario.attributes[:gitlab_address] # reuse GitLab address
+ end
end
# rubocop: enable Metrics/AbcSize
@@ -173,7 +181,7 @@ module QA
simulate_slow_connection if Runtime::Env.simulate_slow_connection?
- page_class.validate_elements_present!
+ page_class.validate_elements_present! if page_class.respond_to?(:validate_elements_present!)
if QA::Runtime::Env.qa_cookies
browser = Capybara.current_session.driver.browser
diff --git a/qa/qa/scenario/template.rb b/qa/qa/scenario/template.rb
index 0d517dffee8..d0a201e3d22 100644
--- a/qa/qa/scenario/template.rb
+++ b/qa/qa/scenario/template.rb
@@ -23,6 +23,15 @@ module QA
def perform(options, *args)
extract_address(:gitlab_address, options, args)
+ gitlab_address = URI(Runtime::Scenario.gitlab_address)
+
+ # Define the "About" page as an `about` subdomain.
+ # @example
+ # Given *gitlab_address* = 'https://gitlab.com/' #=> https://about.gitlab.com/
+ # Given *gitlab_address* = 'https://staging.gitlab.com/' #=> https://about.staging.gitlab.com/
+ # Given *gitlab_address* = 'http://gitlab-abc123.test/' #=> http://about.gitlab-abc123.test/
+ Runtime::Scenario.define(:about_address, URI(-> { gitlab_address.host = "about.#{gitlab_address.host}"; gitlab_address }.call).to_s) # rubocop:disable Style/Semicolon
+
##
# Perform before hooks, which are different for CE and EE
#
diff --git a/qa/spec/scenario/template_spec.rb b/qa/spec/scenario/template_spec.rb
index f07d817ea16..9800f92b306 100644
--- a/qa/spec/scenario/template_spec.rb
+++ b/qa/spec/scenario/template_spec.rb
@@ -3,6 +3,7 @@
RSpec.describe QA::Scenario::Template do
let(:feature) { spy('Runtime::Feature') }
let(:release) { spy('Runtime::Release') }
+ let(:gitlab_address) { 'https://gitlab.com/' }
before do
stub_const('QA::Runtime::Release', release)
@@ -12,7 +13,7 @@ RSpec.describe QA::Scenario::Template do
end
it 'allows a feature to be enabled' do
- subject.perform({ enable_feature: 'a-feature' })
+ subject.perform({ gitlab_address: gitlab_address, enable_feature: 'a-feature' })
expect(feature).to have_received(:enable).with('a-feature')
end
@@ -21,7 +22,7 @@ RSpec.describe QA::Scenario::Template do
allow(QA::Runtime::Feature).to receive(:enabled?)
.with('another-feature').and_return(true)
- subject.perform({ disable_feature: 'another-feature' })
+ subject.perform({ gitlab_address: gitlab_address, disable_feature: 'another-feature' })
expect(feature).to have_received(:disable).with('another-feature')
end
@@ -30,7 +31,7 @@ RSpec.describe QA::Scenario::Template do
allow(QA::Runtime::Feature).to receive(:enabled?)
.with('another-feature').and_return(false)
- subject.perform({ disable_feature: 'another-feature' })
+ subject.perform({ gitlab_address: gitlab_address, disable_feature: 'another-feature' })
expect(feature).not_to have_received(:disable).with('another-feature')
end
@@ -38,7 +39,7 @@ RSpec.describe QA::Scenario::Template do
it 'ensures an enabled feature is disabled afterwards' do
allow(QA::Specs::Runner).to receive(:perform).and_raise('failed test')
- expect { subject.perform({ enable_feature: 'a-feature' }) }.to raise_error('failed test')
+ expect { subject.perform({ gitlab_address: gitlab_address, enable_feature: 'a-feature' }) }.to raise_error('failed test')
expect(feature).to have_received(:enable).with('a-feature')
expect(feature).to have_received(:disable).with('a-feature')
@@ -50,7 +51,7 @@ RSpec.describe QA::Scenario::Template do
allow(QA::Runtime::Feature).to receive(:enabled?)
.with('another-feature').and_return(true)
- expect { subject.perform({ disable_feature: 'another-feature' }) }.to raise_error('failed test')
+ expect { subject.perform({ gitlab_address: gitlab_address, disable_feature: 'another-feature' }) }.to raise_error('failed test')
expect(feature).to have_received(:disable).with('another-feature')
expect(feature).to have_received(:enable).with('another-feature')
@@ -62,9 +63,21 @@ RSpec.describe QA::Scenario::Template do
allow(QA::Runtime::Feature).to receive(:enabled?)
.with('another-feature').and_return(false)
- expect { subject.perform({ disable_feature: 'another-feature' }) }.to raise_error('failed test')
+ expect { subject.perform({ gitlab_address: gitlab_address, disable_feature: 'another-feature' }) }.to raise_error('failed test')
expect(feature).not_to have_received(:disable).with('another-feature')
expect(feature).not_to have_received(:enable).with('another-feature')
end
+
+ it 'defines an about address by default' do
+ subject.perform( { gitlab_address: gitlab_address })
+
+ expect(QA::Runtime::Scenario.gitlab_address).to eq(gitlab_address)
+ expect(QA::Runtime::Scenario.about_address).to eq('https://about.gitlab.com/')
+
+ subject.perform({ gitlab_address: 'http://gitlab-abc.test/' })
+
+ expect(QA::Runtime::Scenario.gitlab_address).to eq('http://gitlab-abc.test/')
+ expect(QA::Runtime::Scenario.about_address).to eq('http://about.gitlab-abc.test/')
+ end
end
diff --git a/qa/spec/support/shared_examples/scenario_shared_examples.rb b/qa/spec/support/shared_examples/scenario_shared_examples.rb
index 637cfb9a05d..5e448349cf9 100644
--- a/qa/spec/support/shared_examples/scenario_shared_examples.rb
+++ b/qa/spec/support/shared_examples/scenario_shared_examples.rb
@@ -18,6 +18,7 @@ module QA
stub_const('QA::Runtime::Scenario', attributes)
stub_const('QA::Runtime::Feature', feature)
+ allow(attributes).to receive(:gitlab_address).and_return(args[:gitlab_address])
allow(runner).to receive(:perform).and_yield(runner)
allow(QA::Runtime::Address).to receive(:valid?).and_return(true)
end