From b7c30cae4eedab5e8e41d9764ac08ca12361d054 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 1 Mar 2017 15:31:56 +0200 Subject: Add filter and sorting to dashboard groups page Signed-off-by: Dmitriy Zaporozhets --- spec/features/dashboard/groups_list_spec.rb | 34 +++++++++++++++++++++++++++++ spec/features/explore/groups_list_spec.rb | 33 ++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 spec/features/dashboard/groups_list_spec.rb create mode 100644 spec/features/explore/groups_list_spec.rb (limited to 'spec/features') diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb new file mode 100644 index 00000000000..8cdd14ba1bb --- /dev/null +++ b/spec/features/dashboard/groups_list_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper' + +RSpec.describe 'Dashboard Groups page', js: true, feature: true do + include WaitForAjax + + let!(:user) { create :user } + let!(:group) { create(:group) } + let!(:nested_group) { create(:group, :nested) } + let!(:another_group) { create(:group) } + + before do + group.add_owner(user) + nested_group.add_owner(user) + + login_as(user) + + visit dashboard_groups_path + end + + it 'shows groups user is member of' do + expect(page).to have_content(group.full_name) + expect(page).to have_content(nested_group.full_name) + expect(page).not_to have_content(another_group.full_name) + end + + it 'filters groups' do + fill_in 'filter_groups', with: group.name + wait_for_ajax + + expect(page).to have_content(group.full_name) + expect(page).not_to have_content(nested_group.full_name) + expect(page).not_to have_content(another_group.full_name) + end +end diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb new file mode 100644 index 00000000000..2ab97a8928b --- /dev/null +++ b/spec/features/explore/groups_list_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +RSpec.describe 'Explore Groups page', js: true, feature: true do + include WaitForAjax + + let!(:user) { create :user } + let!(:group) { create(:group) } + let!(:public_group) { create(:group, :public) } + let!(:private_group) { create(:group, :private) } + + before do + group.add_owner(user) + + login_as(user) + + visit explore_groups_path + end + + it 'shows groups user is member of' do + expect(page).to have_content(group.full_name) + expect(page).to have_content(public_group.full_name) + expect(page).not_to have_content(private_group.full_name) + end + + it 'filters groups' do + fill_in 'filter_groups', with: group.name + wait_for_ajax + + expect(page).to have_content(group.full_name) + expect(page).not_to have_content(public_group.full_name) + expect(page).not_to have_content(private_group.full_name) + end +end -- cgit v1.2.1 From 0a10d85927a62bfbe953656d55d50b3a3e7ffa01 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Thu, 2 Mar 2017 11:05:48 +0000 Subject: Update JS to use new standards --- spec/features/dashboard/groups_list_spec.rb | 13 +++++++++++++ spec/features/explore/groups_list_spec.rb | 13 +++++++++++++ 2 files changed, 26 insertions(+) (limited to 'spec/features') diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index 8cdd14ba1bb..c1d5e4069c2 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -31,4 +31,17 @@ RSpec.describe 'Dashboard Groups page', js: true, feature: true do expect(page).not_to have_content(nested_group.full_name) expect(page).not_to have_content(another_group.full_name) end + + it 'resets search when user cleans the input' do + fill_in 'filter_groups', with: group.name + wait_for_ajax + + fill_in 'filter_groups', with: "" + wait_for_ajax + + expect(page).to have_content(group.full_name) + expect(page).to have_content(public_group.full_name) + expect(page).not_to have_content(private_group.full_name) + expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2 + end end diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb index 2ab97a8928b..7b23115c527 100644 --- a/spec/features/explore/groups_list_spec.rb +++ b/spec/features/explore/groups_list_spec.rb @@ -30,4 +30,17 @@ RSpec.describe 'Explore Groups page', js: true, feature: true do expect(page).not_to have_content(public_group.full_name) expect(page).not_to have_content(private_group.full_name) end + + it 'resets search when user cleans the input' do + fill_in 'filter_groups', with: group.name + wait_for_ajax + + fill_in 'filter_groups', with: "" + wait_for_ajax + + expect(page).to have_content(group.full_name) + expect(page).to have_content(public_group.full_name) + expect(page).not_to have_content(private_group.full_name) + expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2 + end end -- cgit v1.2.1 From f440bfd247fe6e69bc913ec60e3535fda4797031 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 2 Mar 2017 14:10:37 +0200 Subject: Improve groups list specs Signed-off-by: Dmitriy Zaporozhets --- spec/features/dashboard/groups_list_spec.rb | 6 +++--- spec/features/explore/groups_list_spec.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'spec/features') diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb index c1d5e4069c2..ca04107d33a 100644 --- a/spec/features/dashboard/groups_list_spec.rb +++ b/spec/features/dashboard/groups_list_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -RSpec.describe 'Dashboard Groups page', js: true, feature: true do +describe 'Dashboard Groups page', js: true, feature: true do include WaitForAjax let!(:user) { create :user } @@ -40,8 +40,8 @@ RSpec.describe 'Dashboard Groups page', js: true, feature: true do wait_for_ajax expect(page).to have_content(group.full_name) - expect(page).to have_content(public_group.full_name) - expect(page).not_to have_content(private_group.full_name) + expect(page).to have_content(nested_group.full_name) + expect(page).not_to have_content(another_group.full_name) expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2 end end diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb index 7b23115c527..773ae4b38bc 100644 --- a/spec/features/explore/groups_list_spec.rb +++ b/spec/features/explore/groups_list_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -RSpec.describe 'Explore Groups page', js: true, feature: true do +describe 'Explore Groups page', js: true, feature: true do include WaitForAjax let!(:user) { create :user } -- cgit v1.2.1