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