diff options
author | George Andrinopoulos <geoandri@gmail.com> | 2017-11-06 19:51:24 +0200 |
---|---|---|
committer | George Andrinopoulos <geoandri@gmail.com> | 2017-11-07 06:37:46 +0200 |
commit | f4ed780ef5fc76b7704742d4886ac435c3e5ab98 (patch) | |
tree | 7536ed460f72156638203606ce20dadff5305468 /spec/features/groups | |
parent | bba020a56cbedd6403b637ec7f9eaee258eb7c67 (diff) | |
download | gitlab-ce-f4ed780ef5fc76b7704742d4886ac435c3e5ab98.tar.gz |
Add Group Milestone sorting
Diffstat (limited to 'spec/features/groups')
-rw-r--r-- | spec/features/groups/milestones_sorting_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/features/groups/milestones_sorting_spec.rb b/spec/features/groups/milestones_sorting_spec.rb new file mode 100644 index 00000000000..3bd59587535 --- /dev/null +++ b/spec/features/groups/milestones_sorting_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' + +feature 'Milestones sorting', :js do + let(:group) { create(:group) } + let!(:project) { create(:project_empty_repo, group: group) } + let!(:other_project) { create(:project_empty_repo, group: group) } + let!(:project_milestone1) { create(:milestone, project: project, title: 'v1.0', due_date: 10.days.from_now) } + let!(:other_project_milestone1) { create(:milestone, project: other_project, title: 'v1.0', due_date: 10.days.from_now) } + let!(:project_milestone2) { create(:milestone, project: project, title: 'v2.0', due_date: 5.days.from_now) } + let!(:other_project_milestone2) { create(:milestone, project: other_project, title: 'v2.0', due_date: 5.days.from_now) } + let(:user) { create(:group_member, :master, user: create(:user), group: group ).user } + + before do + sign_in(user) + end + + scenario 'visit group milestones and sort by due_date_asc' do + visit group_milestones_path(group) + + expect(page).to have_button('Due soon') + + # assert default sorting + within '.milestones' do + expect(page.all('ul.content-list > li').first.text).to include('v2.0') + expect(page.all('ul.content-list > li').last.text).to include('v1.0') + 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') + + 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('v1.0') + expect(page.all('ul.content-list > li').last.text).to include('v2.0') + end + end +end |