diff options
Diffstat (limited to 'qa/lib')
-rw-r--r-- | qa/lib/gitlab/page/group/settings/usage_quotas.rb | 11 | ||||
-rw-r--r-- | qa/lib/gitlab/page/trials/new.rb | 20 | ||||
-rw-r--r-- | qa/lib/gitlab/page/trials/select.rb | 24 | ||||
-rw-r--r-- | qa/lib/slack.rb | 9 | ||||
-rw-r--r-- | qa/lib/slack/mixins/browser.rb | 11 | ||||
-rw-r--r-- | qa/lib/slack/mixins/gitlab_app.rb | 52 | ||||
-rw-r--r-- | qa/lib/slack/page/chat.rb | 68 | ||||
-rw-r--r-- | qa/lib/slack/page/login.rb | 40 | ||||
-rw-r--r-- | qa/lib/slack/page/oauth.rb | 9 |
9 files changed, 236 insertions, 8 deletions
diff --git a/qa/lib/gitlab/page/group/settings/usage_quotas.rb b/qa/lib/gitlab/page/group/settings/usage_quotas.rb index 62f55aea2cc..3cb501efe13 100644 --- a/qa/lib/gitlab/page/group/settings/usage_quotas.rb +++ b/qa/lib/gitlab/page/group/settings/usage_quotas.rb @@ -32,8 +32,7 @@ module Gitlab div :project div :storage_type_legend span :container_registry_size - div :purchased_usage_total_free # Different UI for free namespace - span :purchased_usage_total + div :purchased_usage_total div :storage_purchase_successful_alert, text: /You have successfully purchased a storage/ div :additional_storage_alert, text: /purchase additional storage/ @@ -66,14 +65,10 @@ module Gitlab # Returns total purchased storage value once it's ready on page # # @return [Float] Total purchased storage value in GiB - def total_purchased_storage(free_name_space = true) + def total_purchased_storage additional_storage_alert_element.wait_until(&:present?) - if free_name_space - purchased_usage_total_free.split('/').last.match(/\d+\.\d+/)[0].to_f - else - purchased_usage_total.to_f - end + purchased_usage_total[/(\d+){2}.\d+/].to_f end def additional_ci_minutes_added? diff --git a/qa/lib/gitlab/page/trials/new.rb b/qa/lib/gitlab/page/trials/new.rb new file mode 100644 index 00000000000..b2e6cbdb682 --- /dev/null +++ b/qa/lib/gitlab/page/trials/new.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module Gitlab + module Page + module Trials + class New < Chemlab::Page + path '/-/trials/new' + + text_field :first_name + text_field :last_name + text_field :company_name + select :number_of_employees + text_field :telephone_number + select :country + select :state + button :continue + end + end + end +end diff --git a/qa/lib/gitlab/page/trials/select.rb b/qa/lib/gitlab/page/trials/select.rb new file mode 100644 index 00000000000..6eaf6003837 --- /dev/null +++ b/qa/lib/gitlab/page/trials/select.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Gitlab + module Page + module Trials + class Select < Chemlab::Page + path '/-/trials/select' + + button :select_group, 'data-testid': 'base-dropdown-toggle' + div :group_dropdown, 'data-testid': 'base-dropdown-menu' + text_field :new_group_name + button :start_your_free_trial + radio :trial_company + radio :trial_individual + + def subscription_for=(group_name) + select_group + + group_dropdown_element.span(text: /#{group_name}/).click + end + end + end + end +end diff --git a/qa/lib/slack.rb b/qa/lib/slack.rb new file mode 100644 index 00000000000..95e81b700f5 --- /dev/null +++ b/qa/lib/slack.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +require 'chemlab/library' + +module Slack + include Chemlab::Library + + self.base_url = 'https://slack.com' +end diff --git a/qa/lib/slack/mixins/browser.rb b/qa/lib/slack/mixins/browser.rb new file mode 100644 index 00000000000..853ff2c7130 --- /dev/null +++ b/qa/lib/slack/mixins/browser.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Slack + module Mixins + module Browser + def browser + ::Chemlab.configuration.browser.session.engine + end + end + end +end diff --git a/qa/lib/slack/mixins/gitlab_app.rb b/qa/lib/slack/mixins/gitlab_app.rb new file mode 100644 index 00000000000..66b456ef824 --- /dev/null +++ b/qa/lib/slack/mixins/gitlab_app.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +module Slack + module Mixins + module GitlabApp + # @param [QA::Resource::Project] project + # @param [String] channel + # @param [String] title + # @param [String] description + def create_issue(project, channel:, title:, description:) + lines = [ + "/staging-gitlab #{project.path_with_namespace} issue new #{title}", + description + ] + + send_message_to_channel(lines, channel: channel) + end + + # @param [QA::Resource::Project] project + # @param [QA::Resource::Project] target + # @param [String] id + # @param [String] channel + def move_issue(project, target, id:, channel:) + line = "/staging-gitlab #{project.path_with_namespace} issue move #{id} to #{target.path_with_namespace}" + send_message_to_channel([line], channel: channel) + end + + # @param [QA::Resource::Project] project + # @param [String] id + # @param [String] channel + def show_issue(project, id:, channel:) + send_message_to_channel(["/staging-gitlab #{project.path_with_namespace} issue show #{id}"], channel: channel) + end + + # @param [QA::Resource::Project] project + # @param [String] id + # @param [String] channel + def close_issue(project, id:, channel:) + send_message_to_channel(["/staging-gitlab #{project.path_with_namespace} issue close #{id}"], channel: channel) + end + + # @param [QA::Resource::Project] project + # @param [String] channel + # @param [String] id + # @param [String] comment + def comment_on_issue(project, channel:, id:, comment:) + command = "/staging-gitlab #{project.path_with_namespace} issue comment #{id}" + send_message_to_channel([command, comment], channel: channel) + end + end + end +end diff --git a/qa/lib/slack/page/chat.rb b/qa/lib/slack/page/chat.rb new file mode 100644 index 00000000000..5f8553fc425 --- /dev/null +++ b/qa/lib/slack/page/chat.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +module Slack + module Page + class Chat < Chemlab::Page + include Mixins::Browser + include Mixins::GitlabApp + + div :message_field, data_qa: 'message_input' + button :connect_gitlab_button, visible_text: /Connect your GitLab account/ + button :skip_download_slack_button, data_qa: 'continue_in_browser' + + def skip_download_screen + wait_for_text('download the Slack app') + + skip_download_slack_button_element.click if skip_download_slack_button_element.exists? + end + + # @param [Array<String>] lines - messages to send + # @param [String] channel to send message to + def send_message_to_channel(lines, channel:) + go_to_channel(channel) + + message_field_element.focus + message_field_element.click + + while line = lines.shift + browser.send_keys(line) + wait_for_text(line) + + browser.send_keys([:shift, :enter]) unless lines.empty? + end + + browser.send_keys(:enter) + end + + def wait_for_text(line) + QA::Support::Waiter.wait_until(max_duration: 3, raise_on_failure: false) do + browser.text.include?(line) + end + end + + def go_to_channel(channel) + menu_item = messages.find do |div| + div.text == channel + end + menu_item.click + end + + def click_connect_account_link + divs = messages(visible_text: /connect your GitLab account/i) + el = divs.last.a(href: /staging-ref/) + el.scroll.to(:top) + el.click + end + + def messages(**opts) + browser.divs(data_qa: 'virtual-list-item', **opts) + end + + def gitlab_app_home + browser.divs(data_qa: 'channel_item_container').find do |el| + el.text == 'GitLab' + end + end + end + end +end diff --git a/qa/lib/slack/page/login.rb b/qa/lib/slack/page/login.rb new file mode 100644 index 00000000000..a11b0d27fd0 --- /dev/null +++ b/qa/lib/slack/page/login.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module Slack + module Page + class Login < Chemlab::Page + path '/workspace-signin' + + text_field :workspace_field, data_qa: 'signin_domain_input' + button :continue_button, data_qa: 'submit_team_domain_button' + + link :sign_in_with_password_link, data_qa: 'sign_in_password_link' + + text_field :email_address_field, data_qa: 'login_email' + text_field :password_field, data_qa: 'login_password', type: 'password' + button :sign_in_button, data_qa: 'signin_button' + + def sign_in + navigate_to_workspace + + # sign into with password if needed + sign_in_with_password_link_element.click if sign_in_with_password_link_element.exists? + + finish_sign_in + end + + def navigate_to_workspace + self.workspace_field = ::QA::Runtime::Env.slack_workspace + continue_button + end + + def finish_sign_in + return unless email_address_field_element.exists? + + self.email_address_field = ::QA::Runtime::Env.slack_email + self.password_field = ::QA::Runtime::Env.slack_password + sign_in_button + end + end + end +end diff --git a/qa/lib/slack/page/oauth.rb b/qa/lib/slack/page/oauth.rb new file mode 100644 index 00000000000..700d19f0c4c --- /dev/null +++ b/qa/lib/slack/page/oauth.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +module Slack + module Page + class Oauth < Chemlab::Page + button :submit_oauth, data_qa: 'oauth_submit_button' + end + end +end |