summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2018-05-08 11:56:35 -0700
committerMichael Kozono <mkozono@gmail.com>2018-05-08 11:56:43 -0700
commit39bddd386c65d1c594ed231bff75c0b79fd6cd3f (patch)
tree582683e330b57241f33fdad86c5bc88dca0fecf4 /qa
parent09747ecd3317fc2e1be54f4c944b718f5edf4ae9 (diff)
downloadgitlab-ce-39bddd386c65d1c594ed231bff75c0b79fd6cd3f.tar.gz
Succeed or fail fast based on job status first
Also, move wait block into the correct page block.
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/page/project/job/show.rb22
-rw-r--r--qa/qa/specs/features/project/deploy_key_clone_spec.rb12
2 files changed, 20 insertions, 14 deletions
diff --git a/qa/qa/page/project/job/show.rb b/qa/qa/page/project/job/show.rb
index 21bda74efb2..83bb224b5c3 100644
--- a/qa/qa/page/project/job/show.rb
+++ b/qa/qa/page/project/job/show.rb
@@ -1,18 +1,28 @@
module QA::Page
module Project::Job
class Show < QA::Page::Base
+ COMPLETED_STATUSES = %w[passed failed canceled blocked skipped manual].freeze # excludes created, pending, running
+ PASSED_STATUS = 'passed'.freeze
+
view 'app/views/projects/jobs/show.html.haml' do
element :build_output, '.js-build-output'
end
- def output
- css = '.js-build-output'
+ view 'app/assets/javascripts/vue_shared/components/ci_badge_link.vue' do
+ element :status_badge, 'ci-status'
+ end
- wait(reload: false) do
- has_css?(css)
- end
+ def completed?
+ COMPLETED_STATUSES.include? find('.ci-status').text
+ end
- find(css).text
+ def passed?
+ find('.ci-status').text == PASSED_STATUS
+ end
+
+ # Reminder: You may wish to wait for a particular job status before checking output
+ def output
+ find('.js-build-output').text
end
end
end
diff --git a/qa/qa/specs/features/project/deploy_key_clone_spec.rb b/qa/qa/specs/features/project/deploy_key_clone_spec.rb
index 98ea86bf75e..bf8fa230244 100644
--- a/qa/qa/specs/features/project/deploy_key_clone_spec.rb
+++ b/qa/qa/specs/features/project/deploy_key_clone_spec.rb
@@ -87,16 +87,12 @@ module QA
Page::Project::Show.act { wait_for_push }
Page::Menu::Side.act { click_ci_cd_pipelines }
Page::Project::Pipeline::Index.act { go_to_latest_pipeline }
-
- Page::Project::Pipeline::Show.act do
- go_to_first_job
-
- wait do
- !has_content?('running')
- end
- end
+ Page::Project::Pipeline::Show.act { go_to_first_job }
Page::Project::Job::Show.perform do |job|
+ job.wait(reload: false) { job.completed? }
+
+ expect(job.passed?).to be_truthy, "Job status did not become \"passed\"."
expect(job.output).to include(sha1sum)
end
end