summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-10-05 13:13:24 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-05 13:50:09 +0200
commit17dccc35ca4754405b87c87f81daec34e02ea7a1 (patch)
treebbaf21b48ac179587cf330738683dd5f5ab65267
parent082c28cce697682b2e13e35eef3ce9f3ad95aa63 (diff)
downloadgitlab-ce-17dccc35ca4754405b87c87f81daec34e02ea7a1.tar.gz
Update feature specs for updated group lists
-rw-r--r--changelogs/unreleased/bvl-group-trees.yml5
-rw-r--r--spec/features/dashboard/groups_list_spec.rb65
-rw-r--r--spec/features/explore/groups_list_spec.rb2
-rw-r--r--spec/features/groups_spec.rb17
4 files changed, 48 insertions, 41 deletions
diff --git a/changelogs/unreleased/bvl-group-trees.yml b/changelogs/unreleased/bvl-group-trees.yml
new file mode 100644
index 00000000000..9f76eb81627
--- /dev/null
+++ b/changelogs/unreleased/bvl-group-trees.yml
@@ -0,0 +1,5 @@
+---
+title: Show collapsible project lists
+merge_request: 14055
+author:
+type: changed
diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb
index 9cfef46d346..c9d9371f5ab 100644
--- a/spec/features/dashboard/groups_list_spec.rb
+++ b/spec/features/dashboard/groups_list_spec.rb
@@ -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
diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb
index 41778542e23..801a33979ff 100644
--- a/spec/features/explore/groups_list_spec.rb
+++ b/spec/features/explore/groups_list_spec.rb
@@ -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)
diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb
index 493dd551d25..da2edd8b980 100644
--- a/spec/features/groups_spec.rb
+++ b/spec/features/groups_spec.rb
@@ -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