diff --git a/.rubocop_todo/style/redundant_self.yml b/.rubocop_todo/style/redundant_self.yml index 660eb584506aa9d747caa45839f637d33fd03949..93d0b0298bf47d107a2a612af1c1a6808ca159bc 100644 --- a/.rubocop_todo/style/redundant_self.yml +++ b/.rubocop_todo/style/redundant_self.yml @@ -361,7 +361,6 @@ Style/RedundantSelf: - 'lib/system_check/base_check.rb' - 'lib/system_check/rake_task/rake_task_helpers.rb' - 'lib/uploaded_file.rb' - - 'qa/lib/gitlab/page/main/sign_up.rb' - 'qa/qa/page/validatable.rb' - 'qa/qa/resource/base.rb' - 'qa/qa/resource/events/project.rb' diff --git a/qa/lib/gitlab/page/main/sign_up.rb b/qa/lib/gitlab/page/main/sign_up.rb deleted file mode 100644 index d4ae335babd33b96627298c4f2799fa33863e134..0000000000000000000000000000000000000000 --- a/qa/lib/gitlab/page/main/sign_up.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Page - module Main - class SignUp < Chemlab::Page - path '/users/sign_up' - - text_field :first_name, 'data-testid': 'new-user-first-name-field' - text_field :last_name, 'data-testid': 'new-user-last-name-field' - - text_field :username, 'data-testid': 'new-user-username-field' - - text_field :email, 'data-testid': 'new-user-email-field' - text_field :password, 'data-testid': 'new-user-password-field' - - button :register, 'data-testid': 'new-user-register-button' - - # Register a user - # @param [Resource::User] user the user to register - def register_user(user) - raise ArgumentError, 'User must be of type Resource::User' unless user.is_a? ::QA::Resource::User - - self.first_name = user.first_name - self.last_name = user.last_name - self.username = user.username - self.email = user.email - self.password = user.password - - self.register - end - end - end - end -end diff --git a/qa/lib/gitlab/page/main/sign_up.stub.rb b/qa/lib/gitlab/page/main/sign_up.stub.rb deleted file mode 100644 index 881bd922c45ae6fd2d636231992a626b1517413d..0000000000000000000000000000000000000000 --- a/qa/lib/gitlab/page/main/sign_up.stub.rb +++ /dev/null @@ -1,203 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Page - module Main - module SignUp - # @note Defined as +text_field :first_name+ - # @return [String] The text content or value of +first_name+ - def first_name - # This is a stub, used for indexing. The method is dynamically generated. - end - - # Set the value of first_name - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # sign_up.first_name = 'value' - # end - # @param value [String] The value to set. - def first_name=(value) - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # expect(sign_up.first_name_element).to exist - # end - # @return [Watir::TextField] The raw +TextField+ element - def first_name_element - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # expect(sign_up).to be_first_name - # end - # @return [Boolean] true if the +first_name+ element is present on the page - def first_name? - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @note Defined as +text_field :last_name+ - # @return [String] The text content or value of +last_name+ - def last_name - # This is a stub, used for indexing. The method is dynamically generated. - end - - # Set the value of last_name - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # sign_up.last_name = 'value' - # end - # @param value [String] The value to set. - def last_name=(value) - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # expect(sign_up.last_name_element).to exist - # end - # @return [Watir::TextField] The raw +TextField+ element - def last_name_element - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # expect(sign_up).to be_last_name - # end - # @return [Boolean] true if the +last_name+ element is present on the page - def last_name? - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @note Defined as +text_field :username+ - # @return [String] The text content or value of +username+ - def username - # This is a stub, used for indexing. The method is dynamically generated. - end - - # Set the value of username - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # sign_up.username = 'value' - # end - # @param value [String] The value to set. - def username=(value) - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # expect(sign_up.username_element).to exist - # end - # @return [Watir::TextField] The raw +TextField+ element - def username_element - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # expect(sign_up).to be_username - # end - # @return [Boolean] true if the +username+ element is present on the page - def username? - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @note Defined as +text_field :email+ - # @return [String] The text content or value of +email+ - def email - # This is a stub, used for indexing. The method is dynamically generated. - end - - # Set the value of email - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # sign_up.email = 'value' - # end - # @param value [String] The value to set. - def email=(value) - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # expect(sign_up.email_element).to exist - # end - # @return [Watir::TextField] The raw +TextField+ element - def email_element - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # expect(sign_up).to be_email - # end - # @return [Boolean] true if the +email+ element is present on the page - def email? - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @note Defined as +text_field :password+ - # @return [String] The text content or value of +password+ - def password - # This is a stub, used for indexing. The method is dynamically generated. - end - - # Set the value of password - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # sign_up.password = 'value' - # end - # @param value [String] The value to set. - def password=(value) - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # expect(sign_up.password_element).to exist - # end - # @return [Watir::TextField] The raw +TextField+ element - def password_element - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # expect(sign_up).to be_password - # end - # @return [Boolean] true if the +password+ element is present on the page - def password? - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @note Defined as +button :register+ - # Clicks +register+ - def register - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # expect(sign_up.register_element).to exist - # end - # @return [Watir::Button] The raw +Button+ element - def register_element - # This is a stub, used for indexing. The method is dynamically generated. - end - - # @example - # Gitlab::Page::Main::SignUp.perform do |sign_up| - # expect(sign_up).to be_register - # end - # @return [Boolean] true if the +register+ element is present on the page - def register? - # 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 abaab064a736b89a2523159435366aebc8200ee0..5f8b22cc37789f1d9032b3c214f270c72a92cf37 100644 --- a/qa/qa/flow/sign_up.rb +++ b/qa/qa/flow/sign_up.rb @@ -13,17 +13,7 @@ def sign_up!(user) Page::Main::Menu.perform(&:sign_out_if_signed_in) Page::Main::Login.perform(&:switch_to_register_page) Page::Registration::SignUp.perform do |sign_up| - sign_up.fill_new_user_first_name_field(user.first_name) - sign_up.fill_new_user_last_name_field(user.last_name) - sign_up.fill_new_user_username_field(user.username) - sign_up.fill_new_user_email_field(user.email) - sign_up.fill_new_user_password_field(user.password) - - Support::Waiter.wait_until(sleep_interval: 0.5) do - page.has_content?("Username is available.") - end - - sign_up.click_new_user_register_button + sign_up.register_user(user) end Flow::UserOnboarding.onboard_user diff --git a/qa/qa/page/registration/sign_up.rb b/qa/qa/page/registration/sign_up.rb index 8e303c3d42524f4a438bd9aafabdc133315591df..7d501bafe3b16ff63aecd18ac08c4ff600b6eac9 100644 --- a/qa/qa/page/registration/sign_up.rb +++ b/qa/qa/page/registration/sign_up.rb @@ -16,27 +16,25 @@ class SignUp < Page::Base element 'new-user-username-field' end - def fill_new_user_first_name_field(first_name) - fill_element 'new-user-first-name-field', first_name + def self.path + '/users/sign_up' end - def fill_new_user_last_name_field(last_name) - fill_element 'new-user-last-name-field', last_name - end + # Register a user + # @param [Resource::User] user the user to register + def register_user(user) + raise ArgumentError, 'User must be of type Resource::User' unless user.is_a? Resource::User - def fill_new_user_username_field(username) - fill_element 'new-user-username-field', username - end + fill_element 'new-user-first-name-field', user.first_name + fill_element 'new-user-last-name-field', user.last_name + fill_element 'new-user-username-field', user.username + fill_element 'new-user-email-field', user.email + fill_element 'new-user-password-field', user.password - def fill_new_user_email_field(email) - fill_element 'new-user-email-field', email - end - - def fill_new_user_password_field(password) - fill_element 'new-user-password-field', password - end + Support::Waiter.wait_until(sleep_interval: 0.5) do + page.has_content?("Username is available.") + end - def click_new_user_register_button click_element 'new-user-register-button' if has_element?('new-user-register-button') end end diff --git a/qa/qa/specs/features/ee/browser_ui/11_fulfillment/purchase/user_registration_billing_spec.rb b/qa/qa/specs/features/ee/browser_ui/11_fulfillment/purchase/user_registration_billing_spec.rb index f05403f02ceadd93961c067d9dfed40bd3062ef7..d27588544bce886db1faa3f8bf83972c22fdb836 100644 --- a/qa/qa/specs/features/ee/browser_ui/11_fulfillment/purchase/user_registration_billing_spec.rb +++ b/qa/qa/specs/features/ee/browser_ui/11_fulfillment/purchase/user_registration_billing_spec.rb @@ -20,9 +20,10 @@ module QA Runtime::ApplicationSettings.set_application_settings(signup_enabled: true) Runtime::ApplicationSettings.set_application_settings(require_admin_approval_after_user_signup: true) + Runtime::Browser.visit(:gitlab, Page::Registration::SignUp) + # Register the new user through the registration page - Gitlab::Page::Main::SignUp.perform do |sign_up| - sign_up.visit + Page::Registration::SignUp.perform do |sign_up| sign_up.register_user(user) end