summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalmyr Lima <walmyr@gitlab.com>2019-05-31 13:26:30 +0200
committerWalmyr Lima <walmyr@gitlab.com>2019-06-13 14:45:41 +0200
commit385a514ea58df6dba0c24328a6e1ca72f7b8ddfc (patch)
tree4681518c8af5457ca722a1b30b39b64884a41dd0
parent0a70ba177e4589733659dd5af85402d0a3081026 (diff)
downloadgitlab-ce-385a514ea58df6dba0c24328a6e1ca72f7b8ddfc.tar.gz
Backport of EE changes from MR 13763
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/13763
-rw-r--r--app/helpers/dropdowns_helper.rb2
-rw-r--r--app/views/shared/issuable/_sidebar.html.haml4
-rw-r--r--qa/qa/page/base.rb4
-rw-r--r--qa/qa/page/project/issue/show.rb28
-rw-r--r--qa/qa/resource/issue.rb16
-rw-r--r--qa/qa/resource/label.rb21
6 files changed, 72 insertions, 3 deletions
diff --git a/app/helpers/dropdowns_helper.rb b/app/helpers/dropdowns_helper.rb
index 8d8c62f1291..64c5fae7d96 100644
--- a/app/helpers/dropdowns_helper.rb
+++ b/app/helpers/dropdowns_helper.rb
@@ -91,7 +91,7 @@ module DropdownsHelper
def dropdown_filter(placeholder, search_id: nil)
content_tag :div, class: "dropdown-input" do
- filter_output = search_field_tag search_id, nil, class: "dropdown-input-field", placeholder: placeholder, autocomplete: 'off'
+ filter_output = search_field_tag search_id, nil, class: "dropdown-input-field qa-dropdown-input-field", placeholder: placeholder, autocomplete: 'off'
filter_output << icon('search', class: "dropdown-input-search")
filter_output << icon('times', class: "dropdown-input-clear js-dropdown-input-clear", role: "button")
diff --git a/app/views/shared/issuable/_sidebar.html.haml b/app/views/shared/issuable/_sidebar.html.haml
index 3a5adb34ad1..e87e560266f 100644
--- a/app/views/shared/issuable/_sidebar.html.haml
+++ b/app/views/shared/issuable/_sidebar.html.haml
@@ -102,7 +102,7 @@
= _('Labels')
= icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
- if can_edit_issuable
- = link_to _('Edit'), '#', class: 'js-sidebar-dropdown-toggle edit-link float-right'
+ = link_to _('Edit'), '#', class: 'js-sidebar-dropdown-toggle edit-link qa-edit-link-labels float-right'
.value.issuable-show-labels.dont-hide.hide-collapsed.qa-labels-block{ class: ("has-labels" if selected_labels.any?) }
- if selected_labels.any?
- selected_labels.each do |label_hash|
@@ -118,7 +118,7 @@
%span.dropdown-toggle-text{ class: ("is-default" if selected_labels.empty?) }
= multi_label_name(selected_labels, "Labels")
= icon('chevron-down', 'aria-hidden': 'true')
- .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable.dropdown-extended-height
+ .dropdown-menu.dropdown-select.dropdown-menu-paging.qa-dropdown-menu-labels.dropdown-menu-labels.dropdown-menu-selectable.dropdown-extended-height
= render partial: "shared/issuable/label_page_default"
- if issuable_sidebar.dig(:current_user, :can_admin_label)
= render partial: "shared/issuable/label_page_create"
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..ae5d548f1c0 100644
--- a/qa/qa/page/project/issue/show.rb
+++ b/qa/qa/page/project/issue/show.rb
@@ -13,6 +13,16 @@ module QA
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
+
+ view 'app/helpers/dropdowns_helper.rb' do
+ element :dropdown_input_field
+ end
+
view 'app/assets/javascripts/notes/components/comment_form.vue' do
element :comment_button
element :comment_input
@@ -59,6 +69,24 @@ module QA
select_filter_with_text('Show all activity')
end
+ 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
def select_filter_with_text(text)
diff --git a/qa/qa/resource/issue.rb b/qa/qa/resource/issue.rb
index 2c2f27fe231..89af3621a33 100644
--- a/qa/qa/resource/issue.rb
+++ b/qa/qa/resource/issue.rb
@@ -13,6 +13,7 @@ module QA
end
attribute :title
+ attribute :labels
def fabricate!
project.visit!
@@ -25,6 +26,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
+ {
+ title: title,
+ labels: [labels]
+ }
+ end
end
end
end
diff --git a/qa/qa/resource/label.rb b/qa/qa/resource/label.rb
index 7c899db31f3..94cb12ac9b6 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
+ {
+ name: @title,
+ color: @color
+ }
+ end
end
end
end