Commit 8769eef3 authored by Walmyr's avatar Walmyr Committed by Mark Lapierre
parent f35d3a24
...@@ -91,7 +91,7 @@ module DropdownsHelper ...@@ -91,7 +91,7 @@ module DropdownsHelper
def dropdown_filter(placeholder, search_id: nil) def dropdown_filter(placeholder, search_id: nil)
content_tag :div, class: "dropdown-input" do 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('search', class: "dropdown-input-search")
filter_output << icon('times', class: "dropdown-input-clear js-dropdown-input-clear", role: "button") filter_output << icon('times', class: "dropdown-input-clear js-dropdown-input-clear", role: "button")
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
= _('Labels') = _('Labels')
= icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true') = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
- if can_edit_issuable - 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?) } .value.issuable-show-labels.dont-hide.hide-collapsed.qa-labels-block{ class: ("has-labels" if selected_labels.any?) }
- if selected_labels.any? - if selected_labels.any?
- selected_labels.each do |label_hash| - selected_labels.each do |label_hash|
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
%span.dropdown-toggle-text{ class: ("is-default" if selected_labels.empty?) } %span.dropdown-toggle-text{ class: ("is-default" if selected_labels.empty?) }
= multi_label_name(selected_labels, "Labels") = multi_label_name(selected_labels, "Labels")
= icon('chevron-down', 'aria-hidden': 'true') = 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" = render partial: "shared/issuable/label_page_default"
- if issuable_sidebar.dig(:current_user, :can_admin_label) - if issuable_sidebar.dig(:current_user, :can_admin_label)
= render partial: "shared/issuable/label_page_create" = render partial: "shared/issuable/label_page_create"
......
...@@ -357,13 +357,13 @@ In the following we describe the changes needed in each of the resource files me ...@@ -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. 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. 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.
......
...@@ -197,6 +197,10 @@ module QA ...@@ -197,6 +197,10 @@ module QA
views.map(&:elements).flatten views.map(&:elements).flatten
end end
def send_keys_to_element(name, keys)
find_element(name).send_keys(keys)
end
class DSL class DSL
attr_reader :views attr_reader :views
......
...@@ -8,11 +8,6 @@ module QA ...@@ -8,11 +8,6 @@ module QA
include Page::Component::Issuable::Common include Page::Component::Issuable::Common
include Page::Component::Note 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 view 'app/assets/javascripts/notes/components/comment_form.vue' do
element :comment_button element :comment_button
element :comment_input element :comment_input
...@@ -27,6 +22,21 @@ module QA ...@@ -27,6 +22,21 @@ module QA
element :noteable_note_item element :noteable_note_item
end 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 # Adds a comment to an issue
# attachment option should be an absolute path # attachment option should be an absolute path
def comment(text, attachment: nil, filter: :all_activities) def comment(text, attachment: nil, filter: :all_activities)
...@@ -47,6 +57,10 @@ module QA ...@@ -47,6 +57,10 @@ module QA
end end
end end
def select_all_activities_filter
select_filter_with_text('Show all activity')
end
def select_comments_only_filter def select_comments_only_filter
select_filter_with_text('Show comments only') select_filter_with_text('Show comments only')
end end
...@@ -55,8 +69,26 @@ module QA ...@@ -55,8 +69,26 @@ module QA
select_filter_with_text('Show history only') select_filter_with_text('Show history only')
end end
def select_all_activities_filter def select_labels_and_refresh(labels)
select_filter_with_text('Show all activity') 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 end
private private
......
...@@ -12,6 +12,8 @@ module QA ...@@ -12,6 +12,8 @@ module QA
end end
end end
attribute :id
attribute :labels
attribute :title attribute :title
def fabricate! def fabricate!
...@@ -25,6 +27,21 @@ module QA ...@@ -25,6 +27,21 @@ module QA
page.create_new_issue page.create_new_issue
end end
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 end
end end
...@@ -34,6 +34,27 @@ module QA ...@@ -34,6 +34,27 @@ module QA
page.click_label_create_button page.click_label_create_button
end end
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 end
end end
...@@ -9,7 +9,7 @@ module QA ...@@ -9,7 +9,7 @@ module QA
Runtime::Browser.visit(:gitlab, Page::Main::Login) Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.perform(&:sign_in_using_credentials) 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 issue.title = issue_title
end end
......
...@@ -42,7 +42,7 @@ module QA ...@@ -42,7 +42,7 @@ module QA
Runtime::Browser.visit(:gitlab, Page::Main::Login) Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials } 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 issue.title = issue_title
end end
end end
......
...@@ -9,7 +9,7 @@ module QA ...@@ -9,7 +9,7 @@ module QA
Runtime::Browser.visit(:gitlab, Page::Main::Login) Runtime::Browser.visit(:gitlab, Page::Main::Login)
Page::Main::Login.act { sign_in_using_credentials } 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 issue.title = issue_title
end end
......
...@@ -23,7 +23,7 @@ module QA ...@@ -23,7 +23,7 @@ module QA
expect(page).to have_content(merge_request_title) expect(page).to have_content(merge_request_title)
expect(page).to have_content(merge_request_description) 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 end
it 'user creates a new merge request with a milestone and label' do it 'user creates a new merge request with a milestone and label' do
...@@ -41,7 +41,7 @@ module QA ...@@ -41,7 +41,7 @@ module QA
milestone.project = current_project milestone.project = current_project
end end
new_label = Resource::Label.fabricate! do |label| new_label = Resource::Label.fabricate_via_browser_ui! do |label|
label.project = current_project label.project = current_project
label.title = 'qa-mr-test-label' label.title = 'qa-mr-test-label'
label.description = 'Merge Request label' label.description = 'Merge Request label'
...@@ -62,7 +62,7 @@ module QA ...@@ -62,7 +62,7 @@ module QA
Page::MergeRequest::Show.perform do |merge_request| Page::MergeRequest::Show.perform do |merge_request|
expect(merge_request).to have_content(merge_request_title) expect(merge_request).to have_content(merge_request_title)
expect(merge_request).to have_content(merge_request_description) 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_assignee(gitlab_account_username)
expect(merge_request).to have_label(new_label.title) expect(merge_request).to have_label(new_label.title)
end end
......
...@@ -19,7 +19,7 @@ module QA ...@@ -19,7 +19,7 @@ module QA
it 'shows results for the original request and AJAX requests' do it 'shows results for the original request and AJAX requests' do
# Issue pages always make AJAX requests # Issue pages always make AJAX requests
Resource::Issue.fabricate! do |issue| Resource::Issue.fabricate_via_browser_ui! do |issue|
issue.title = 'Performance bar test' issue.title = 'Performance bar test'
end end
......
...@@ -125,7 +125,7 @@ module QA ...@@ -125,7 +125,7 @@ module QA
super super
end end
def within_element(name) def within_element(name, text: nil)
log("within element :#{name}") log("within element :#{name}")
element = super element = super
......
...@@ -135,9 +135,9 @@ describe QA::Support::Page::Logging do ...@@ -135,9 +135,9 @@ describe QA::Support::Page::Logging do
end end
it 'logs within_element' do 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 .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 .to output(/end within element :element/).to_stdout_from_any_process
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment