2016-04-11 06:38:24 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "Dashboard Issues filtering", feature: true, js: true do
|
|
|
|
let(:user) { create(:user) }
|
2017-03-28 17:13:16 -04:00
|
|
|
let(:project) { create(:empty_project) }
|
2016-04-11 06:38:24 -04:00
|
|
|
let(:milestone) { create(:milestone, project: project) }
|
|
|
|
|
|
|
|
context 'filtering by milestone' do
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
|
|
|
login_as(user)
|
|
|
|
|
|
|
|
create(:issue, project: project, author: user, assignee: user)
|
|
|
|
create(:issue, project: project, author: user, assignee: user, milestone: milestone)
|
|
|
|
|
|
|
|
visit_issues
|
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'shows all issues with no milestone' do
|
2016-04-11 06:38:24 -04:00
|
|
|
show_milestone_dropdown
|
|
|
|
|
|
|
|
click_link 'No Milestone'
|
|
|
|
|
2016-09-29 10:55:55 -04:00
|
|
|
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
|
2016-04-11 06:38:24 -04:00
|
|
|
expect(page).to have_selector('.issue', count: 1)
|
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'shows all issues with any milestone' do
|
2016-04-11 06:38:24 -04:00
|
|
|
show_milestone_dropdown
|
|
|
|
|
|
|
|
click_link 'Any Milestone'
|
|
|
|
|
2016-09-29 10:55:55 -04:00
|
|
|
expect(page).to have_issuable_counts(open: 2, closed: 0, all: 2)
|
2016-04-11 06:38:24 -04:00
|
|
|
expect(page).to have_selector('.issue', count: 2)
|
|
|
|
end
|
|
|
|
|
2016-07-25 14:16:19 -04:00
|
|
|
it 'shows all issues with the selected milestone' do
|
2016-04-11 06:38:24 -04:00
|
|
|
show_milestone_dropdown
|
|
|
|
|
|
|
|
page.within '.dropdown-content' do
|
|
|
|
click_link milestone.title
|
|
|
|
end
|
|
|
|
|
2016-09-29 10:55:55 -04:00
|
|
|
expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1)
|
2016-04-11 06:38:24 -04:00
|
|
|
expect(page).to have_selector('.issue', count: 1)
|
|
|
|
end
|
2016-11-03 06:29:37 -04:00
|
|
|
|
|
|
|
it 'updates atom feed link' do
|
|
|
|
visit_issues(milestone_title: '', assignee_id: user.id)
|
|
|
|
|
2017-03-08 16:31:29 -05:00
|
|
|
link = find('.nav-controls a[title="Subscribe"]')
|
2017-02-21 19:51:36 -05:00
|
|
|
params = CGI.parse(URI.parse(link[:href]).query)
|
2016-11-03 06:29:37 -04:00
|
|
|
auto_discovery_link = find('link[type="application/atom+xml"]', visible: false)
|
2017-02-21 19:51:36 -05:00
|
|
|
auto_discovery_params = CGI.parse(URI.parse(auto_discovery_link[:href]).query)
|
2016-11-03 06:29:37 -04:00
|
|
|
|
|
|
|
expect(params).to include('private_token' => [user.private_token])
|
|
|
|
expect(params).to include('milestone_title' => [''])
|
|
|
|
expect(params).to include('assignee_id' => [user.id.to_s])
|
|
|
|
expect(auto_discovery_params).to include('private_token' => [user.private_token])
|
|
|
|
expect(auto_discovery_params).to include('milestone_title' => [''])
|
|
|
|
expect(auto_discovery_params).to include('assignee_id' => [user.id.to_s])
|
|
|
|
end
|
2016-04-11 06:38:24 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def show_milestone_dropdown
|
|
|
|
click_button 'Milestone'
|
|
|
|
expect(page).to have_selector('.dropdown-content', visible: true)
|
|
|
|
end
|
|
|
|
|
2016-11-03 06:29:37 -04:00
|
|
|
def visit_issues(*args)
|
|
|
|
visit issues_dashboard_path(*args)
|
2016-04-11 06:38:24 -04:00
|
|
|
end
|
|
|
|
end
|