summaryrefslogtreecommitdiff
path: root/spec/features/dashboard/groups_list_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/dashboard/groups_list_spec.rb')
-rw-r--r--spec/features/dashboard/groups_list_spec.rb48
1 files changed, 28 insertions, 20 deletions
diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb
index 533df7a325c..ac88b8ee160 100644
--- a/spec/features/dashboard/groups_list_spec.rb
+++ b/spec/features/dashboard/groups_list_spec.rb
@@ -13,12 +13,17 @@ feature 'Dashboard Groups page', :js do
sign_in(user)
visit dashboard_groups_path
- 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)
+ expect(page).to have_content(group.name)
+ expect(page).not_to have_content(another_group.name)
+
+ # Nested groups are hidden under their parent
+ find("#group-#{nested_group.parent_id} .fa-caret-right").trigger('click')
+ wait_for_requests
+
+ expect(page).to have_content(nested_group.name)
end
- describe 'when filtering groups' do
+ describe 'when filtering groups', :nested_groups do
before do
group.add_owner(user)
nested_group.add_owner(user)
@@ -33,7 +38,6 @@ feature 'Dashboard Groups page', :js do
wait_for_requests
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
@@ -45,13 +49,19 @@ feature 'Dashboard Groups page', :js do
wait_for_requests
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)
- expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2
+ expect(page.all('.groups-list-holder .content-list li').length).to eq 2
+ end
+
+ it 'shows the groups that have a matching subgroup' do
+ fill_in 'filter_groups', with: nested_group.parent.name
+ wait_for_requests
+
+ expect(page).to have_content(nested_group.parent.name)
end
end
- describe 'group with subgroups' do
+ describe 'group with subgroups', :nested_groups do
let!(:subgroup) { create(:group, :public, parent: group) }
before do
@@ -63,15 +73,20 @@ feature 'Dashboard Groups page', :js do
visit dashboard_groups_path
end
- it 'shows subgroups inside of its parent group' do
- expect(page).to have_selector('.groups-list-tree-container .group-list-tree', count: 2)
- expect(page).to have_selector(".groups-list-tree-container #group-#{group.id} #group-#{subgroup.id}", count: 1)
+ it 'Only shows the parent by default' do
+ expect(page).to have_selector('.groups-list-tree-container .group-list-tree', count: 1)
end
it 'can toggle parent group' do
- # Expanded by default
- expect(page).to have_selector("#group-#{group.id} .fa-caret-down", count: 1)
+ # Collapsed by default
+ expect(page).to have_selector("#group-#{group.id} .fa-caret-right")
+
+ # Expand
+ find("#group-#{group.id}").trigger('click')
+
+ expect(page).not_to have_selector("#group-#{group.id} .fa-caret-right", count: 1)
expect(page).not_to have_selector("#group-#{group.id} .fa-caret-right")
+ expect(page).to have_selector("#group-#{group.id} #group-#{subgroup.id}")
# Collapse
find("#group-#{group.id}").trigger('click')
@@ -79,13 +94,6 @@ feature 'Dashboard Groups page', :js do
expect(page).not_to have_selector("#group-#{group.id} .fa-caret-down")
expect(page).to have_selector("#group-#{group.id} .fa-caret-right", count: 1)
expect(page).not_to have_selector("#group-#{group.id} #group-#{subgroup.id}")
-
- # Expand
- find("#group-#{group.id}").trigger('click')
-
- expect(page).to have_selector("#group-#{group.id} .fa-caret-down", count: 1)
- expect(page).not_to have_selector("#group-#{group.id} .fa-caret-right")
- expect(page).to have_selector("#group-#{group.id} #group-#{subgroup.id}")
end
end