1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
require 'spec_helper'
feature 'Milestones sorting', :feature, :js do
include SortingHelper
let(:user) { create(:user) }
let(:project) { create(:empty_project, name: 'test', namespace: user.namespace) }
before do
# Milestones
create(:milestone,
due_date: 10.days.from_now,
created_at: 2.hours.ago,
title: "aaa", project: project)
create(:milestone,
due_date: 11.days.from_now,
created_at: 1.hour.ago,
title: "bbb", project: project)
gitlab_sign_in(user)
end
scenario 'visit project milestones and sort by due_date_asc' do
visit project_milestones_path(project)
expect(page).to have_button('Due soon')
# assert default sorting
within '.milestones' do
expect(page.all('ul.content-list > li').first.text).to include('aaa')
expect(page.all('ul.content-list > li').last.text).to include('bbb')
end
click_button 'Due soon'
sort_options = find('ul.dropdown-menu-sort li').all('a').collect(&:text)
expect(sort_options[0]).to eq('Due soon')
expect(sort_options[1]).to eq('Due later')
expect(sort_options[2]).to eq('Start soon')
expect(sort_options[3]).to eq('Start later')
expect(sort_options[4]).to eq('Name, ascending')
expect(sort_options[5]).to eq('Name, descending')
click_link 'Due later'
expect(page).to have_button('Due later')
within '.milestones' do
expect(page.all('ul.content-list > li').first.text).to include('bbb')
expect(page.all('ul.content-list > li').last.text).to include('aaa')
end
end
end
|