diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2019-02-19 17:18:46 +0000 |
---|---|---|
committer | Dylan Griffith <dyl.griffith@gmail.com> | 2019-02-19 18:02:28 +0000 |
commit | 2aea7878f4fc11a589bbc135efa397d6b2075738 (patch) | |
tree | 1887660ba742d4ca8bef0434976e2f99b2e4db6c /qa/qa | |
parent | 459276846372d8309220a5667cb4389dcfc66281 (diff) | |
download | gitlab-ce-2aea7878f4fc11a589bbc135efa397d6b2075738.tar.gz |
Refactor/simplify Auto DevOps QA spec
Diffstat (limited to 'qa/qa')
3 files changed, 19 insertions, 40 deletions
diff --git a/qa/qa/page/project/job/show.rb b/qa/qa/page/project/job/show.rb index d9e789d7793..9c218f4ed8b 100644 --- a/qa/qa/page/project/job/show.rb +++ b/qa/qa/page/project/job/show.rb @@ -4,10 +4,6 @@ module QA::Page COMPLETED_STATUSES = %w[passed failed canceled blocked skipped manual].freeze # excludes created, pending, running PASSED_STATUS = 'passed'.freeze - view 'app/assets/javascripts/jobs/components/job_app.vue' do - element :loading_animation - end - view 'app/assets/javascripts/jobs/components/job_log.vue' do element :build_trace end @@ -20,26 +16,13 @@ module QA::Page element :pipeline_path end - def loaded?(wait: 60) - has_element?(:build_trace, wait: wait) - end - - # Reminder: You should check #loaded? first - def completed?(timeout: 60) - wait(reload: false, max: timeout) do - COMPLETED_STATUSES.include?(status_badge) - end - end + def successful?(timeout: 60) + raise "Timed out waiting for the build trace to load" unless loaded? + raise "Timed out waiting for the status to be a valid completed state" unless completed?(timeout: timeout) - # Reminder: You should check #completed? and #loaded? first - def successful? status_badge == PASSED_STATUS end - def trace_loading? - has_element?(:loading_animation) - end - # Reminder: You may wish to wait for a particular job status before checking output def output find_element(:build_trace).text @@ -47,6 +30,16 @@ module QA::Page private + def loaded?(wait: 60) + has_element?(:build_trace, wait: wait) + end + + def completed?(timeout: 60) + wait(reload: false, max: timeout) do + COMPLETED_STATUSES.include?(status_badge) + end + end + def status_badge find_element(:status_badge).text end diff --git a/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb b/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb index 2f885b330d3..3f65eabc756 100644 --- a/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb @@ -95,8 +95,6 @@ module QA Page::Project::Pipeline::Show.perform(&:go_to_first_job) Page::Project::Job::Show.perform do |job| - expect(job).to be_loaded - expect(job).to be_completed expect(job).to be_successful expect(job.output).to include(sha1sum) end diff --git a/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb b/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb index bb333561f28..8b165a04382 100644 --- a/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb +++ b/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb @@ -73,9 +73,7 @@ module QA pipeline.go_to_job('build') end Page::Project::Job::Show.perform do |job| - expect(job).to be_loaded - expect(job).to be_completed(timeout: 600) - expect(job).to be_successful + expect(job).to be_successful(timeout: 600) job.click_element(:pipeline_path) end @@ -84,9 +82,7 @@ module QA pipeline.go_to_job('test') end Page::Project::Job::Show.perform do |job| - expect(job).to be_loaded - expect(job).to be_completed(timeout: 600) - expect(job).to be_successful + expect(job).to be_successful(timeout: 600) job.click_element(:pipeline_path) end @@ -95,9 +91,7 @@ module QA pipeline.go_to_job('production') end Page::Project::Job::Show.perform do |job| - expect(job).to be_loaded - expect(job).to be_completed(timeout: 1200) - expect(job).to be_successful + expect(job).to be_successful(timeout: 1200) job.click_element(:pipeline_path) end @@ -140,9 +134,7 @@ module QA pipeline.go_to_job('build') end Page::Project::Job::Show.perform do |job| - expect(job).to be_loaded - expect(job).to be_completed(timeout: 600) - expect(job).to be_successful + expect(job).to be_successful(timeout: 600) job.click_element(:pipeline_path) end @@ -151,9 +143,7 @@ module QA pipeline.go_to_job('test') end Page::Project::Job::Show.perform do |job| - expect(job).to be_loaded - expect(job).to be_completed(timeout: 600) - expect(job).to be_successful + expect(job).to be_successful(timeout: 600) job.click_element(:pipeline_path) end @@ -162,9 +152,7 @@ module QA pipeline.go_to_job('production') end Page::Project::Job::Show.perform do |job| - expect(job).to be_loaded - expect(job).to be_completed(timeout: 1200) - expect(job).to be_successful + expect(job).to be_successful(timeout: 1200) job.click_element(:pipeline_path) end |