diff options
author | Walmyr <walmyr@gitlab.com> | 2019-06-14 08:07:29 +0300 |
---|---|---|
committer | Mark Lapierre <mlapierre@gitlab.com> | 2019-06-14 08:07:29 +0300 |
commit | 8769eef34069efc3ffcf138da164221458c329b3 (patch) | |
tree | 33b4df8c9c30b8b60ca96a0d710f7e6666304ed5 /qa | |
parent | f35d3a241caab4c4b926d1ad6fee64ad1bdf8625 (diff) |
Backport of EE changes from MR 13763
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/13763
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/page/base.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/project/issue/show.rb | 46 | ||||
-rw-r--r-- | qa/qa/resource/issue.rb | 17 | ||||
-rw-r--r-- | qa/qa/resource/label.rb | 21 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb | 6 | ||||
-rw-r--r-- | qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb | 2 | ||||
-rw-r--r-- | qa/qa/support/page/logging.rb | 2 | ||||
-rw-r--r-- | qa/spec/page/logging_spec.rb | 4 |
11 files changed, 91 insertions, 17 deletions
diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index d247a273637..d0fe2987b0a 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -197,6 +197,10 @@ module QA views.map(&:elements).flatten end + def send_keys_to_element(name, keys) + find_element(name).send_keys(keys) + end + class DSL attr_reader :views diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb index 77bad7481d8..b59540d0377 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -8,11 +8,6 @@ module QA include Page::Component::Issuable::Common include Page::Component::Note - view 'app/views/shared/notes/_form.html.haml' do - element :new_note_form, 'new-note' # rubocop:disable QA/ElementWithPattern - element :new_note_form, 'attr: :note' # rubocop:disable QA/ElementWithPattern - end - view 'app/assets/javascripts/notes/components/comment_form.vue' do element :comment_button element :comment_input @@ -27,6 +22,21 @@ module QA element :noteable_note_item end + view 'app/helpers/dropdowns_helper.rb' do + element :dropdown_input_field + end + + view 'app/views/shared/notes/_form.html.haml' do + element :new_note_form, 'new-note' # rubocop:disable QA/ElementWithPattern + element :new_note_form, 'attr: :note' # rubocop:disable QA/ElementWithPattern + end + + view 'app/views/shared/issuable/_sidebar.html.haml' do + element :labels_block + element :edit_link_labels + element :dropdown_menu_labels + end + # Adds a comment to an issue # attachment option should be an absolute path def comment(text, attachment: nil, filter: :all_activities) @@ -47,6 +57,10 @@ module QA end end + def select_all_activities_filter + select_filter_with_text('Show all activity') + end + def select_comments_only_filter select_filter_with_text('Show comments only') end @@ -55,8 +69,26 @@ module QA select_filter_with_text('Show history only') end - def select_all_activities_filter - select_filter_with_text('Show all activity') + def select_labels_and_refresh(labels) + click_element(:edit_link_labels) + + labels.each do |label| + within_element(:dropdown_menu_labels, text: label) do + send_keys_to_element(:dropdown_input_field, [label, :enter]) + end + end + + click_body + + labels.each do |label| + has_element?(:labels_block, text: label) + end + + refresh + end + + def text_of_labels_block + find_element(:labels_block) end private diff --git a/qa/qa/resource/issue.rb b/qa/qa/resource/issue.rb index 2c2f27fe231..9c57a0f5afb 100644 --- a/qa/qa/resource/issue.rb +++ b/qa/qa/resource/issue.rb @@ -12,6 +12,8 @@ module QA end end + attribute :id + attribute :labels attribute :title def fabricate! @@ -25,6 +27,21 @@ module QA page.create_new_issue end end + + def api_get_path + "/projects/#{project.id}/issues/#{id}" + end + + def api_post_path + "/projects/#{project.id}/issues" + end + + def api_post_body + { + labels: [labels], + title: title + } + end end end end diff --git a/qa/qa/resource/label.rb b/qa/qa/resource/label.rb index 7c899db31f3..5a681a5fe9f 100644 --- a/qa/qa/resource/label.rb +++ b/qa/qa/resource/label.rb @@ -34,6 +34,27 @@ module QA page.click_label_create_button end end + + def resource_web_url(resource) + super + rescue ResourceURLMissingError + # this particular resource does not expose a web_url property + end + + def api_get_path + raise NotImplementedError, "The Labels API doesn't expose a single-resource endpoint so this method cannot be properly implemented." + end + + def api_post_path + "/projects/#{project}/labels" + end + + def api_post_body + { + color: @color, + name: @title + } + end end end end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb index fa779bd1f4e..4478ea41662 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb @@ -9,7 +9,7 @@ module QA Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - Resource::Issue.fabricate! do |issue| + Resource::Issue.fabricate_via_browser_ui! do |issue| issue.title = issue_title end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb index 00094161f61..1eea3efec7f 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb @@ -42,7 +42,7 @@ module QA Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } - Resource::Issue.fabricate! do |issue| + Resource::Issue.fabricate_via_browser_ui! do |issue| issue.title = issue_title end end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb index b2164bb5fab..ad2773b41ac 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb @@ -9,7 +9,7 @@ module QA Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } - Resource::Issue.fabricate! do |issue| + Resource::Issue.fabricate_via_browser_ui! do |issue| issue.title = issue_title end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb index 0ff71baed90..cd1c7545944 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb @@ -23,7 +23,7 @@ module QA expect(page).to have_content(merge_request_title) expect(page).to have_content(merge_request_description) - expect(page).to have_content(/Opened [\w\s]+ ago/) + expect(page).to have_content('Opened just now') end it 'user creates a new merge request with a milestone and label' do @@ -41,7 +41,7 @@ module QA milestone.project = current_project end - new_label = Resource::Label.fabricate! do |label| + new_label = Resource::Label.fabricate_via_browser_ui! do |label| label.project = current_project label.title = 'qa-mr-test-label' label.description = 'Merge Request label' @@ -62,7 +62,7 @@ module QA Page::MergeRequest::Show.perform do |merge_request| expect(merge_request).to have_content(merge_request_title) expect(merge_request).to have_content(merge_request_description) - expect(merge_request).to have_content(/Opened [\w\s]+ ago/) + expect(merge_request).to have_content('Opened just now') expect(merge_request).to have_assignee(gitlab_account_username) expect(merge_request).to have_label(new_label.title) end diff --git a/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb b/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb index fc4ff364fd4..a04efb94def 100644 --- a/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb +++ b/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb @@ -19,7 +19,7 @@ module QA it 'shows results for the original request and AJAX requests' do # Issue pages always make AJAX requests - Resource::Issue.fabricate! do |issue| + Resource::Issue.fabricate_via_browser_ui! do |issue| issue.title = 'Performance bar test' end diff --git a/qa/qa/support/page/logging.rb b/qa/qa/support/page/logging.rb index 02ebd96ad49..93d8fa99c0a 100644 --- a/qa/qa/support/page/logging.rb +++ b/qa/qa/support/page/logging.rb @@ -125,7 +125,7 @@ module QA super end - def within_element(name) + def within_element(name, text: nil) log("within element :#{name}") element = super diff --git a/qa/spec/page/logging_spec.rb b/qa/spec/page/logging_spec.rb index 092c6a17c9c..0f1ed039149 100644 --- a/qa/spec/page/logging_spec.rb +++ b/qa/spec/page/logging_spec.rb @@ -135,9 +135,9 @@ describe QA::Support::Page::Logging do end it 'logs within_element' do - expect { subject.within_element(:element) } + expect { subject.within_element(:element, text: nil) } .to output(/within element :element/).to_stdout_from_any_process - expect { subject.within_element(:element) } + expect { subject.within_element(:element, text: nil) } .to output(/end within element :element/).to_stdout_from_any_process end |