summaryrefslogtreecommitdiff
path: root/qa/qa/page/component
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-03 12:06:00 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-03 12:06:00 +0000
commit927cfbfe63dd3dc64df9d341d7c4328a2fe3597f (patch)
treecaa1dc128491ed9dbfdcd40737db429f4b066707 /qa/qa/page/component
parent2b67531b0fd7c94cb1d8618166c4193f40ea5a1f (diff)
downloadgitlab-ce-927cfbfe63dd3dc64df9d341d7c4328a2fe3597f.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa/qa/page/component')
-rw-r--r--qa/qa/page/component/ci_badge_link.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/qa/qa/page/component/ci_badge_link.rb b/qa/qa/page/component/ci_badge_link.rb
new file mode 100644
index 00000000000..aad8dc1d3df
--- /dev/null
+++ b/qa/qa/page/component/ci_badge_link.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+module QA
+ module Page
+ module Component
+ module CiBadgeLink
+ COMPLETED_STATUSES = %w[passed failed canceled blocked skipped manual].freeze # excludes created, pending, running
+ PASSED_STATUS = 'passed'.freeze
+
+ def self.included(base)
+ base.view 'app/assets/javascripts/vue_shared/components/ci_badge_link.vue' do
+ element :status_badge
+ end
+ end
+
+ def status_badge
+ find_element(:status_badge).text
+ end
+
+ def successful?(timeout: 60)
+ raise "Timed out waiting for the status to be a valid completed state" unless completed?(timeout: timeout)
+
+ status_badge == PASSED_STATUS
+ end
+
+ private
+
+ def completed?(timeout: 60)
+ wait(reload: false, max: timeout) do
+ COMPLETED_STATUSES.include?(status_badge)
+ end
+ end
+ end
+ end
+ end
+end