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
Boxiang Sun
gitlab-ce
Commits
cec230bd
Commit
cec230bd
authored
Dec 27, 2016
by
Semyon Pupkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move admin groups spinach tests to rspec
https://gitlab.com/gitlab-org/gitlab-ce/issues/23036
parent
645412b5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
198 deletions
+111
-198
features/admin/groups.feature
features/admin/groups.feature
+0
-49
features/steps/admin/groups.rb
features/steps/admin/groups.rb
+0
-143
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+0
-4
spec/features/admin/admin_groups_spec.rb
spec/features/admin/admin_groups_spec.rb
+111
-2
No files found.
features/admin/groups.feature
deleted
100644 → 0
View file @
645412b5
@admin
Feature
:
Admin Groups
Background
:
Given
I sign in as an admin
And
I have group with projects
And
User
"John Doe"
exists
And
I visit admin groups page
Scenario
:
See group list
Then
I should be all groups
Scenario
:
Create a group
When
I click new group link
And
submit form with new group info
Then
I should be redirected to group page
And
I should see newly created group
@javascript
Scenario
:
Add user into projects in group
When
I visit admin group page
When
I select user
"John Doe"
from user list as
"Reporter"
Then
I should see
"John Doe"
in team list in every project as
"Reporter"
Scenario
:
Shared projects
Given
group has shared projects
When
I visit group page
Then
I should see project shared with group
@javascript
Scenario
:
Invite user to a group by e-mail
When
I visit admin group page
When
I select user
"johndoe@gitlab.com"
from user list as
"Reporter"
Then
I should see
"johndoe@gitlab.com"
in team list in every project as
"Reporter"
@javascript
Scenario
:
Signed in admin should be able to add himself to a group
Given
"John Doe"
is owner of group
"Owned"
When
I visit group
"Owned"
members page
When
I select current user as
"Developer"
Then
I should see current user as
"Developer"
@javascript
Scenario
:
Signed in admin should be able to remove himself from group
Given
current user is developer of group
"Owned"
When
I visit group
"Owned"
members page
Then
I should see current user as
"Developer"
When
I click on the
"Remove User From Group"
button for current user
When
I visit group
"Owned"
members page
Then
I should not see current user as
"Developer"
features/steps/admin/groups.rb
deleted
100644 → 0
View file @
645412b5
class
Spinach::Features::AdminGroups
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedGroup
include
SharedPaths
include
SharedUser
include
SharedActiveTab
include
Select2Helper
When
'I visit admin group page'
do
visit
admin_group_path
(
current_group
)
end
When
'I click new group link'
do
click_link
"New Group"
end
step
'I have group with projects'
do
@group
=
create
(
:group
)
@project
=
create
(
:project
,
group:
@group
)
@event
=
create
(
:closed_issue_event
,
project:
@project
)
@project
.
team
<<
[
current_user
,
:master
]
end
step
'submit form with new group info'
do
fill_in
'group_path'
,
with:
'gitlab'
fill_in
'group_description'
,
with:
'Group description'
click_button
"Create group"
end
step
'I should see newly created group'
do
expect
(
page
).
to
have_content
"Group: gitlab"
expect
(
page
).
to
have_content
"Group description"
end
step
'I should be redirected to group page'
do
expect
(
current_path
).
to
eq
admin_group_path
(
Group
.
find_by
(
path:
'gitlab'
))
end
When
'I select user "John Doe" from user list as "Reporter"'
do
select2
(
user_john
.
id
,
from:
"#user_ids"
,
multiple:
true
)
page
.
within
"#new_project_member"
do
select
"Reporter"
,
from:
"access_level"
end
click_button
"Add users to group"
end
When
'I select user "johndoe@gitlab.com" from user list as "Reporter"'
do
select2
(
'johndoe@gitlab.com'
,
from:
"#user_ids"
,
multiple:
true
)
page
.
within
"#new_project_member"
do
select
"Reporter"
,
from:
"access_level"
end
click_button
"Add users to group"
end
step
'I should see "John Doe" in team list in every project as "Reporter"'
do
page
.
within
".group-users-list"
do
expect
(
page
).
to
have_content
"John Doe"
expect
(
page
).
to
have_content
"Reporter"
end
end
step
'I should see "johndoe@gitlab.com" in team list in every project as "Reporter"'
do
page
.
within
".group-users-list"
do
expect
(
page
).
to
have_content
"johndoe@gitlab.com"
expect
(
page
).
to
have_content
"Invited by"
expect
(
page
).
to
have_content
"Reporter"
end
end
step
'I should be all groups'
do
Group
.
all
.
each
do
|
group
|
expect
(
page
).
to
have_content
group
.
name
end
end
step
'group has shared projects'
do
share_link
=
shared_project
.
project_group_links
.
new
(
group_access:
Gitlab
::
Access
::
MASTER
)
share_link
.
group_id
=
current_group
.
id
share_link
.
save!
end
step
'I visit group page'
do
visit
admin_group_path
(
current_group
)
end
step
'I should see project shared with group'
do
expect
(
page
).
to
have_content
(
shared_project
.
name_with_namespace
)
expect
(
page
).
to
have_content
"Projects shared with"
end
step
'we have user "John Doe" in group'
do
current_group
.
add_reporter
(
user_john
)
end
step
'I should not see "John Doe" in team list'
do
page
.
within
".group-users-list"
do
expect
(
page
).
not_to
have_content
"John Doe"
end
end
step
'I select current user as "Developer"'
do
page
.
within
".users-group-form"
do
select2
(
current_user
.
id
,
from:
"#user_ids"
,
multiple:
true
)
select
"Developer"
,
from:
"access_level"
end
click_button
"Add to group"
end
step
'I should see current user as "Developer"'
do
page
.
within
'.content-list'
do
expect
(
page
).
to
have_content
(
current_user
.
name
)
expect
(
page
).
to
have_content
(
'Developer'
)
end
end
step
'I click on the "Remove User From Group" button for current user'
do
find
(
:css
,
'li'
,
text:
current_user
.
name
).
find
(
:css
,
'a.btn-remove'
).
click
# poltergeist always confirms popups.
end
step
'I should not see current user as "Developer"'
do
page
.
within
'.content-list'
do
expect
(
page
).
not_to
have_content
(
current_user
.
name
)
expect
(
page
).
not_to
have_content
(
'Developer'
)
end
end
protected
def
current_group
@group
||=
Group
.
first
end
def
shared_project
@shared_project
||=
create
(
:empty_project
)
end
def
user_john
@user_john
||=
User
.
find_by
(
name:
"John Doe"
)
end
end
features/steps/shared/paths.rb
View file @
cec230bd
...
...
@@ -191,10 +191,6 @@ module SharedPaths
visit
admin_background_jobs_path
end
step
'I visit admin groups page'
do
visit
admin_groups_path
end
step
'I visit admin teams page'
do
visit
admin_teams_path
end
...
...
spec/features/admin/admin_groups_spec.rb
View file @
cec230bd
require
'spec_helper'
feature
'Admin Groups'
,
feature:
true
do
include
Select2Helper
let
(
:internal
)
{
Gitlab
::
VisibilityLevel
::
INTERNAL
}
let
(
:user
)
{
create
:user
}
let!
(
:group
)
{
create
:group
}
let!
(
:current_user
)
{
login_as
:admin
}
before
do
login_as
(
:admin
)
stub_application_setting
(
default_group_visibility:
internal
)
end
describe
'list'
do
it
'renders groups'
do
visit
admin_groups_path
expect
(
page
).
to
have_content
(
group
.
name
)
end
end
describe
'create a group'
do
it
'creates new group'
do
visit
admin_groups_path
click_link
"New Group"
fill_in
'group_path'
,
with:
'gitlab'
fill_in
'group_description'
,
with:
'Group description'
click_button
"Create group"
expect
(
current_path
).
to
eq
admin_group_path
(
Group
.
find_by
(
path:
'gitlab'
))
expect
(
page
).
to
have_content
(
'Group: gitlab'
)
expect
(
page
).
to
have_content
(
'Group description'
)
end
scenario
'shows the visibility level radio populated with the default value'
do
visit
new_admin_group_path
...
...
@@ -27,6 +51,91 @@ feature 'Admin Groups', feature: true do
end
end
describe
'add user into a group'
,
js:
true
do
shared_context
'adds user into a group'
do
it
do
visit
admin_group_path
(
group
)
select2
(
user_selector
,
from:
'#user_ids'
,
multiple:
true
)
page
.
within
'#new_project_member'
do
select2
(
Gitlab
::
Access
::
REPORTER
,
from:
'#access_level'
)
end
click_button
"Add users to group"
page
.
within
".group-users-list"
do
expect
(
page
).
to
have_content
(
user
.
name
)
expect
(
page
).
to
have_content
(
'Reporter'
)
end
end
end
it_behaves_like
'adds user into a group'
do
let
(
:user_selector
)
{
user
.
id
}
end
it_behaves_like
'adds user into a group'
do
let
(
:user_selector
)
{
user
.
email
}
end
end
describe
'add admin himself to a group'
do
before
do
group
.
add_user
(
:user
,
Gitlab
::
Access
::
OWNER
)
end
it
'adds admin a to a group as developer'
,
js:
true
do
visit
group_group_members_path
(
group
)
page
.
within
'.users-group-form'
do
select2
(
current_user
.
id
,
from:
'#user_ids'
,
multiple:
true
)
select
'Developer'
,
from:
'access_level'
end
click_button
'Add to group'
page
.
within
'.content-list'
do
expect
(
page
).
to
have_content
(
current_user
.
name
)
expect
(
page
).
to
have_content
(
'Developer'
)
end
end
end
describe
'admin remove himself from a group'
,
js:
true
do
it
'removes admin from the group'
do
group
.
add_user
(
current_user
,
Gitlab
::
Access
::
DEVELOPER
)
visit
group_group_members_path
(
group
)
page
.
within
'.content-list'
do
expect
(
page
).
to
have_content
(
current_user
.
name
)
expect
(
page
).
to
have_content
(
'Developer'
)
end
find
(
:css
,
'li'
,
text:
current_user
.
name
).
find
(
:css
,
'a.btn-remove'
).
click
visit
group_group_members_path
(
group
)
page
.
within
'.content-list'
do
expect
(
page
).
not_to
have_content
(
current_user
.
name
)
expect
(
page
).
not_to
have_content
(
'Developer'
)
end
end
end
describe
'shared projects'
do
it
'renders shared project'
do
empty_project
=
create
(
:empty_project
)
empty_project
.
project_group_links
.
create!
(
group_access:
Gitlab
::
Access
::
MASTER
,
group:
group
)
visit
admin_group_path
(
group
)
expect
(
page
).
to
have_content
(
empty_project
.
name_with_namespace
)
expect
(
page
).
to
have_content
(
'Projects shared with'
)
end
end
def
expect_selected_visibility
(
level
)
selector
=
"#group_visibility_level_
#{
level
}
[checked=checked]"
...
...
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