diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-07-21 15:49:37 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-09-01 10:21:09 +0200 |
commit | 1e668a3cfebfcf576a8c5da834bad094fd9039f6 (patch) | |
tree | 405caed1e99ae5f642c9f363d793b3a9a64c4dd1 /spec/features/dashboard/groups_list_spec.rb | |
parent | bf4ec606a56238326bf4930c59d0ca82dd281cb7 (diff) | |
download | gitlab-ce-bvl-show-projects-in-group-tree.tar.gz |
Rework subgroup endpointbvl-show-projects-in-group-tree
Diffstat (limited to 'spec/features/dashboard/groups_list_spec.rb')
-rw-r--r-- | spec/features/dashboard/groups_list_spec.rb | 48 |
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 |