diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-03 12:06:00 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-03 12:06:00 +0000 |
commit | 927cfbfe63dd3dc64df9d341d7c4328a2fe3597f (patch) | |
tree | caa1dc128491ed9dbfdcd40737db429f4b066707 /qa | |
parent | 2b67531b0fd7c94cb1d8618166c4193f40ea5a1f (diff) | |
download | gitlab-ce-927cfbfe63dd3dc64df9d341d7c4328a2fe3597f.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa.rb | 1 | ||||
-rw-r--r-- | qa/qa/page/base.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/component/ci_badge_link.rb | 36 | ||||
-rw-r--r-- | qa/qa/page/merge_request/show.rb | 21 | ||||
-rw-r--r-- | qa/qa/page/project/job/show.rb | 17 | ||||
-rw-r--r-- | qa/qa/page/project/pipeline/show.rb | 16 | ||||
-rw-r--r-- | qa/qa/resource/project.rb | 9 | ||||
-rw-r--r-- | qa/qa/resource/runner.rb | 17 | ||||
-rw-r--r-- | qa/qa/resource/sandbox.rb | 1 |
9 files changed, 92 insertions, 28 deletions
@@ -357,6 +357,7 @@ module QA # Classes describing components that are used by several pages. # module Component + autoload :CiBadgeLink, 'qa/page/component/ci_badge_link' autoload :ClonePanel, 'qa/page/component/clone_panel' autoload :LazyLoader, 'qa/page/component/lazy_loader' autoload :LegacyClonePanel, 'qa/page/component/legacy_clone_panel' diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index a6ae0767cb4..71df90f2f42 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -95,7 +95,7 @@ module QA # replace with (..., page = self.class) def click_element(name, page = nil, text: nil) - find_element(name, text: nil).click + find_element(name, text: text).click page.validate_elements_present! if page end 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 diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 6b4a8bacf24..14b8c420b16 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -14,6 +14,7 @@ module QA view 'app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue' do element :merge_request_pipeline_info_content + element :pipeline_link end view 'app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue' do @@ -59,6 +60,18 @@ module QA element :edit_button end + def click_discussions_tab + click_element :notes_tab + end + + def click_diffs_tab + click_element :diffs_tab + end + + def click_pipeline_link + click_element :pipeline_link + end + def fast_forward_possible? has_no_text?('Fast-forward merge is not possible') end @@ -156,14 +169,6 @@ module QA click_element :squash_checkbox end - def click_discussions_tab - click_element :notes_tab - end - - def click_diffs_tab - click_element :diffs_tab - end - def add_comment_to_diff(text) wait(interval: 5) do has_text?("No newline at end of file") diff --git a/qa/qa/page/project/job/show.rb b/qa/qa/page/project/job/show.rb index 751bdb32506..cf847710024 100644 --- a/qa/qa/page/project/job/show.rb +++ b/qa/qa/page/project/job/show.rb @@ -3,17 +3,12 @@ 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 + include Component::CiBadgeLink view 'app/assets/javascripts/jobs/components/job_log.vue' do element :build_trace end - view 'app/assets/javascripts/vue_shared/components/ci_badge_link.vue' do - element :status_badge - end - view 'app/assets/javascripts/jobs/components/stages_dropdown.vue' do element :pipeline_path end @@ -45,16 +40,6 @@ module QA::Page has_element?(:build_trace, wait: 1) end 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 end end end diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index 3dca47a57e9..ce81bace01e 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -3,6 +3,8 @@ module QA::Page module Project::Pipeline class Show < QA::Page::Base + include Component::CiBadgeLink + view 'app/assets/javascripts/vue_shared/components/header_ci_component.vue' do element :pipeline_header, /header class.*ci-header-container.*/ # rubocop:disable QA/ElementWithPattern end @@ -38,6 +40,14 @@ module QA::Page end end + def has_job?(job_name) + has_element?(:job_link, text: job_name) + end + + def has_no_job?(job_name) + has_no_element?(:job_link, text: job_name) + end + def has_tag?(tag_name) within_element(:pipeline_badges) do has_selector?('.badge', text: tag_name) @@ -45,7 +55,11 @@ module QA::Page end def click_job(job_name) - find_element(:job_link, text: job_name).click + click_element(:job_link, text: job_name) + end + + def click_linked_job(project_name) + click_element(:linked_pipeline_button, text: /#{project_name}/) end def click_on_first_job diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb index a0389390c83..caaa766e982 100644 --- a/qa/qa/resource/project.rb +++ b/qa/qa/resource/project.rb @@ -88,6 +88,10 @@ module QA "#{api_get_path}/members" end + def api_runners_path + "#{api_get_path}/runners" + end + def api_post_path '/projects' end @@ -108,6 +112,11 @@ module QA post_body end + def runners + response = get Runtime::API::Request.new(api_client, api_runners_path).url + parse_body(response) + end + def share_with_group(invitee, access_level = Resource::Members::AccessLevel::DEVELOPER) post Runtime::API::Request.new(api_client, "/projects/#{id}/share").url, { group_id: invitee.id, group_access: access_level } end diff --git a/qa/qa/resource/runner.rb b/qa/qa/resource/runner.rb index 9c2e138bade..3f0eed7458a 100644 --- a/qa/qa/resource/runner.rb +++ b/qa/qa/resource/runner.rb @@ -6,8 +6,9 @@ module QA module Resource class Runner < Base attr_writer :name, :tags, :image - attr_accessor :config + attr_accessor :config, :token + attribute :id attribute :project do Project.fabricate_via_api! do |resource| resource.name = 'project-with-ci-cd' @@ -30,7 +31,7 @@ module QA def fabricate_via_api! Service::Runner.new(name).tap do |runner| runner.pull - runner.token = project.runners_token + runner.token = @token ||= project.runners_token runner.address = Runtime::Scenario.gitlab_address runner.tags = tags runner.image = image @@ -40,6 +41,18 @@ module QA end end + def remove_via_api! + @id = project.runners.find { |runner| runner[:description] == name }[:id] + + super + + Service::Runner.new(name).remove! + end + + def api_delete_path + "/runners/#{id}" + end + def api_get_path end diff --git a/qa/qa/resource/sandbox.rb b/qa/qa/resource/sandbox.rb index 47bd86440a0..6ee3dcf350f 100644 --- a/qa/qa/resource/sandbox.rb +++ b/qa/qa/resource/sandbox.rb @@ -10,6 +10,7 @@ module QA attr_accessor :path attribute :id + attribute :runners_token def initialize @path = Runtime::Namespace.sandbox_name |