Commit 8d7e0f0b authored by Phil Hughes's avatar Phil Hughes

Fixed failing tests

parent a9ea06ed
...@@ -25,12 +25,12 @@ class @MilestoneSelect ...@@ -25,12 +25,12 @@ class @MilestoneSelect
if showNo if showNo
data.unshift( data.unshift(
id: "0" id: "0"
title: 'No milestone' title: 'No Milestone'
) )
if showAny if showAny
data.unshift( data.unshift(
title: 'Any milestone' title: 'Any Milestone'
) )
if data.length > 2 if data.length > 2
......
.filter-item { .filter-item {
margin-right: 6px; margin-right: 6px;
vertical-align: top;
} }
@media (min-width: 800px) { @media (min-width: 800px) {
......
...@@ -9,37 +9,38 @@ ...@@ -9,37 +9,38 @@
.filter-item.inline .filter-item.inline
- if params[:author_id] - if params[:author_id]
= hidden_field_tag(:author_id, params[:author_id]) = hidden_field_tag(:author_id, params[:author_id])
= dropdown_tag("Author", options: { toggle_class: "js-user-search js-filter-submit", title: "Filter by author", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable", = dropdown_tag("Author", options: { toggle_class: "js-user-search js-filter-submit js-author-search", title: "Filter by author", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-author",
placeholder: "Search authors", data: { any_user: "Any Author", first_user: true, current_user: true, project_id: @project.id, selected: params[:author_id], field_name: "author_id" } }) placeholder: "Search authors", data: { any_user: "Any Author", first_user: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), selected: params[:author_id], field_name: "author_id" } })
.filter-item.inline .filter-item.inline
- if params[:assignee_id] - if params[:assignee_id]
= hidden_field_tag(:assignee_id, params[:assignee_id]) = hidden_field_tag(:assignee_id, params[:assignee_id])
= dropdown_tag("Assignee", options: { toggle_class: "js-user-search js-filter-submit", title: "Filter by assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable", = dropdown_tag("Assignee", options: { toggle_class: "js-user-search js-filter-submit", title: "Filter by assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable",
placeholder: "Search assignee", data: { any_user: "Any Author", first_user: true, null_user: true, current_user: true, project_id: @project.id, selected: params[:assignee_id], field_name: "assignee_id" } }) placeholder: "Search assignee", data: { any_user: "Any Author", first_user: (current_user.username if current_user), null_user: true, current_user: true, project_id: (@project.id if @project), selected: params[:assignee_id], field_name: "assignee_id" } })
.filter-item.inline.milestone-filter .filter-item.inline.milestone-filter
- if params[:milestone_title] - if params[:milestone_title]
= hidden_field_tag(:milestone_title, params[:milestone_title]) = hidden_field_tag(:milestone_title, params[:milestone_title])
= dropdown_tag("Milestone", options: { title: "Filter by milestone", toggle_class: 'js-milestone-select js-filter-submit', filter: true, dropdown_class: "dropdown-menu-selectable", = dropdown_tag("Milestone", options: { title: "Filter by milestone", toggle_class: 'js-milestone-select js-filter-submit', filter: true, dropdown_class: "dropdown-menu-selectable",
placeholder: "Search milestones", footer_content: true, data: { show_no: true, show_any: true, field_name: "milestone_title", selected: params[:milestone_title], project_id: @project.id, milestones: namespace_project_milestones_path(@project.namespace, @project, :js) } }) do placeholder: "Search milestones", footer_content: true, data: { show_no: true, show_any: true, field_name: "milestone_title", selected: params[:milestone_title], project_id: (@project.id if @project), milestones: (namespace_project_milestones_path(@project.namespace, @project, :js) if @project) } }) do
%ul.dropdown-footer-list - if @project
- if can? current_user, :admin_milestone, @project %ul.dropdown-footer-list
- if can? current_user, :admin_milestone, @project
%li
= link_to new_namespace_project_milestone_path(@project.namespace, @project), title: "New Milestone" do
Create new
%li %li
= link_to new_namespace_project_milestone_path(@project.namespace, @project), title: "New Milestone" do = link_to namespace_project_milestones_path(@project.namespace, @project) do
Create new - if can? current_user, :admin_milestone, @project
%li Manage milestones
= link_to namespace_project_milestones_path(@project.namespace, @project) do - else
- if can? current_user, :admin_milestone, @project View milestones
Manage milestones
- else
View milestones
.filter-item.inline.labels-filter .filter-item.inline.labels-filter
- if params[:label_name] - if params[:label_name]
= hidden_field_tag(:label_name, params[:label_name]) = hidden_field_tag(:label_name, params[:label_name])
.dropdown .dropdown
%button.dropdown-menu-toggle.js-label-select.js-filter-submit{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: @project.id, labels: namespace_project_labels_path(@project.namespace, @project, :js)}} %button.dropdown-menu-toggle.js-label-select.js-filter-submit{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: (@project.id if @project), labels: (namespace_project_labels_path(@project.namespace, @project, :js) if @project)}}
%span.dropdown-toggle-text %span.dropdown-toggle-text
Label Label
= icon('chevron-down') = icon('chevron-down')
...@@ -48,18 +49,19 @@ ...@@ -48,18 +49,19 @@
= dropdown_title("Filter by label") = dropdown_title("Filter by label")
= dropdown_filter("Search labels") = dropdown_filter("Search labels")
= dropdown_content = dropdown_content
= dropdown_footer do - if @project
%ul.dropdown-footer-list = dropdown_footer do
- if can? current_user, :admin_label, @project %ul.dropdown-footer-list
- if can? current_user, :admin_label, @project
%li
%a.dropdown-toggle-page{href: "#"}
Create new
%li %li
%a.dropdown-toggle-page{href: "#"} = link_to namespace_project_labels_path(@project.namespace, @project) do
Create new - if can? current_user, :admin_label, @project
%li Manage labels
= link_to namespace_project_labels_path(@project.namespace, @project) do - else
- if can? current_user, :admin_label, @project View labels
Manage labels
- else
View labels
- if can? current_user, :admin_label, @project - if can? current_user, :admin_label, @project
.dropdown-page-two .dropdown-page-two
= dropdown_title("Create new label", back: true) = dropdown_title("Create new label", back: true)
...@@ -92,7 +94,7 @@ ...@@ -92,7 +94,7 @@
%a{href: "#", data: {id: "close"}} Closed %a{href: "#", data: {id: "close"}} Closed
.filter-item.inline .filter-item.inline
= dropdown_tag("Assignee", options: { toggle_class: "js-user-search", title: "Assign to", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable", = dropdown_tag("Assignee", options: { toggle_class: "js-user-search", title: "Assign to", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable",
placeholder: "Search authors", data: { first_user: true, current_user: true, project_id: @project.id, field_name: "update[assignee_id]" } }) placeholder: "Search authors", data: { first_user: (current_user.username if current_user), current_user: true, project_id: @project.id, field_name: "update[assignee_id]" } })
.filter-item.inline .filter-item.inline
= dropdown_tag("Milestone", options: { title: "Assign milestone", toggle_class: 'js-milestone-select', filter: true, dropdown_class: "dropdown-menu-selectable", = dropdown_tag("Milestone", options: { title: "Assign milestone", toggle_class: 'js-milestone-select', filter: true, dropdown_class: "dropdown-menu-selectable",
placeholder: "Search milestones", data: { show_no: true, field_name: "update[milestone_id]", project_id: @project.id, milestones: namespace_project_milestones_path(@project.namespace, @project, :js), use_id: true } }) placeholder: "Search milestones", data: { show_no: true, field_name: "update[milestone_id]", project_id: @project.id, milestones: namespace_project_milestones_path(@project.namespace, @project, :js), use_id: true } })
......
...@@ -36,13 +36,22 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps ...@@ -36,13 +36,22 @@ class Spinach::Features::DashboardIssues < Spinach::FeatureSteps
end end
step 'I click "Authored by me" link' do step 'I click "Authored by me" link' do
select2(current_user.id, from: "#author_id") execute_script('$("#assignee_id").val("")')
select2(nil, from: "#assignee_id") execute_script('$(".js-user-search").first().click()')
sleep 1
execute_script("$('.dropdown-content li:contains(\"#{current_user.to_reference}\") a').click()")
sleep 1
end end
step 'I click "All" link' do step 'I click "All" link' do
select2(nil, from: "#author_id") execute_script('$(".js-user-search").first().click()')
select2(nil, from: "#assignee_id") sleep 1
execute_script('$(".js-user-search").first().parent().find("li a").first().click()')
sleep 1
execute_script('$(".js-user-search").eq(1).click()')
sleep 1
execute_script('$(".js-user-search").eq(1).parent().find("li a").first().click()')
sleep 1
end end
def should_see(issue) def should_see(issue)
......
...@@ -40,13 +40,22 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps ...@@ -40,13 +40,22 @@ class Spinach::Features::DashboardMergeRequests < Spinach::FeatureSteps
end end
step 'I click "Authored by me" link' do step 'I click "Authored by me" link' do
select2(current_user.id, from: "#author_id") execute_script('$("#assignee_id").val("")')
select2(nil, from: "#assignee_id") execute_script('$(".js-user-search").first().click()')
sleep 0.5
execute_script("$('.dropdown-content li:contains(\"#{current_user.to_reference}\") a').click()")
sleep 2
end end
step 'I click "All" link' do step 'I click "All" link' do
select2(nil, from: "#author_id") execute_script('$(".js-user-search").first().click()')
select2(nil, from: "#assignee_id") sleep 0.5
execute_script('$(".js-user-search").first().parent().find("li a").first().click()')
sleep 2
execute_script('$(".js-user-search").eq(1).click()')
sleep 0.5
execute_script('$(".js-user-search").eq(1).parent().find("li a").first().click()')
sleep 2
end end
def should_see(merge_request) def should_see(merge_request)
......
...@@ -29,7 +29,10 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps ...@@ -29,7 +29,10 @@ class Spinach::Features::ProjectIssuesFilterLabels < Spinach::FeatureSteps
end end
step 'I click link "bug"' do step 'I click link "bug"' do
select2('bug', from: "#label_name") page.find('.js-label-select').click
sleep 0.5
execute_script("$('.dropdown-menu-labels li:contains(\"bug\") a').click()")
sleep 2
end end
step 'I click link "feature"' do step 'I click link "feature"' do
......
...@@ -27,7 +27,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps ...@@ -27,7 +27,7 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end end
step 'I click link "Closed"' do step 'I click link "Closed"' do
click_link "Closed" find('.issues-state-filters a', text: "Closed").click
end end
step 'I click button "Unsubscribe"' do step 'I click button "Unsubscribe"' do
...@@ -63,14 +63,15 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps ...@@ -63,14 +63,15 @@ class Spinach::Features::ProjectIssues < Spinach::FeatureSteps
end end
step 'I click "author" dropdown' do step 'I click "author" dropdown' do
first('#s2id_author_id').click page.find('.js-author-search').click
sleep 1
end end
step 'I see current user as the first user' do step 'I see current user as the first user' do
expect(page).to have_selector('.user-result', visible: true, count: 3) expect(page).to have_selector('.dropdown-content', visible: true)
users = page.all('.user-name') users = page.all('.dropdown-menu-author .dropdown-content li a')
expect(users[0].text).to eq 'Any Author' expect(users[0].text).to eq 'Any Author'
expect(users[1].text).to eq current_user.name expect(users[1].text).to eq "#{current_user.name} #{current_user.to_reference}"
end end
step 'I submit new issue "500 error on profile"' do step 'I submit new issue "500 error on profile"' do
......
...@@ -31,6 +31,9 @@ feature 'Issue filtering by Milestone', feature: true do ...@@ -31,6 +31,9 @@ feature 'Issue filtering by Milestone', feature: true do
end end
def filter_by_milestone(title) def filter_by_milestone(title)
select2(title, from: '#milestone_title') find(".js-milestone-select").click
sleep 1
find(".milestone-filter a", text: title).click
sleep 1
end end
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