diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-11-22 11:40:52 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-11-22 11:40:52 +0000 |
commit | e548c613346a09ba2fc8dfd6ed64da6628ec6a45 (patch) | |
tree | e1ccf4abc315ba7175cc89657035cd9d01904cb9 /spec/features/groups | |
parent | 13cfcfc23bf9ee6d599c34623a965671373fd75d (diff) | |
parent | a4d71cba7ef80e6f3c10f148dd1edfbef7f82893 (diff) | |
download | gitlab-ce-e548c613346a09ba2fc8dfd6ed64da6628ec6a45.tar.gz |
Merge branch '39720-group-milestone-sorting' into 'master'
Add Group Milestone sorting
Closes #39720
See merge request gitlab-org/gitlab-ce!15230
Diffstat (limited to 'spec/features/groups')
-rw-r--r-- | spec/features/groups/milestones_sorting_spec.rb | 51 |
1 files changed, 51 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..a0fe40cf1d3 --- /dev/null +++ b/spec/features/groups/milestones_sorting_spec.rb @@ -0,0 +1,51 @@ +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!(:group_milestone) { create(:milestone, group: group, title: 'v3.0', due_date: 7.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')[1].text).to include('v3.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') + 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('v1.0') + expect(page.all('ul.content-list > li')[1].text).to include('v3.0') + expect(page.all('ul.content-list > li').last.text).to include('v2.0') + end + end +end |