Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
ff052757
Commit
ff052757
authored
Jun 07, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add feature tests for Dashboard Groups page
parent
4934c709
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
19 deletions
+103
-19
spec/features/dashboard/groups_list_spec.rb
spec/features/dashboard/groups_list_spec.rb
+103
-19
No files found.
spec/features/dashboard/groups_list_spec.rb
View file @
ff052757
...
@@ -6,40 +6,124 @@ describe 'Dashboard Groups page', js: true, feature: true do
...
@@ -6,40 +6,124 @@ describe 'Dashboard Groups page', js: true, feature: true 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
it
'shows groups user is member of'
do
group
.
add_owner
(
user
)
group
.
add_owner
(
user
)
nested_group
.
add_owner
(
user
)
nested_group
.
add_owner
(
user
)
login_as
(
user
)
login_as
(
user
)
visit
dashboard_groups_path
visit
dashboard_groups_path
end
it
'shows groups user is member of'
do
expect
(
page
).
to
have_content
(
group
.
full_name
)
expect
(
page
).
to
have_content
(
group
.
full_name
)
expect
(
page
).
to
have_content
(
nested_group
.
full_name
)
expect
(
page
).
to
have_content
(
nested_group
.
full_name
)
expect
(
page
).
not_to
have_content
(
another_group
.
full_name
)
expect
(
page
).
not_to
have_content
(
another_group
.
full_name
)
end
end
it
'filters groups'
do
describe
'when filtering groups'
do
fill_in
'filter_groups'
,
with:
group
.
name
before
do
wait_for_requests
group
.
add_owner
(
user
)
nested_group
.
add_owner
(
user
)
expect
(
page
).
to
have_content
(
group
.
full_name
)
login_as
(
user
)
expect
(
page
).
not_to
have_content
(
nested_group
.
full_name
)
expect
(
page
).
not_to
have_content
(
another_group
.
full_name
)
visit
dashboard_groups_path
end
it
'filters groups'
do
fill_in
'filter_groups'
,
with:
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
)
end
it
'resets search when user cleans the input'
do
fill_in
'filter_groups'
,
with:
group
.
name
wait_for_requests
fill_in
'filter_groups'
,
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
.
all
(
'.js-groups-list-holder .content-list li'
).
length
).
to
eq
2
end
end
end
it
'resets search when user cleans the input'
do
describe
'group with subgroups'
do
fill_in
'filter_groups'
,
with:
group
.
name
let!
(
:subgroup
)
{
create
(
:group
,
:public
,
parent:
group
)
}
wait_for_requests
fill_in
'filter_groups'
,
with:
""
before
do
wait_for_requests
group
.
add_owner
(
user
)
subgroup
.
add_owner
(
user
)
expect
(
page
).
to
have_content
(
group
.
full_name
)
login_as
(
user
)
expect
(
page
).
to
have_content
(
nested_group
.
full_name
)
expect
(
page
).
not_to
have_content
(
another_group
.
full_name
)
visit
dashboard_groups_path
expect
(
page
.
all
(
'.js-groups-list-holder .content-list li'
).
length
).
to
eq
2
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
)
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"
)
# Collapse
find
(
"#group-
#{
group
.
id
}
"
).
trigger
(
'click'
)
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
describe
'when using pagination'
do
let
(
:group2
)
{
create
(
:group
)
}
before
do
group
.
add_owner
(
user
)
group2
.
add_owner
(
user
)
allow
(
Kaminari
.
config
).
to
receive
(
:default_per_page
).
and_return
(
1
)
login_as
(
user
)
visit
dashboard_groups_path
end
it
'shows pagination'
do
expect
(
page
).
to
have_selector
(
'.gl-pagination'
)
expect
(
page
).
to
have_selector
(
'.gl-pagination .page'
,
count:
2
)
end
it
'loads results for next page'
do
# Check first page
expect
(
page
).
to
have_content
(
group2
.
full_name
)
expect
(
page
).
to
have_selector
(
"#group-
#{
group2
.
id
}
"
)
expect
(
page
).
not_to
have_content
(
group
.
full_name
)
expect
(
page
).
not_to
have_selector
(
"#group-
#{
group
.
id
}
"
)
# Go to next page
find
(
".gl-pagination .page:not(.active) a"
).
trigger
(
'click'
)
wait_for_requests
# Check second page
expect
(
page
).
to
have_content
(
group
.
full_name
)
expect
(
page
).
to
have_selector
(
"#group-
#{
group
.
id
}
"
)
expect
(
page
).
not_to
have_content
(
group2
.
full_name
)
expect
(
page
).
not_to
have_selector
(
"#group-
#{
group2
.
id
}
"
)
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment