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
diff options
context:
space:
mode:
Diffstat (limited to 'qa/lib/slack/page/chat.rb')
-rw-r--r--qa/lib/slack/page/chat.rb68
1 files changed, 68 insertions, 0 deletions
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