Commit 17dccc35 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Update feature specs for updated group lists

parent 082c28cc
---
title: Show collapsible project lists
merge_request: 14055
author:
type: changed
...@@ -6,8 +6,11 @@ feature 'Dashboard Groups page', :js do ...@@ -6,8 +6,11 @@ feature 'Dashboard Groups page', :js do
let!(:nested_group) { create(:group, :nested) } let!(:nested_group) { create(:group, :nested) }
let!(:another_group) { create(:group) } let!(:another_group) { create(:group) }
before do def click_group_caret(group)
pending('Update for new group tree') within("#group-#{group.id}") do
first('.folder-caret').click
end
wait_for_requests
end end
it 'shows groups user is member of' do it 'shows groups user is member of' do
...@@ -18,9 +21,13 @@ feature 'Dashboard Groups page', :js do ...@@ -18,9 +21,13 @@ feature 'Dashboard Groups page', :js do
visit dashboard_groups_path visit dashboard_groups_path
wait_for_requests wait_for_requests
expect(page).to have_content(group.full_name) expect(page).to have_content(group.name)
expect(page).to have_content(nested_group.full_name) expect(page).to have_content(nested_group.parent.name)
expect(page).not_to have_content(another_group.full_name)
click_group_caret(nested_group.parent)
expect(page).to have_content(nested_group.name)
expect(page).not_to have_content(another_group.name)
end end
describe 'when filtering groups' do describe 'when filtering groups' do
...@@ -33,13 +40,14 @@ feature 'Dashboard Groups page', :js do ...@@ -33,13 +40,14 @@ feature 'Dashboard Groups page', :js do
visit dashboard_groups_path visit dashboard_groups_path
end end
it 'filters groups' do it 'expands when filtering groups' do
fill_in 'filter', with: group.name fill_in 'filter', with: nested_group.name
wait_for_requests wait_for_requests
expect(page).to have_content(group.full_name) expect(page).not_to have_content(group.name)
expect(page).not_to have_content(nested_group.full_name) expect(page).to have_content(nested_group.parent.name)
expect(page).not_to have_content(another_group.full_name) expect(page).to have_content(nested_group.name)
expect(page).not_to have_content(another_group.name)
end end
it 'resets search when user cleans the input' do it 'resets search when user cleans the input' do
...@@ -49,9 +57,9 @@ feature 'Dashboard Groups page', :js do ...@@ -49,9 +57,9 @@ feature 'Dashboard Groups page', :js do
fill_in 'filter', with: '' fill_in 'filter', with: ''
wait_for_requests wait_for_requests
expect(page).to have_content(group.full_name) expect(page).to have_content(group.name)
expect(page).to have_content(nested_group.full_name) expect(page).to have_content(nested_group.parent.name)
expect(page).not_to have_content(another_group.full_name) expect(page).not_to have_content(another_group.name)
expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2 expect(page.all('.js-groups-list-holder .content-list li').length).to eq 2
end end
end end
...@@ -69,28 +77,29 @@ feature 'Dashboard Groups page', :js do ...@@ -69,28 +77,29 @@ feature 'Dashboard Groups page', :js do
end end
it 'shows subgroups inside of its parent group' do 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("#group-#{group.id}")
expect(page).to have_selector(".groups-list-tree-container #group-#{group.id} #group-#{subgroup.id}", count: 1) click_group_caret(group)
expect(page).to have_selector("#group-#{group.id} #group-#{subgroup.id}")
end end
it 'can toggle parent group' do it 'can toggle parent group' do
# Expanded by default # Collapsed by default
expect(page).to have_selector("#group-#{group.id} .fa-caret-down", count: 1) expect(page).not_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} .fa-caret-right")
# Collapse # expand
find("#group-#{group.id}").trigger('click') click_group_caret(group)
expect(page).not_to have_selector("#group-#{group.id} .fa-caret-down") expect(page).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} .fa-caret-right", count: 1)
expect(page).not_to have_selector("#group-#{group.id} #group-#{subgroup.id}") expect(page).to have_selector("#group-#{group.id} #group-#{subgroup.id}")
# Expand # collapse
find("#group-#{group.id}").trigger('click') click_group_caret(group)
expect(page).to have_selector("#group-#{group.id} .fa-caret-down", count: 1) expect(page).not_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} .fa-caret-right")
expect(page).to have_selector("#group-#{group.id} #group-#{subgroup.id}") expect(page).not_to have_selector("#group-#{group.id} #group-#{subgroup.id}")
end end
end end
......
...@@ -8,8 +8,6 @@ describe 'Explore Groups page', :js do ...@@ -8,8 +8,6 @@ describe 'Explore Groups page', :js do
let!(:empty_project) { create(:project, group: public_group) } let!(:empty_project) { create(:project, group: public_group) }
before do before do
pending('Update for new group tree')
group.add_owner(user) group.add_owner(user)
sign_in(user) sign_in(user)
......
...@@ -90,11 +90,7 @@ feature 'Group' do ...@@ -90,11 +90,7 @@ feature 'Group' do
context 'as admin' do context 'as admin' do
before do before do
visit group_path(group) visit new_group_path(group, parent_id: group.id)
pending('use the new subgroup button')
click_link 'New Subgroup'
end end
it 'creates a nested group' do it 'creates a nested group' do
...@@ -114,11 +110,8 @@ feature 'Group' do ...@@ -114,11 +110,8 @@ feature 'Group' do
sign_out(:user) sign_out(:user)
sign_in(user) sign_in(user)
visit group_path(group) visit new_group_path(group, parent_id: group.id)
pending('use the new subgroup button')
click_link 'New Subgroup'
fill_in 'Group path', with: 'bar' fill_in 'Group path', with: 'bar'
click_button 'Create group' click_button 'Create group'
...@@ -206,13 +199,15 @@ feature 'Group' do ...@@ -206,13 +199,15 @@ feature 'Group' do
describe 'group page with nested groups', :nested_groups, js: true do describe 'group page with nested groups', :nested_groups, js: true do
let!(:group) { create(:group) } let!(:group) { create(:group) }
let!(:nested_group) { create(:group, parent: group) } let!(:nested_group) { create(:group, parent: group) }
let!(:project) { create(:project, namespace: group) }
let!(:path) { group_path(group) } let!(:path) { group_path(group) }
it 'has nested groups tab with nested groups inside' do it 'it renders projects and groups on the page' do
pending('the child should be visible on the show page')
visit path visit path
wait_for_requests
expect(page).to have_content(nested_group.name) expect(page).to have_content(nested_group.name)
expect(page).to have_content(project.name)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment