diff options
Diffstat (limited to 'qa/lib/gitlab/page/main')
-rw-r--r-- | qa/lib/gitlab/page/main/login.rb | 18 | ||||
-rw-r--r-- | qa/lib/gitlab/page/main/login.stub.rb | 82 | ||||
-rw-r--r-- | qa/lib/gitlab/page/main/sign_up.rb | 36 | ||||
-rw-r--r-- | qa/lib/gitlab/page/main/sign_up.stub.rb | 203 |
4 files changed, 338 insertions, 1 deletions
diff --git a/qa/lib/gitlab/page/main/login.rb b/qa/lib/gitlab/page/main/login.rb index 9f20a040550..de05df1a086 100644 --- a/qa/lib/gitlab/page/main/login.rb +++ b/qa/lib/gitlab/page/main/login.rb @@ -10,11 +10,27 @@ module Gitlab text_field :password_field button :sign_in_button - def sign_in_as(username:, password:) + button :accept_terms, text: 'Accept terms' + + # password change tab + text_field :password_confirmation_field + button :change_password_button + + # Sign in using a given username and password + # @note this will also automatically accept terms if prompted + # @param [String] username the username to sign in with + # @param [String] password the password to sign in with + # @example + # Page::Main::Login.perform do |login| + # login.sign_in_as(username: 'username', password: 'password') + # login.sign_in_as(username: 'username', password: 'password', accept_terms: false) + # end + def sign_in_as(username:, password:, accept_terms: true) self.login_field = username self.password_field = password sign_in_button + self.accept_terms if accept_terms && accept_terms? end end end diff --git a/qa/lib/gitlab/page/main/login.stub.rb b/qa/lib/gitlab/page/main/login.stub.rb index a4cef291616..a819ca4bcc8 100644 --- a/qa/lib/gitlab/page/main/login.stub.rb +++ b/qa/lib/gitlab/page/main/login.stub.rb @@ -95,6 +95,88 @@ module Gitlab def sign_in_button? # This is a stub, used for indexing. The method is dynamically generated. end + + # @note Defined as +button :accept_terms+ + # Clicks +accept_terms+ + def accept_terms + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @example + # Gitlab::Page::Main::Login.perform do |login| + # expect(login.accept_terms_element).to exist + # end + # @return [Watir::Button] The raw +Button+ element + def accept_terms_element + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @example + # Gitlab::Page::Main::Login.perform do |login| + # expect(login).to be_accept_terms + # end + # @return [Boolean] true if the +accept_terms+ element is present on the page + def accept_terms? + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @note Defined as +text_field :password_confirmation_field+ + # @return [String] The text content or value of +password_confirmation_field+ + def password_confirmation_field + # This is a stub, used for indexing. The method is dynamically generated. + end + + # Set the value of password_confirmation_field + # @example + # Gitlab::Page::Main::Login.perform do |login| + # login.password_confirmation_field = 'value' + # end + # @param value [String] The value to set. + def password_confirmation_field=(value) + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @example + # Gitlab::Page::Main::Login.perform do |login| + # expect(login.password_confirmation_field_element).to exist + # end + # @return [Watir::TextField] The raw +TextField+ element + def password_confirmation_field_element + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @example + # Gitlab::Page::Main::Login.perform do |login| + # expect(login).to be_password_confirmation_field + # end + # @return [Boolean] true if the +password_confirmation_field+ element is present on the page + def password_confirmation_field? + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @note Defined as +button :change_password_button+ + # Clicks +change_password_button+ + def change_password_button + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @example + # Gitlab::Page::Main::Login.perform do |login| + # expect(login.change_password_button_element).to exist + # end + # @return [Watir::Button] The raw +Button+ element + def change_password_button_element + # This is a stub, used for indexing. The method is dynamically generated. + end + + # @example + # Gitlab::Page::Main::Login.perform do |login| + # expect(login).to be_change_password_button + # end + # @return [Boolean] true if the +change_password_button+ element is present on the page + def change_password_button? + # This is a stub, used for indexing. The method is dynamically generated. + end end end end diff --git a/qa/lib/gitlab/page/main/sign_up.rb b/qa/lib/gitlab/page/main/sign_up.rb new file mode 100644 index 00000000000..85d7f482461 --- /dev/null +++ b/qa/lib/gitlab/page/main/sign_up.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +module Gitlab + module Page + module Main + class SignUp < Chemlab::Page + path '/users/sign_up' + + # TODO: Refactor data-qa-selectors to be more terse + text_field :first_name, 'data-qa-selector': 'new_user_first_name_field' + text_field :last_name, 'data-qa-selector': 'new_user_last_name_field' + + text_field :username, 'data-qa-selector': 'new_user_username_field' + + text_field :email, 'data-qa-selector': 'new_user_email_field' + text_field :password, 'data-qa-selector': 'new_user_password_field' + + button :register, 'data-qa-selector': '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 new file mode 100644 index 00000000000..881bd922c45 --- /dev/null +++ b/qa/lib/gitlab/page/main/sign_up.stub.rb @@ -0,0 +1,203 @@ +# 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 |