summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/helpers/dropdowns_helper.rb2
-rw-r--r--app/views/shared/issuable/_sidebar.html.haml4
-rw-r--r--doc/development/testing_guide/end_to_end/quick_start_guide.md8
-rw-r--r--qa/qa/page/base.rb4
-rw-r--r--qa/qa/page/project/issue/show.rb46
-rw-r--r--qa/qa/resource/issue.rb17
-rw-r--r--qa/qa/resource/label.rb21
-rw-r--r--qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb2
-rw-r--r--qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb2
-rw-r--r--qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb2
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb6
-rw-r--r--qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb2
-rw-r--r--qa/qa/support/page/logging.rb2
-rw-r--r--qa/spec/page/logging_spec.rb4
14 files changed, 98 insertions, 24 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/doc/development/testing_guide/end_to_end/quick_start_guide.md b/doc/development/testing_guide/end_to_end/quick_start_guide.md
index 521e3e56e7a..1802f4792e0 100644
--- a/doc/development/testing_guide/end_to_end/quick_start_guide.md
+++ b/doc/development/testing_guide/end_to_end/quick_start_guide.md
@@ -357,13 +357,13 @@ In the following we describe the changes needed in each of the resource files me
Now, let's make it possible to create an issue resource through the API.
-First, in the [issue resource](https://gitlab.com/gitlab-org/gitlab-ee/blob/d3584e80b4236acdf393d815d604801573af72cc/qa/qa/resource/issue.rb), let's expose its labels attribute.
+First, in the [issue resource](https://gitlab.com/gitlab-org/gitlab-ee/blob/d3584e80b4236acdf393d815d604801573af72cc/qa/qa/resource/issue.rb), let's expose its id and labels attributes.
-Add the following `attribute :labels` right above the [`attribute :title`](https://gitlab.com/gitlab-org/gitlab-ee/blob/d3584e80b4236acdf393d815d604801573af72cc/qa/qa/resource/issue.rb#L15).
+Add the following `attribute :id` and `attribute :labels` right above the [`attribute :title`](https://gitlab.com/gitlab-org/gitlab-ee/blob/d3584e80b4236acdf393d815d604801573af72cc/qa/qa/resource/issue.rb#L15).
-> This line is needed to allow for labels to be automatically added to an issue when fabricating it via API.
+> This line is needed to allow for the issue fabrication, and for labels to be automatically added to the issue when fabricating it via API.
-> We add the new line above the existing attribute to keep them alphabetically organized.
+> We add the attributes above the existing attribute to keep them alphabetically organized.
Next, add the following code right below the [`fabricate!`](https://gitlab.com/gitlab-org/gitlab-ee/blob/d3584e80b4236acdf393d815d604801573af72cc/qa/qa/resource/issue.rb#L27) method.
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