diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-12 00:14:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-12 00:14:42 +0300 |
commit | 830c9943a95cbd755700d6624c64a158b2602cd0 (patch) | |
tree | 6b0c3710d66ba89732fbb672687233ef785e5133 /qa | |
parent | b330f7f0bfb2035b03e84e5fa751816b6ad9b841 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r-- | qa/lib/gitlab/page/main/welcome.rb | 13 | ||||
-rw-r--r-- | qa/lib/gitlab/page/main/welcome.stub.rb | 33 | ||||
-rw-r--r-- | qa/qa/flow/sign_up.rb | 5 | ||||
-rw-r--r-- | qa/qa/flow/user_onboarding.rb | 19 | ||||
-rw-r--r-- | qa/qa/page/dashboard/welcome.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/registration/sign_up.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/registration/welcome.rb | 23 | ||||
-rw-r--r-- | qa/qa/runtime/env.rb | 14 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb | 11 | ||||
-rw-r--r-- | qa/spec/runtime/env_spec.rb | 40 |
10 files changed, 104 insertions, 62 deletions
diff --git a/qa/lib/gitlab/page/main/welcome.rb b/qa/lib/gitlab/page/main/welcome.rb deleted file mode 100644 index a2df1da61c9..00000000000 --- a/qa/lib/gitlab/page/main/welcome.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Page - module Main - class Welcome < Chemlab::Page - path '/users/sign_up/welcome' - - button :get_started_button - end - end - end -end diff --git a/qa/lib/gitlab/page/main/welcome.stub.rb b/qa/lib/gitlab/page/main/welcome.stub.rb deleted file mode 100644 index a10e697bcbf..00000000000 --- a/qa/lib/gitlab/page/main/welcome.stub.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Page - module Main - module Welcome - # @note Defined as +button :get_started_button+ - # Clicks +get_started_button+ - def get_started_button - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::Welcome.perform do |welcome| - # expect(welcome.get_started_button_element).to exist - # end - # @return [Watir::Button] The raw +Button+ element - def get_started_button_element - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::Welcome.perform do |welcome| - # expect(welcome).to be_get_started_button - # end - # @return [Boolean] true if the +get_started_button+ element is present on the page - def get_started_button? - # This is a stub, used for indexing. The method is dynamically generated. - end - end - end - end -end diff --git a/qa/qa/flow/sign_up.rb b/qa/qa/flow/sign_up.rb index a2a62371092..ec7886ef969 100644 --- a/qa/qa/flow/sign_up.rb +++ b/qa/qa/flow/sign_up.rb @@ -26,9 +26,12 @@ module QA sign_up.click_new_user_register_button end - Page::Registration::Welcome.perform(&:click_get_started_button_if_available) + Flow::UserOnboarding.onboard_user success = if user.expect_fabrication_success + # In development env and .com the user is asked to create a group and a project which can be skipped for + # the purpose of signing up + Runtime::Browser.visit(:gitlab, Page::Dashboard::Welcome) Page::Main::Menu.perform(&:has_personal_area?) else Page::Main::Menu.perform(&:not_signed_in?) diff --git a/qa/qa/flow/user_onboarding.rb b/qa/qa/flow/user_onboarding.rb new file mode 100644 index 00000000000..066e1878869 --- /dev/null +++ b/qa/qa/flow/user_onboarding.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module QA + module Flow + module UserOnboarding + module_function + + def onboard_user + Page::Registration::Welcome.perform do |welcome_page| + if welcome_page.has_get_started_button? + welcome_page.select_role('Other') + welcome_page.choose_setup_for_company_if_available + welcome_page.click_get_started_button + end + end + end + end + end +end diff --git a/qa/qa/page/dashboard/welcome.rb b/qa/qa/page/dashboard/welcome.rb index b54205780d9..6f645e168c7 100644 --- a/qa/qa/page/dashboard/welcome.rb +++ b/qa/qa/page/dashboard/welcome.rb @@ -11,6 +11,10 @@ module QA def has_welcome_title?(text) has_element?(:welcome_title_content, text: text) end + + def self.path + '/' + end end end end diff --git a/qa/qa/page/registration/sign_up.rb b/qa/qa/page/registration/sign_up.rb index 6d1b9cb3615..4fedc05c702 100644 --- a/qa/qa/page/registration/sign_up.rb +++ b/qa/qa/page/registration/sign_up.rb @@ -16,10 +16,6 @@ module QA element :new_user_username_field end - view 'app/views/registrations/welcome/show.html.haml' do - element :get_started_button - end - def fill_new_user_first_name_field(first_name) fill_element :new_user_first_name_field, first_name end diff --git a/qa/qa/page/registration/welcome.rb b/qa/qa/page/registration/welcome.rb index ff22e62b63e..660b33b4f5b 100644 --- a/qa/qa/page/registration/welcome.rb +++ b/qa/qa/page/registration/welcome.rb @@ -6,14 +6,25 @@ module QA class Welcome < Page::Base view 'app/views/registrations/welcome/show.html.haml' do element :get_started_button + element :role_dropdown end - def click_get_started_button_if_available - if has_element?(:get_started_button) - Support::Retrier.retry_until do - click_element :get_started_button - has_no_element?(:get_started_button) - end + def has_get_started_button? + has_element?(:get_started_button) + end + + def select_role(role) + select_element(:role_dropdown, role) + end + + def choose_setup_for_company_if_available + # Only implemented in EE + end + + def click_get_started_button + Support::Retrier.retry_until do + click_element :get_started_button + has_no_element?(:get_started_button) end end end diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 188ce375b88..17fb3996875 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -90,6 +90,20 @@ module QA enabled?(ENV['ACCEPT_INSECURE_CERTS']) end + def running_on_dot_com? + uri = URI.parse(Runtime::Scenario.gitlab_address) + uri.host.include?('.com') + end + + def running_on_dev? + uri = URI.parse(Runtime::Scenario.gitlab_address) + uri.port != 80 && uri.port != 443 + end + + def running_on_dev_or_dot_com? + running_on_dev? || running_on_dot_com? + end + def running_in_ci? ENV['CI'] || ENV['CI_SERVER'] end diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb index 3e14b05b801..4a95e7484da 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb @@ -13,7 +13,7 @@ module QA end end - RSpec.describe 'Manage', :skip_signup_disabled, :requires_admin do + RSpec.describe 'Manage', :skip_signup_disabled, :requires_admin, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/349626', type: :stale } do describe 'while LDAP is enabled', :orchestrated, :ldap_no_tls, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347934' do before do # When LDAP is enabled, a previous test might have created a token for the LDAP 'tanuki' user who is not an admin @@ -118,11 +118,12 @@ module QA Flow::Login.sign_in(as: @user, skip_page_validation: true) - Page::Registration::Welcome.perform(&:click_get_started_button_if_available) + Flow::UserOnboarding.onboard_user - Page::Main::Menu.perform do |menu| - expect(menu).to have_personal_area - end + # In development env and .com the user is asked to create a group and a project which can be skipped for + # the purpose of this test + Runtime::Browser.visit(:gitlab, Page::Dashboard::Welcome) + Page::Main::Menu.perform(&:has_personal_area?) end after do diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb index 89879add7e1..22603497019 100644 --- a/qa/spec/runtime/env_spec.rb +++ b/qa/spec/runtime/env_spec.rb @@ -83,6 +83,46 @@ RSpec.describe QA::Runtime::Env do end end + describe '.running_on_dot_com?' do + using RSpec::Parameterized::TableSyntax + + where(:url, :result) do + 'https://www.gitlab.com' | true + 'https://staging.gitlab.com' | true + 'http://www.gitlab.com' | true + 'http://localhost:3000' | false + 'http://localhost' | false + 'http://gdk.test:3000' | false + end + + with_them do + before do + QA::Runtime::Scenario.define(:gitlab_address, url) + end + + it { expect(described_class.running_on_dot_com?).to eq result } + end + end + + describe '.running_on_dev?' do + using RSpec::Parameterized::TableSyntax + + where(:url, :result) do + 'https://www.gitlab.com' | false + 'http://localhost:3000' | true + 'http://localhost' | false + 'http://gdk.test:3000' | true + end + + with_them do + before do + QA::Runtime::Scenario.define(:gitlab_address, url) + end + + it { expect(described_class.running_on_dev?).to eq result } + end + end + describe '.personal_access_token' do around do |example| described_class.instance_variable_set(:@personal_access_token, nil) |