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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
8fadde83
Commit
8fadde83
authored
Feb 09, 2021
by
Peter Hegman
Committed by
Etienne Baqué
Feb 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update feature specs for new project members view
Behind the `vue_project_members_list` feature flag
parent
5c5650e9
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1194 additions
and
428 deletions
+1194
-428
ee/spec/features/projects/audit_events_spec.rb
ee/spec/features/projects/audit_events_spec.rb
+45
-17
ee/spec/features/projects/members/invite_group_and_members_spec.rb
...eatures/projects/members/invite_group_and_members_spec.rb
+34
-10
ee/spec/features/projects/members/member_is_removed_from_project_spec.rb
...s/projects/members/member_is_removed_from_project_spec.rb
+56
-15
spec/features/admin/admin_projects_spec.rb
spec/features/admin/admin_projects_spec.rb
+76
-26
spec/features/projects/members/anonymous_user_sees_members_spec.rb
...ures/projects/members/anonymous_user_sees_members_spec.rb
+21
-7
spec/features/projects/members/group_members_spec.rb
spec/features/projects/members/group_members_spec.rb
+173
-72
spec/features/projects/members/groups_with_access_list_spec.rb
...features/projects/members/groups_with_access_list_spec.rb
+134
-48
spec/features/projects/members/invite_group_spec.rb
spec/features/projects/members/invite_group_spec.rb
+62
-21
spec/features/projects/members/list_spec.rb
spec/features/projects/members/list_spec.rb
+164
-60
spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb
...s/members/master_adds_member_with_expiration_date_spec.rb
+84
-29
spec/features/projects/members/sorting_spec.rb
spec/features/projects/members/sorting_spec.rb
+152
-54
spec/features/projects/members/tabs_spec.rb
spec/features/projects/members/tabs_spec.rb
+69
-31
spec/features/projects/settings/user_manages_project_members_spec.rb
...es/projects/settings/user_manages_project_members_spec.rb
+98
-38
spec/support/helpers/features/members_table_helpers.rb
spec/support/helpers/features/members_table_helpers.rb
+26
-0
No files found.
ee/spec/features/projects/audit_events_spec.rb
View file @
8fadde83
...
@@ -3,13 +3,13 @@
...
@@ -3,13 +3,13 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
'Projects > Audit Events'
,
:js
do
RSpec
.
describe
'Projects > Audit Events'
,
:js
do
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:pete
)
{
create
(
:user
,
name:
'Pete'
)
}
let
(
:pete
)
{
create
(
:user
,
name:
'Pete'
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
}
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
}
before
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
sign_in
(
user
)
sign_in
(
user
)
end
end
...
@@ -109,25 +109,53 @@ RSpec.describe 'Projects > Audit Events', :js do
...
@@ -109,25 +109,53 @@ RSpec.describe 'Projects > Audit Events', :js do
project
.
add_developer
(
pete
)
project
.
add_developer
(
pete
)
end
end
it
"appears in the project's audit events"
do
context
'when `vue_project_members_list` feature flag is enabled'
do
visit
project_project_members_path
(
project
)
it
"appears in the project's audit events"
do
visit
project_project_members_path
(
project
)
project_member
=
project
.
project_member
(
pete
)
page
.
within
find_member_row
(
pete
)
do
page
.
within
"#project_member_
#{
project_member
.
id
}
"
do
click_button
'Developer'
click_button
'Developer'
click_button
'Maintainer'
click_link
'Maintainer'
end
page
.
within
(
'.qa-project-sidebar'
)
do
find
(
:link
,
text:
'Security & Compliance'
).
click
click_link
'Audit Events'
end
page
.
within
(
'.audit-log-table'
)
do
expect
(
page
).
to
have_content
'Changed access level from Developer to Maintainer'
expect
(
page
).
to
have_content
(
project
.
owner
.
name
)
expect
(
page
).
to
have_content
(
'Pete'
)
end
end
end
end
page
.
within
(
'.qa-project-sidebar'
)
do
context
'when `vue_project_members_list` feature flag is disabled'
do
find
(
:link
,
text:
'Security & Compliance'
).
click
before
do
click_link
'Audit Events'
stub_feature_flags
(
vue_project_members_list:
false
)
end
end
page
.
within
(
'.audit-log-table'
)
do
it
"appears in the project's audit events"
do
expect
(
page
).
to
have_content
'Changed access level from Developer to Maintainer'
visit
project_project_members_path
(
project
)
expect
(
page
).
to
have_content
(
project
.
owner
.
name
)
expect
(
page
).
to
have_content
(
'Pete'
)
project_member
=
project
.
project_member
(
pete
)
page
.
within
"#project_member_
#{
project_member
.
id
}
"
do
click_button
'Developer'
click_link
'Maintainer'
end
page
.
within
(
'.qa-project-sidebar'
)
do
find
(
:link
,
text:
'Security & Compliance'
).
click
click_link
'Audit Events'
end
page
.
within
(
'.audit-log-table'
)
do
expect
(
page
).
to
have_content
'Changed access level from Developer to Maintainer'
expect
(
page
).
to
have_content
(
project
.
owner
.
name
)
expect
(
page
).
to
have_content
(
'Pete'
)
end
end
end
end
end
end
end
...
...
ee/spec/features/projects/members/invite_group_and_members_spec.rb
View file @
8fadde83
...
@@ -5,12 +5,12 @@ require 'spec_helper'
...
@@ -5,12 +5,12 @@ require 'spec_helper'
RSpec
.
describe
'Project > Members > Invite group and members'
,
:js
do
RSpec
.
describe
'Project > Members > Invite group and members'
,
:js
do
include
Select2Helper
include
Select2Helper
include
ActionView
::
Helpers
::
DateHelper
include
ActionView
::
Helpers
::
DateHelper
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
let
(
:maintainer
)
{
create
(
:user
)
}
let
(
:maintainer
)
{
create
(
:user
)
}
before
do
before
do
stub_feature_flags
(
invite_members_group_modal:
false
)
stub_feature_flags
(
invite_members_group_modal:
false
)
stub_feature_flags
(
vue_project_members_list:
false
)
end
end
describe
'Share group lock'
do
describe
'Share group lock'
do
...
@@ -71,19 +71,43 @@ RSpec.describe 'Project > Members > Invite group and members', :js do
...
@@ -71,19 +71,43 @@ RSpec.describe 'Project > Members > Invite group and members', :js do
context
'when the group has "Share with group lock" and "Member lock" disabled'
do
context
'when the group has "Share with group lock" and "Member lock" disabled'
do
it_behaves_like
'the project can be shared with groups and members'
it_behaves_like
'the project can be shared with groups and members'
it
'the project can be shared with another group'
do
context
'when `vue_project_members_list` feature flag is enabled'
do
visit
project_project_members_path
(
project
)
it
'allows the project to be shared with another group'
do
visit
project_project_members_path
(
project
)
click_on
'invite-group-tab'
click_on
'invite-group-tab'
select2
group_to_share_with
.
id
,
from:
'#link_group_id'
select2
group_to_share_with
.
id
,
from:
'#link_group_id'
page
.
find
(
'body'
).
click
page
.
find
(
'body'
).
click
find
(
'.btn-success'
).
click
find
(
'.btn-success'
).
click
click_link
'Groups'
click_link
'Groups'
page
.
within
(
'[data-testid="project-member-groups"]'
)
do
page
.
within
(
members_table
)
do
expect
(
page
).
to
have_content
(
group_to_share_with
.
name
)
expect
(
page
).
to
have_content
(
group_to_share_with
.
name
)
end
end
end
context
'when `vue_project_members_list` feature flag is disabled'
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
end
it
'allows the project to be shared with another group'
do
visit
project_project_members_path
(
project
)
click_on
'invite-group-tab'
select2
group_to_share_with
.
id
,
from:
'#link_group_id'
page
.
find
(
'body'
).
click
find
(
'.btn-success'
).
click
click_link
'Groups'
page
.
within
(
'[data-testid="project-member-groups"]'
)
do
expect
(
page
).
to
have_content
(
group_to_share_with
.
name
)
end
end
end
end
end
end
end
...
...
ee/spec/features/projects/members/member_is_removed_from_project_spec.rb
View file @
8fadde83
...
@@ -8,32 +8,73 @@ RSpec.describe 'Projects > Members > Member is removed from project' do
...
@@ -8,32 +8,73 @@ RSpec.describe 'Projects > Members > Member is removed from project' do
let
(
:other_user
)
{
create
(
:user
)
}
let
(
:other_user
)
{
create
(
:user
)
}
before
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
other_user
)
project
.
add_maintainer
(
other_user
)
sign_in
(
user
)
visit
project_project_members_path
(
project
)
end
end
it
'user is removed from project'
do
context
'when `vue_project_members_list` feature flag is enabled'
,
:js
do
click_link
'Leave'
before
do
sign_in
(
user
)
visit
project_project_members_path
(
project
)
end
it
'user is removed from project'
do
click_button
'Leave'
page
.
within
(
'[role="dialog"]'
)
do
click_button
(
'Leave'
)
end
expect
(
project
.
users
.
exists?
(
user
.
id
)).
to
be_falsey
end
context
'when the user has been specifically allowed to access a protected branch'
do
let!
(
:matching_protected_branch
)
{
create
(
:protected_branch
,
authorize_user_to_push:
user
,
authorize_user_to_merge:
user
,
project:
project
)
}
let!
(
:non_matching_protected_branch
)
{
create
(
:protected_branch
,
authorize_user_to_push:
other_user
,
authorize_user_to_merge:
other_user
,
project:
project
)
}
it
'user leaves project'
do
click_button
'Leave'
expect
(
project
.
users
.
exists?
(
user
.
id
)).
to
be_falsey
page
.
within
(
'[role="dialog"]'
)
do
click_button
(
'Leave'
)
end
expect
(
project
.
users
.
exists?
(
user
.
id
)).
to
be_falsey
expect
(
matching_protected_branch
.
push_access_levels
.
where
(
user:
user
)).
not_to
exist
expect
(
matching_protected_branch
.
merge_access_levels
.
where
(
user:
user
)).
not_to
exist
expect
(
non_matching_protected_branch
.
push_access_levels
.
where
(
user:
other_user
)).
to
exist
expect
(
non_matching_protected_branch
.
merge_access_levels
.
where
(
user:
other_user
)).
to
exist
end
end
end
end
context
'when the user has been specifically allowed to access a protected branch'
do
context
'when `vue_project_members_list` feature flag is disabled'
do
let!
(
:matching_protected_branch
)
{
create
(
:protected_branch
,
authorize_user_to_push:
user
,
authorize_user_to_merge:
user
,
project:
project
)
}
before
do
let!
(
:non_matching_protected_branch
)
{
create
(
:protected_branch
,
authorize_user_to_push:
other_user
,
authorize_user_to_merge:
other_user
,
project:
project
)
}
stub_feature_flags
(
vue_project_members_list:
false
)
sign_in
(
user
)
visit
project_project_members_path
(
project
)
end
it
'user
leaves
project'
do
it
'user
is removed from
project'
do
click_link
'Leave'
click_link
'Leave'
expect
(
project
.
users
.
exists?
(
user
.
id
)).
to
be_falsey
expect
(
project
.
users
.
exists?
(
user
.
id
)).
to
be_falsey
expect
(
matching_protected_branch
.
push_access_levels
.
where
(
user:
user
)).
not_to
exist
end
expect
(
matching_protected_branch
.
merge_access_levels
.
where
(
user:
user
)).
not_to
exist
expect
(
non_matching_protected_branch
.
push_access_levels
.
where
(
user:
other_user
)).
to
exist
context
'when the user has been specifically allowed to access a protected branch'
do
expect
(
non_matching_protected_branch
.
merge_access_levels
.
where
(
user:
other_user
)).
to
exist
let!
(
:matching_protected_branch
)
{
create
(
:protected_branch
,
authorize_user_to_push:
user
,
authorize_user_to_merge:
user
,
project:
project
)
}
let!
(
:non_matching_protected_branch
)
{
create
(
:protected_branch
,
authorize_user_to_push:
other_user
,
authorize_user_to_merge:
other_user
,
project:
project
)
}
it
'user leaves project'
do
click_link
'Leave'
expect
(
project
.
users
.
exists?
(
user
.
id
)).
to
be_falsey
expect
(
matching_protected_branch
.
push_access_levels
.
where
(
user:
user
)).
not_to
exist
expect
(
matching_protected_branch
.
merge_access_levels
.
where
(
user:
user
)).
not_to
exist
expect
(
non_matching_protected_branch
.
push_access_levels
.
where
(
user:
other_user
)).
to
exist
expect
(
non_matching_protected_branch
.
merge_access_levels
.
where
(
user:
other_user
)).
to
exist
end
end
end
end
end
end
end
spec/features/admin/admin_projects_spec.rb
View file @
8fadde83
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
"Admin::Projects"
do
RSpec
.
describe
"Admin::Projects"
do
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
include
Select2Helper
include
Select2Helper
let
(
:user
)
{
create
:user
}
let
(
:user
)
{
create
:user
}
...
@@ -10,8 +11,6 @@ RSpec.describe "Admin::Projects" do
...
@@ -10,8 +11,6 @@ RSpec.describe "Admin::Projects" do
let
(
:current_user
)
{
create
(
:admin
)
}
let
(
:current_user
)
{
create
(
:admin
)
}
before
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
sign_in
(
current_user
)
sign_in
(
current_user
)
gitlab_enable_admin_mode_sign_in
(
current_user
)
gitlab_enable_admin_mode_sign_in
(
current_user
)
end
end
...
@@ -93,46 +92,97 @@ RSpec.describe "Admin::Projects" do
...
@@ -93,46 +92,97 @@ RSpec.describe "Admin::Projects" do
end
end
end
end
describe
'add admin himself to a project'
do
context
'when `vue_project_members_list` feature flag is enabled'
,
:js
do
before
do
describe
'admin adds themselves to the project'
do
project
.
add_maintainer
(
user
)
before
do
stub_feature_flags
(
invite_members_group_modal:
false
)
project
.
add_maintainer
(
user
)
end
stub_feature_flags
(
invite_members_group_modal:
false
)
end
it
'adds admin to the project as developer'
,
:js
do
visit
project_project_members_path
(
project
)
page
.
within
'.invite-users-form'
do
select2
(
current_user
.
id
,
from:
'#user_ids'
,
multiple:
true
)
select
'Developer'
,
from:
'access_level'
end
it
'adds admin a to a project as developer'
,
:js
do
click_button
'Invite'
visit
project_project_members_path
(
project
)
page
.
within
'.invite-users-form'
do
expect
(
find_member_row
(
current_user
)).
to
have_content
(
'Developer'
)
select2
(
current_user
.
id
,
from:
'#user_ids'
,
multiple:
true
)
select
'Developer'
,
from:
'access_level'
end
end
end
describe
'admin removes themselves from the project'
do
before
do
project
.
add_maintainer
(
user
)
project
.
add_developer
(
current_user
)
end
it
'removes admin from the project'
do
visit
project_project_members_path
(
project
)
expect
(
find_member_row
(
current_user
)).
to
have_content
(
'Developer'
)
click_button
'Invite'
page
.
within
find_member_row
(
current_user
)
do
click_button
'Leave'
end
page
.
within
'.content-list'
do
page
.
within
(
'[role="dialog"]'
)
do
expect
(
page
).
to
have_content
(
current_user
.
name
)
click_button
(
'Leave'
)
expect
(
page
).
to
have_content
(
'Developer'
)
end
expect
(
current_path
).
to
match
dashboard_projects_path
end
end
end
end
end
end
describe
'admin remove himself from a project
'
do
context
'when `vue_project_members_list` feature flag is disabled
'
do
before
do
before
do
project
.
add_maintainer
(
user
)
stub_feature_flags
(
vue_project_members_list:
false
)
project
.
add_developer
(
current_user
)
end
end
it
'removes admin from the project'
do
describe
'admin adds themselves to the project'
do
visit
project_project_members_path
(
project
)
before
do
project
.
add_maintainer
(
user
)
stub_feature_flags
(
invite_members_group_modal:
false
)
end
it
'adds admin to the project as developer'
,
:js
do
visit
project_project_members_path
(
project
)
page
.
within
'.content-list'
do
page
.
within
'.invite-users-form'
do
expect
(
page
).
to
have_content
(
current_user
.
name
)
select2
(
current_user
.
id
,
from:
'#user_ids'
,
multiple:
true
)
expect
(
page
).
to
have_content
(
'Developer'
)
select
'Developer'
,
from:
'access_level'
end
click_button
'Invite'
page
.
within
'.content-list'
do
expect
(
page
).
to
have_content
(
current_user
.
name
)
expect
(
page
).
to
have_content
(
'Developer'
)
end
end
end
end
find
(
:css
,
'.content-list li'
,
text:
current_user
.
name
).
find
(
:css
,
'a.btn-danger'
).
click
describe
'admin removes themselves from the project'
do
before
do
project
.
add_maintainer
(
user
)
project
.
add_developer
(
current_user
)
end
it
'removes admin from the project'
do
visit
project_project_members_path
(
project
)
page
.
within
'.content-list'
do
expect
(
page
).
to
have_content
(
current_user
.
name
)
expect
(
page
).
to
have_content
(
'Developer'
)
end
expect
(
page
).
not_to
have_selector
(
:css
,
'.content-list'
)
find
(
:css
,
'.content-list li'
,
text:
current_user
.
name
).
find
(
:css
,
'a.btn-danger'
).
click
expect
(
page
).
not_to
have_selector
(
:css
,
'.content-list'
)
end
end
end
end
end
end
end
spec/features/projects/members/anonymous_user_sees_members_spec.rb
View file @
8fadde83
...
@@ -3,22 +3,36 @@
...
@@ -3,22 +3,36 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
'Projects > Members > Anonymous user sees members'
do
RSpec
.
describe
'Projects > Members > Anonymous user sees members'
do
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
before
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
create
(
:project_group_link
,
project:
project
,
group:
group
)
create
(
:project_group_link
,
project:
project
,
group:
group
)
end
end
it
"anonymous user visits the project's members page and sees the list of members"
do
context
'when `vue_project_members_list` feature flag is enabled'
,
:js
do
visit
project_project_members_path
(
project
)
it
"anonymous user visits the project's members page and sees the list of members"
do
visit
project_project_members_path
(
project
)
expect
(
find_member_row
(
user
)).
to
have_content
(
user
.
name
)
end
end
context
'when `vue_project_members_list` feature flag is disabled'
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
end
it
"anonymous user visits the project's members page and sees the list of members"
do
visit
project_project_members_path
(
project
)
expect
(
current_path
).
to
eq
(
expect
(
current_path
).
to
eq
(
project_project_members_path
(
project
))
project_project_members_path
(
project
))
expect
(
page
).
to
have_content
(
user
.
name
)
expect
(
page
).
to
have_content
(
user
.
name
)
end
end
end
end
end
spec/features/projects/members/group_members_spec.rb
View file @
8fadde83
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
'Projects members'
,
:js
do
RSpec
.
describe
'Projects members'
,
:js
do
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:developer
)
{
create
(
:user
)
}
let
(
:developer
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
...
@@ -13,124 +15,223 @@ RSpec.describe 'Projects members', :js do
...
@@ -13,124 +15,223 @@ RSpec.describe 'Projects members', :js do
let
(
:group_requester
)
{
create
(
:user
)
}
let
(
:group_requester
)
{
create
(
:user
)
}
before
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
project
.
add_developer
(
developer
)
project
.
add_developer
(
developer
)
group
.
add_owner
(
user
)
group
.
add_owner
(
user
)
sign_in
(
user
)
sign_in
(
user
)
end
end
context
'with a group invitee'
do
context
'when `vue_project_members_list` feature flag is enabled'
do
before
do
context
'with a group invitee'
do
group_invitee
before
do
visit
project_project_members_path
(
project
)
group_invitee
end
visit
project_project_members_path
(
project
)
end
it
'does not appear in the project members page'
do
it
'does not appear in the project members page'
do
page
.
within
first
(
'.content-list'
)
do
expect
(
members_table
).
not_to
have_content
(
'test2@abc.com'
)
expect
(
page
).
not_to
have_content
(
'test2@abc.com'
)
end
end
end
end
end
context
'with a group'
do
context
'with a group'
do
it
'shows group and project members by default'
do
it
'shows group and project members by default'
do
visit
project_project_members_path
(
project
)
visit
project_project_members_path
(
project
)
page
.
within
first
(
'.content-list'
)
do
expect
(
members_table
).
to
have_content
(
developer
.
name
)
expect
(
page
).
to
have_content
(
developer
.
name
)
expect
(
members_table
).
to
have_content
(
user
.
name
)
expect
(
members_table
).
to
have_content
(
group
.
name
)
end
expect
(
page
).
to
have_content
(
user
.
name
)
it
'shows project members only if requested'
do
expect
(
page
).
to
have_content
(
group
.
name
)
visit
project_project_members_path
(
project
,
with_inherited_permissions:
'exclude'
)
expect
(
members_table
).
to
have_content
(
developer
.
name
)
expect
(
members_table
).
not_to
have_content
(
user
.
name
)
expect
(
members_table
).
not_to
have_content
(
group
.
name
)
end
it
'shows group members only if requested'
do
visit
project_project_members_path
(
project
,
with_inherited_permissions:
'only'
)
expect
(
members_table
).
not_to
have_content
(
developer
.
name
)
expect
(
members_table
).
to
have_content
(
user
.
name
)
expect
(
members_table
).
to
have_content
(
group
.
name
)
end
end
end
end
it
'shows project members only if requested'
do
context
'with a group, a project invitee, and a project requester'
do
visit
project_project_members_path
(
project
,
with_inherited_permissions:
'exclude'
)
before
do
group
.
request_access
(
group_requester
)
project
.
request_access
(
project_requester
)
group_invitee
project_invitee
visit
project_project_members_path
(
project
)
end
page
.
within
first
(
'.content-list'
)
do
it
'shows the group owner'
do
expect
(
page
).
to
have_content
(
developer
.
name
)
expect
(
members_table
).
to
have_content
(
user
.
name
)
expect
(
members_table
).
to
have_content
(
group
.
name
)
end
expect
(
page
).
not_to
have_content
(
user
.
name
)
it
'shows the project developer'
do
expect
(
page
).
not_to
have_content
(
group
.
name
)
expect
(
members_table
).
to
have_content
(
developer
.
name
)
end
it
'shows the project invitee'
do
click_link
'Invited'
expect
(
members_table
).
to
have_content
(
'test1@abc.com'
)
expect
(
members_table
).
not_to
have_content
(
'test2@abc.com'
)
end
it
'shows the project requester'
do
click_link
'Access requests'
expect
(
members_table
).
to
have_content
(
project_requester
.
name
)
expect
(
members_table
).
not_to
have_content
(
group_requester
.
name
)
end
end
end
end
it
'shows group members only if requested'
do
context
'with a group requester'
do
visit
project_project_members_path
(
project
,
with_inherited_permissions:
'only'
)
before
do
stub_feature_flags
(
invite_members_group_modal:
false
)
group
.
request_access
(
group_requester
)
visit
project_project_members_path
(
project
)
end
it
'does not appear in the project members page'
do
expect
(
page
).
not_to
have_link
(
'Access requests'
)
expect
(
members_table
).
not_to
have_content
(
group_requester
.
name
)
end
end
context
'showing status of members'
do
it
'shows the status'
do
create
(
:user_status
,
user:
user
,
emoji:
'smirk'
,
message:
'Authoring this object'
)
page
.
within
first
(
'.content-list'
)
do
visit
project_project_members_path
(
project
)
expect
(
page
).
not_to
have_content
(
developer
.
name
)
expect
(
page
).
to
have_content
(
user
.
name
)
expect
(
first_row
).
to
have_selector
(
'gl-emoji[data-name="smirk"]'
)
expect
(
page
).
to
have_content
(
group
.
name
)
end
end
end
end
end
end
context
'w
ith a group, a project invitee, and a project requester
'
do
context
'w
hen `vue_project_members_list` feature flag is disabled
'
do
before
do
before
do
group
.
request_access
(
group_requester
)
stub_feature_flags
(
vue_project_members_list:
false
)
project
.
request_access
(
project_requester
)
group_invitee
project_invitee
visit
project_project_members_path
(
project
)
end
end
it
'shows the group owner'
do
context
'with a group invitee'
do
page
.
within
first
(
'.content-list'
)
do
before
do
# Group owner
group_invitee
expect
(
page
).
to
have_content
(
user
.
name
)
visit
project_project_members_path
(
project
)
expect
(
page
).
to
have_content
(
group
.
name
)
end
end
end
it
'shows the project developer
'
do
it
'does not appear in the project members page
'
do
page
.
within
first
(
'.content-list'
)
do
page
.
within
first
(
'.content-list'
)
do
# Project developer
expect
(
page
).
not_to
have_content
(
'test2@abc.com'
)
e
xpect
(
page
).
to
have_content
(
developer
.
name
)
e
nd
end
end
end
end
it
'shows the project invitee'
do
context
'with a group'
do
click_link
'Invited'
it
'shows group and project members by default'
do
visit
project_project_members_path
(
project
)
page
.
within
first
(
'.content-list'
)
do
page
.
within
first
(
'.content-list'
)
do
expect
(
page
).
to
have_content
(
'test1@abc.com'
)
expect
(
page
).
to
have_content
(
developer
.
name
)
expect
(
page
).
not_to
have_content
(
'test2@abc.com'
)
expect
(
page
).
to
have_content
(
user
.
name
)
expect
(
page
).
to
have_content
(
group
.
name
)
end
end
it
'shows project members only if requested'
do
visit
project_project_members_path
(
project
,
with_inherited_permissions:
'exclude'
)
page
.
within
first
(
'.content-list'
)
do
expect
(
page
).
to
have_content
(
developer
.
name
)
expect
(
page
).
not_to
have_content
(
user
.
name
)
expect
(
page
).
not_to
have_content
(
group
.
name
)
end
end
end
end
it
'shows the project requester
'
do
it
'shows group members only if requested
'
do
click_link
'Access requests'
visit
project_project_members_path
(
project
,
with_inherited_permissions:
'only'
)
page
.
within
first
(
'.content-list'
)
do
page
.
within
first
(
'.content-list'
)
do
expect
(
page
).
to
have_content
(
project_requester
.
name
)
expect
(
page
).
not_to
have_content
(
developer
.
name
)
expect
(
page
).
not_to
have_content
(
group_requester
.
name
)
expect
(
page
).
to
have_content
(
user
.
name
)
expect
(
page
).
to
have_content
(
group
.
name
)
end
end
end
end
end
end
context
'with a group requester'
do
context
'with a group, a project invitee, and a project requester'
do
before
do
before
do
stub_feature_flags
(
invite_members_group_modal:
false
)
group
.
request_access
(
group_requester
)
group
.
request_access
(
group_requester
)
project
.
request_access
(
project_requester
)
visit
project_project_members_path
(
project
)
group_invitee
project_invitee
visit
project_project_members_path
(
project
)
end
it
'shows the group owner'
do
page
.
within
first
(
'.content-list'
)
do
# Group owner
expect
(
page
).
to
have_content
(
user
.
name
)
expect
(
page
).
to
have_content
(
group
.
name
)
end
end
it
'shows the project developer'
do
page
.
within
first
(
'.content-list'
)
do
# Project developer
expect
(
page
).
to
have_content
(
developer
.
name
)
end
end
it
'shows the project invitee'
do
click_link
'Invited'
page
.
within
first
(
'.content-list'
)
do
expect
(
page
).
to
have_content
(
'test1@abc.com'
)
expect
(
page
).
not_to
have_content
(
'test2@abc.com'
)
end
end
it
'shows the project requester'
do
click_link
'Access requests'
page
.
within
first
(
'.content-list'
)
do
expect
(
page
).
to
have_content
(
project_requester
.
name
)
expect
(
page
).
not_to
have_content
(
group_requester
.
name
)
end
end
end
end
it
'does not appear in the project members page'
do
context
'with a group requester'
do
expect
(
page
).
not_to
have_link
(
'Access requests'
)
before
do
page
.
within
first
(
'.content-list'
)
do
stub_feature_flags
(
invite_members_group_modal:
false
)
expect
(
page
).
not_to
have_content
(
group_requester
.
name
)
group
.
request_access
(
group_requester
)
visit
project_project_members_path
(
project
)
end
it
'does not appear in the project members page'
do
expect
(
page
).
not_to
have_link
(
'Access requests'
)
page
.
within
first
(
'.content-list'
)
do
expect
(
page
).
not_to
have_content
(
group_requester
.
name
)
end
end
end
end
end
end
describe
'showing status of members'
do
context
'showing status of members'
do
it_behaves_like
'showing user status'
do
it_behaves_like
'showing user status'
do
let
(
:user_with_status
)
{
developer
}
let
(
:user_with_status
)
{
developer
}
subject
{
visit
project_project_members_path
(
project
)
}
subject
{
visit
project_project_members_path
(
project
)
}
end
end
end
end
end
end
end
spec/features/projects/members/groups_with_access_list_spec.rb
View file @
8fadde83
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
'Projects > Members > Groups with access list'
,
:js
do
RSpec
.
describe
'Projects > Members > Groups with access list'
,
:js
do
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
,
:public
)
}
let_it_be
(
:group
)
{
create
(
:group
,
:public
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:public
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:public
)
}
...
@@ -11,92 +13,176 @@ RSpec.describe 'Projects > Members > Groups with access list', :js do
...
@@ -11,92 +13,176 @@ RSpec.describe 'Projects > Members > Groups with access list', :js do
let!
(
:group_link
)
{
create
(
:project_group_link
,
project:
project
,
group:
group
,
**
additional_link_attrs
)
}
let!
(
:group_link
)
{
create
(
:project_group_link
,
project:
project
,
group:
group
,
**
additional_link_attrs
)
}
before
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
travel_to
Time
.
now
.
utc
.
beginning_of_day
travel_to
Time
.
now
.
utc
.
beginning_of_day
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
sign_in
(
user
)
sign_in
(
user
)
visit
project_project_members_path
(
project
)
click_groups_tab
end
end
it
'updates group access level'
do
context
'when `vue_project_members_list` feature flag is enabled'
do
click_button
group_link
.
human_access
before
do
visit
project_project_members_path
(
project
)
page
.
within
'.dropdown-menu'
do
click_groups_tab
click_link
'Guest'
end
end
wait_for_requests
it
'updates group access level'
do
click_button
group_link
.
human_access
click_button
'Guest'
visit
project_project_members_path
(
project
)
wait_for_requests
click_groups_tab
visit
project_project_members_path
(
project
)
expect
(
first
(
'.group_member'
)).
to
have_content
(
'Guest'
)
click_groups_tab
end
expect
(
find_group_row
(
group
)).
to
have_content
(
'Guest'
)
end
it
'updates expiry date'
do
it
'updates expiry date'
do
expires_at_field
=
"member_expires_at_
#{
group
.
id
}
"
page
.
within
find_group_row
(
group
)
do
fill_in
expires_at_field
,
with:
3
.
days
.
from_now
.
to_date
fill_in
'Expiration date'
,
with:
5
.
days
.
from_now
.
to_date
find_field
(
'Expiration date'
).
native
.
send_keys
:enter
find_field
(
expires_at_field
).
native
.
send_keys
:enter
wait_for_requests
wait_for_requests
page
.
within
(
find
(
'li.group_member'
))
do
expect
(
page
).
to
have_content
(
/in \d days/
)
e
xpect
(
page
).
to
have_content
(
'Expires in 3 days'
)
e
nd
end
end
end
context
'when link has expiry date set'
do
context
'when link has expiry date set'
do
let
(
:additional_link_attrs
)
{
{
expires_at:
3
.
days
.
from_now
.
to_date
}
}
let
(
:additional_link_attrs
)
{
{
expires_at:
5
.
days
.
from_now
.
to_date
}
}
it
'clears expiry date'
do
it
'clears expiry date'
do
page
.
within
(
find
(
'li.group_member'
))
do
page
.
within
find_group_row
(
group
)
do
expect
(
page
).
to
have_content
(
'Expires in 3 days'
)
expect
(
page
).
to
have_content
(
/in \d days/
)
find
(
'[data-testid="clear-button"]'
).
click
page
.
within
(
find
(
'.js-edit-member-form'
))
do
wait_for_requests
find
(
'.js-clear-input'
).
click
expect
(
page
).
to
have_content
(
'No expiration set'
)
end
end
end
end
wait_for_requests
it
'deletes group link'
do
expect
(
page
).
to
have_content
(
group
.
full_name
)
page
.
within
find_group_row
(
group
)
do
click_button
'Remove group'
end
expect
(
page
).
not_to
have_content
(
'Expires in'
)
page
.
within
(
'[role="dialog"]'
)
do
click_button
(
'Remove group'
)
end
expect
(
page
).
not_to
have_content
(
group
.
full_name
)
end
context
'search in existing members'
do
it
'finds no results'
do
fill_in_filtered_search
'Search groups'
,
with:
'testing 123'
click_groups_tab
expect
(
page
).
not_to
have_content
(
group
.
full_name
)
end
it
'finds results'
do
fill_in_filtered_search
'Search groups'
,
with:
group
.
full_name
click_groups_tab
expect
(
members_table
).
to
have_content
(
group
.
full_name
)
end
end
end
end
end
end
it
'deletes group link'
do
context
'when `vue_project_members_list` feature flag is disabled'
do
page
.
within
(
first
(
'.group_member'
))
do
before
do
accept_confirm
{
find
(
'.btn-danger'
).
click
}
stub_feature_flags
(
vue_project_members_list:
false
)
visit
project_project_members_path
(
project
)
click_groups_tab
end
end
wait_for_requests
expect
(
page
).
not_to
have_selector
(
'.group_member'
)
it
'updates group access level'
do
end
click_button
group_link
.
human_access
context
'search in existing members'
do
page
.
within
'.dropdown-menu'
do
it
'finds no results'
do
click_link
'Guest'
page
.
within
'.user-search-form'
do
fill_in
'search_groups'
,
with:
'testing 123'
find
(
'.user-search-btn'
).
click
end
end
wait_for_requests
visit
project_project_members_path
(
project
)
click_groups_tab
click_groups_tab
expect
(
first
(
'.group_member'
)).
to
have_content
(
'Guest'
)
end
it
'updates expiry date'
do
expires_at_field
=
"member_expires_at_
#{
group
.
id
}
"
fill_in
expires_at_field
,
with:
3
.
days
.
from_now
.
to_date
find_field
(
expires_at_field
).
native
.
send_keys
:enter
wait_for_requests
page
.
within
(
find
(
'li.group_member'
))
do
expect
(
page
).
to
have_content
(
'Expires in 3 days'
)
end
end
context
'when link has expiry date set'
do
let
(
:additional_link_attrs
)
{
{
expires_at:
3
.
days
.
from_now
.
to_date
}
}
it
'clears expiry date'
do
page
.
within
(
find
(
'li.group_member'
))
do
expect
(
page
).
to
have_content
(
'Expires in 3 days'
)
page
.
within
(
find
(
'.js-edit-member-form'
))
do
find
(
'.js-clear-input'
).
click
end
wait_for_requests
expect
(
page
).
not_to
have_content
(
'Expires in'
)
end
end
end
it
'deletes group link'
do
page
.
within
(
first
(
'.group_member'
))
do
accept_confirm
{
find
(
'.btn-danger'
).
click
}
end
wait_for_requests
expect
(
page
).
not_to
have_selector
(
'.group_member'
)
expect
(
page
).
not_to
have_selector
(
'.group_member'
)
end
end
it
'finds results'
do
context
'search in existing members'
do
page
.
within
'.user-search-form'
do
it
'finds no results'
do
fill_in
'search_groups'
,
with:
group
.
name
page
.
within
'.user-search-form'
do
find
(
'.user-search-btn'
).
click
fill_in
'search_groups'
,
with:
'testing 123'
find
(
'.user-search-btn'
).
click
end
click_groups_tab
expect
(
page
).
not_to
have_selector
(
'.group_member'
)
end
end
click_groups_tab
it
'finds results'
do
page
.
within
'.user-search-form'
do
fill_in
'search_groups'
,
with:
group
.
name
find
(
'.user-search-btn'
).
click
end
click_groups_tab
expect
(
page
).
to
have_selector
(
'.group_member'
,
count:
1
)
expect
(
page
).
to
have_selector
(
'.group_member'
,
count:
1
)
end
end
end
end
end
...
...
spec/features/projects/members/invite_group_spec.rb
View file @
8fadde83
...
@@ -5,12 +5,12 @@ require 'spec_helper'
...
@@ -5,12 +5,12 @@ require 'spec_helper'
RSpec
.
describe
'Project > Members > Invite group'
,
:js
do
RSpec
.
describe
'Project > Members > Invite group'
,
:js
do
include
Select2Helper
include
Select2Helper
include
ActionView
::
Helpers
::
DateHelper
include
ActionView
::
Helpers
::
DateHelper
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
let
(
:maintainer
)
{
create
(
:user
)
}
let
(
:maintainer
)
{
create
(
:user
)
}
before
do
before
do
stub_feature_flags
(
invite_members_group_modal:
false
)
stub_feature_flags
(
invite_members_group_modal:
false
)
stub_feature_flags
(
vue_project_members_list:
false
)
end
end
describe
'Share with group lock'
do
describe
'Share with group lock'
do
...
@@ -41,21 +41,45 @@ RSpec.describe 'Project > Members > Invite group', :js do
...
@@ -41,21 +41,45 @@ RSpec.describe 'Project > Members > Invite group', :js do
context
'when the group has "Share with group lock" disabled'
do
context
'when the group has "Share with group lock" disabled'
do
it_behaves_like
'the project can be shared with groups'
it_behaves_like
'the project can be shared with groups'
it
'the project can be shared with another group'
do
context
'when `vue_project_members_list` feature flag is enabled'
do
visit
project_project_members_path
(
project
)
it
'the project can be shared with another group'
do
visit
project_project_members_path
(
project
)
expect
(
page
).
not_to
have_link
'Groups'
expect
(
page
).
not_to
have_link
'Groups'
click_on
'invite-group-tab'
click_on
'invite-group-tab'
select2
group_to_share_with
.
id
,
from:
'#link_group_id'
select2
group_to_share_with
.
id
,
from:
'#link_group_id'
page
.
find
(
'body'
).
click
page
.
find
(
'body'
).
click
find
(
'.btn-success'
).
click
find
(
'.btn-success'
).
click
click_link
'Groups'
click_link
'Groups'
page
.
within
(
'[data-testid="project-member-groups"]'
)
do
expect
(
members_table
).
to
have_content
(
group_to_share_with
.
name
)
expect
(
page
).
to
have_content
(
group_to_share_with
.
name
)
end
end
context
'when `vue_project_members_list` feature flag is disabled'
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
end
it
'the project can be shared with another group'
do
visit
project_project_members_path
(
project
)
expect
(
page
).
not_to
have_link
'Groups'
click_on
'invite-group-tab'
select2
group_to_share_with
.
id
,
from:
'#link_group_id'
page
.
find
(
'body'
).
click
find
(
'.btn-success'
).
click
click_link
'Groups'
page
.
within
(
'[data-testid="project-member-groups"]'
)
do
expect
(
page
).
to
have_content
(
group_to_share_with
.
name
)
end
end
end
end
end
end
end
...
@@ -122,7 +146,7 @@ RSpec.describe 'Project > Members > Invite group', :js do
...
@@ -122,7 +146,7 @@ RSpec.describe 'Project > Members > Invite group', :js do
freeze_time
{
example
.
run
}
freeze_time
{
example
.
run
}
end
end
before
do
def
setup
project
.
add_maintainer
(
maintainer
)
project
.
add_maintainer
(
maintainer
)
group
.
add_guest
(
maintainer
)
group
.
add_guest
(
maintainer
)
sign_in
(
maintainer
)
sign_in
(
maintainer
)
...
@@ -133,20 +157,37 @@ RSpec.describe 'Project > Members > Invite group', :js do
...
@@ -133,20 +157,37 @@ RSpec.describe 'Project > Members > Invite group', :js do
select2
group
.
id
,
from:
'#link_group_id'
select2
group
.
id
,
from:
'#link_group_id'
fill_in
'expires_at_groups'
,
with:
(
Time
.
now
+
4.5
.
days
)
.
strftime
(
'%Y-%m-%d'
)
fill_in
'expires_at_groups'
,
with:
5
.
days
.
from_now
.
strftime
(
'%Y-%m-%d'
)
click_on
'invite-group-tab'
click_on
'invite-group-tab'
find
(
'.btn-success'
).
click
find
(
'.btn-success'
).
click
end
end
it
'the group link shows the expiration time with a warning class'
do
context
'when `vue_project_members_list` feature flag is enabled'
do
click_link
'Groups'
it
'the group link shows the expiration time with a warning class'
do
setup
click_link
'Groups'
page
.
within
(
'[data-testid="project-member-groups"]'
)
do
expect
(
find_group_row
(
group
)).
to
have_content
(
/in \d days/
)
# Using distance_of_time_in_words_to_now because it is not the same as
expect
(
find_group_row
(
group
)).
to
have_selector
(
'.gl-text-orange-500'
)
# subtraction, and this way avoids time zone issues as well
end
expires_in_text
=
distance_of_time_in_words_to_now
(
project
.
project_group_links
.
first
.
expires_at
)
end
expect
(
page
).
to
have_content
(
expires_in_text
)
expect
(
page
).
to
have_selector
(
'.text-warning'
)
context
'when `vue_project_members_list` feature flag is disabled'
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
end
it
'the group link shows the expiration time with a warning class'
do
setup
click_link
'Groups'
page
.
within
(
'[data-testid="project-member-groups"]'
)
do
# Using distance_of_time_in_words_to_now because it is not the same as
# subtraction, and this way avoids time zone issues as well
expires_in_text
=
distance_of_time_in_words_to_now
(
project
.
project_group_links
.
first
.
expires_at
)
expect
(
page
).
to
have_content
(
expires_in_text
)
expect
(
page
).
to
have_selector
(
'.text-warning'
)
end
end
end
end
end
end
end
...
...
spec/features/projects/members/list_spec.rb
View file @
8fadde83
...
@@ -4,7 +4,6 @@ require 'spec_helper'
...
@@ -4,7 +4,6 @@ require 'spec_helper'
RSpec
.
describe
'Project members list'
do
RSpec
.
describe
'Project members list'
do
include
Select2Helper
include
Select2Helper
include
Spec
::
Support
::
Helpers
::
Features
::
ListRowsHelpers
let
(
:user1
)
{
create
(
:user
,
name:
'John Doe'
)
}
let
(
:user1
)
{
create
(
:user
,
name:
'John Doe'
)
}
let
(
:user2
)
{
create
(
:user
,
name:
'Mary Jane'
)
}
let
(
:user2
)
{
create
(
:user
,
name:
'Mary Jane'
)
}
...
@@ -13,110 +12,215 @@ RSpec.describe 'Project members list' do
...
@@ -13,110 +12,215 @@ RSpec.describe 'Project members list' do
before
do
before
do
stub_feature_flags
(
invite_members_group_modal:
false
)
stub_feature_flags
(
invite_members_group_modal:
false
)
stub_feature_flags
(
vue_project_members_list:
false
)
sign_in
(
user1
)
sign_in
(
user1
)
group
.
add_owner
(
user1
)
group
.
add_owner
(
user1
)
end
end
it
'pushes `vue_project_members_list` feature flag to the frontend'
do
context
'when `vue_project_members_list` feature flag is enabled'
,
:js
do
visit_members_page
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
expect
(
page
).
to
have_pushed_frontend_feature_flags
(
vueProjectMembersList:
false
)
it
'pushes `vue_project_members_list` feature flag to the frontend'
do
end
visit_members_page
it
'show members from project and group'
do
expect
(
page
).
to
have_pushed_frontend_feature_flags
(
vueProjectMembersList:
true
)
project
.
add_developer
(
user2
)
end
visit_members_page
it
'show members from project and group'
do
project
.
add_developer
(
user2
)
expect
(
first_row
.
text
).
to
include
(
user1
.
name
)
visit_members_page
expect
(
second_row
.
text
).
to
include
(
user2
.
name
)
end
it
'show user once if member of both group and project'
do
expect
(
first_row
).
to
have_content
(
user1
.
name
)
project
.
add_developer
(
user1
)
expect
(
second_row
).
to
have_content
(
user2
.
name
)
end
visit_members_page
it
'show user once if member of both group and project'
do
project
.
add_developer
(
user1
)
expect
(
first_row
.
text
).
to
include
(
user1
.
name
)
visit_members_page
expect
(
second_row
).
to
be_blank
end
it
'update user access level'
,
:js
do
expect
(
first_row
).
to
have_content
(
user1
.
name
)
project
.
add_developer
(
user2
)
expect
(
second_row
).
to
be_blank
end
it
'update user access level'
,
:js
do
project
.
add_developer
(
user2
)
visit_members_page
visit_members_page
page
.
within
(
second_row
)
do
page
.
within
find_member_row
(
user2
)
do
click_button
(
'Developer'
)
click_button
(
'Developer'
)
click_link
(
'Reporter'
)
click_button
(
'Reporter'
)
expect
(
page
).
to
have_button
(
'Reporter'
)
expect
(
page
).
to
have_button
(
'Reporter'
)
end
end
end
end
it
'add user to project'
,
:js
do
it
'add user to project'
,
:js
do
visit_members_page
visit_members_page
add_user
(
user2
.
id
,
'Reporter'
)
add_user
(
user2
.
id
,
'Reporter'
)
page
.
within
(
second_row
)
do
page
.
within
find_member_row
(
user2
)
do
expect
(
page
).
to
have_content
(
user2
.
name
)
expect
(
page
).
to
have_button
(
'Reporter'
)
e
xpect
(
page
).
to
have_button
(
'Reporter'
)
e
nd
end
end
end
it
'remove user from project'
,
:js
do
it
'remove user from project'
,
:js
do
other_user
=
create
(
:user
)
other_user
=
create
(
:user
)
project
.
add_developer
(
other_user
)
project
.
add_developer
(
other_user
)
visit_members_page
visit_members_page
# Open modal
page
.
within
find_member_row
(
other_user
)
do
click_button
'Remove member'
end
# Open modal
page
.
within
(
'[role="dialog"]'
)
do
find
(
:css
,
'li.project_member'
,
text:
other_user
.
name
).
find
(
:css
,
'button.btn-danger'
).
click
expect
(
page
).
to
have_unchecked_field
'Also unassign this user from related issues and merge requests'
click_button
(
'Remove member'
)
end
expect
(
page
).
to
have_unchecked_field
'Also unassign this user from related issues and merge requests'
wait_for_requests
click_on
(
'Remove member'
)
expect
(
members_table
).
not_to
have_content
(
other_user
.
name
)
end
wait_for_requests
it
'invite user to project'
,
:js
do
visit_members_page
expect
(
page
).
not_to
have_content
(
other_user
.
name
)
add_user
(
'test@example.com'
,
'Reporter'
)
expect
(
project
.
users
).
not_to
include
(
other_user
)
end
it
'invite user to project'
,
:js
do
click_link
'Invited'
visit_members_page
add_user
(
'test@example.com'
,
'Reporter'
)
page
.
within
find_invited_member_row
(
'test@example.com'
)
do
expect
(
page
).
to
have_button
(
'Reporter'
)
end
end
context
'project bots'
do
let
(
:project_bot
)
{
create
(
:user
,
:project_bot
,
name:
'project_bot'
)
}
click_link
'Invited'
before
do
project
.
add_maintainer
(
project_bot
)
end
page
.
within
(
first_row
)
do
it
'does not show form used to change roles and "Expiration date" or the remove user button'
do
expect
(
page
).
to
have_content
(
'test@example.com'
)
visit_members_page
expect
(
page
).
to
have_content
(
'Invited'
)
expect
(
page
).
to
have_button
(
'Reporter'
)
page
.
within
find_member_row
(
project_bot
)
do
expect
(
page
).
not_to
have_button
(
'Maintainer'
)
expect
(
page
).
to
have_field
(
'Expiration date'
,
disabled:
true
)
expect
(
page
).
not_to
have_button
(
'Remove member'
)
end
end
end
end
end
end
context
'
project bots
'
do
context
'
when `vue_project_members_list` feature flag is disabled
'
do
let
(
:project_bot
)
{
create
(
:user
,
:project_bot
,
name:
'project_bot'
)
}
include
Spec
::
Support
::
Helpers
::
Features
::
ListRowsHelpers
before
do
before
do
project
.
add_maintainer
(
project_bot
)
stub_feature_flags
(
vue_project_members_list:
false
)
end
it
'show members from project and group'
do
project
.
add_developer
(
user2
)
visit_members_page
expect
(
first_row
.
text
).
to
include
(
user1
.
name
)
expect
(
second_row
.
text
).
to
include
(
user2
.
name
)
end
it
'show user once if member of both group and project'
do
project
.
add_developer
(
user1
)
visit_members_page
expect
(
first_row
.
text
).
to
include
(
user1
.
name
)
expect
(
second_row
).
to
be_blank
end
it
'update user access level'
,
:js
do
project
.
add_developer
(
user2
)
visit_members_page
page
.
within
(
second_row
)
do
click_button
(
'Developer'
)
click_link
(
'Reporter'
)
expect
(
page
).
to
have_button
(
'Reporter'
)
end
end
end
it
'does not show form used to change roles and "Expiration date" or the remove user button'
do
it
'add user to project'
,
:js
do
project_member
=
project
.
project_members
.
find_by
(
user_id:
project_bot
.
id
)
visit_members_page
add_user
(
user2
.
id
,
'Reporter'
)
page
.
within
(
second_row
)
do
expect
(
page
).
to
have_content
(
user2
.
name
)
expect
(
page
).
to
have_button
(
'Reporter'
)
end
end
it
'remove user from project'
,
:js
do
other_user
=
create
(
:user
)
project
.
add_developer
(
other_user
)
visit_members_page
# Open modal
find
(
:css
,
'li.project_member'
,
text:
other_user
.
name
).
find
(
:css
,
'button.btn-danger'
).
click
expect
(
page
).
to
have_unchecked_field
'Also unassign this user from related issues and merge requests'
click_on
(
'Remove member'
)
wait_for_requests
expect
(
page
).
not_to
have_content
(
other_user
.
name
)
expect
(
project
.
users
).
not_to
include
(
other_user
)
end
it
'invite user to project'
,
:js
do
visit_members_page
visit_members_page
expect
(
page
).
not_to
have_selector
(
"#edit_project_member_
#{
project_member
.
id
}
"
)
add_user
(
'test@example.com'
,
'Reporter'
)
expect
(
page
).
to
have_no_selector
(
"#project_member_
#{
project_member
.
id
}
.btn-danger"
)
click_link
'Invited'
page
.
within
(
first_row
)
do
expect
(
page
).
to
have_content
(
'test@example.com'
)
expect
(
page
).
to
have_content
(
'Invited'
)
expect
(
page
).
to
have_button
(
'Reporter'
)
end
end
context
'project bots'
do
let
(
:project_bot
)
{
create
(
:user
,
:project_bot
,
name:
'project_bot'
)
}
before
do
project
.
add_maintainer
(
project_bot
)
end
it
'does not show form used to change roles and "Expiration date" or the remove user button'
do
project_member
=
project
.
project_members
.
find_by
(
user_id:
project_bot
.
id
)
visit_members_page
expect
(
page
).
not_to
have_selector
(
"#edit_project_member_
#{
project_member
.
id
}
"
)
expect
(
page
).
to
have_no_selector
(
"#project_member_
#{
project_member
.
id
}
.btn-danger"
)
end
end
end
end
end
private
def
add_user
(
id
,
role
)
def
add_user
(
id
,
role
)
page
.
within
".invite-users-form"
do
page
.
within
".invite-users-form"
do
select2
(
id
,
from:
"#user_ids"
,
multiple:
true
)
select2
(
id
,
from:
"#user_ids"
,
multiple:
true
)
...
...
spec/features/projects/members/master_adds_member_with_expiration_date_spec.rb
View file @
8fadde83
...
@@ -5,65 +5,120 @@ require 'spec_helper'
...
@@ -5,65 +5,120 @@ require 'spec_helper'
RSpec
.
describe
'Projects > Members > Maintainer adds member with expiration date'
,
:js
do
RSpec
.
describe
'Projects > Members > Maintainer adds member with expiration date'
,
:js
do
include
Select2Helper
include
Select2Helper
include
ActiveSupport
::
Testing
::
TimeHelpers
include
ActiveSupport
::
Testing
::
TimeHelpers
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
let_it_be
(
:maintainer
)
{
create
(
:user
)
}
let_it_be
(
:maintainer
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:project
)
{
create
(
:project
)
}
let
(
:new_member
)
{
create
(
:user
)
}
let
(
:new_member
)
{
create
(
:user
)
}
before
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
travel_to
Time
.
now
.
utc
.
beginning_of_day
travel_to
Time
.
now
.
utc
.
beginning_of_day
project
.
add_maintainer
(
maintainer
)
project
.
add_maintainer
(
maintainer
)
sign_in
(
maintainer
)
sign_in
(
maintainer
)
end
end
it
'expiration date is displayed in the members list'
do
context
'when `vue_project_members_list` feature flag is enabled'
do
stub_feature_flags
(
invite_members_group_modal:
false
)
it
'expiration date is displayed in the members list'
do
stub_feature_flags
(
invite_members_group_modal:
false
)
visit
project_project_members_path
(
project
)
visit
project_project_members_path
(
project
)
page
.
within
'.invite-users-form'
do
select2
(
new_member
.
id
,
from:
'#user_ids'
,
multiple:
true
)
page
.
within
'.invite-users-form'
do
fill_in
'expires_at'
,
with:
5
.
days
.
from_now
.
to_date
select2
(
new_member
.
id
,
from:
'#user_ids'
,
multiple:
true
)
find_field
(
'expires_at'
).
native
.
send_keys
:enter
fill_in
'expires_at'
,
with:
3
.
days
.
from_now
.
to_date
click_on
'Invite'
find_field
(
'expires_at'
).
native
.
send_keys
:enter
end
click_on
'Invite'
page
.
within
find_member_row
(
new_member
)
do
expect
(
page
).
to
have_content
(
/in \d days/
)
end
end
end
page
.
within
"#project_member_
#{
project_member_id
}
"
do
it
'changes expiration date'
do
expect
(
page
).
to
have_content
(
'Expires in 3 days'
)
project
.
team
.
add_users
([
new_member
.
id
],
:developer
,
expires_at:
3
.
days
.
from_now
.
to_date
)
visit
project_project_members_path
(
project
)
page
.
within
find_member_row
(
new_member
)
do
fill_in
'Expiration date'
,
with:
5
.
days
.
from_now
.
to_date
find_field
(
'Expiration date'
).
native
.
send_keys
:enter
wait_for_requests
expect
(
page
).
to
have_content
(
/in \d days/
)
end
end
end
end
it
'change
s expiration date'
do
it
'clear
s expiration date'
do
project
.
team
.
add_users
([
new_member
.
id
],
:developer
,
expires_at:
Date
.
today
.
to_date
)
project
.
team
.
add_users
([
new_member
.
id
],
:developer
,
expires_at:
5
.
days
.
from_now
.
to_date
)
visit
project_project_members_path
(
project
)
visit
project_project_members_path
(
project
)
page
.
within
"#project_member_
#{
project_member_id
}
"
do
page
.
within
find_member_row
(
new_member
)
do
fill_in
'Expiration date'
,
with:
3
.
days
.
from_now
.
to_date
expect
(
page
).
to
have_content
(
/in \d days/
)
find_field
(
'Expiration date'
).
native
.
send_keys
:enter
wait_for_requests
find
(
'[data-testid="clear-button"]'
).
click
expect
(
page
).
to
have_content
(
'Expires in 3 days'
)
wait_for_requests
expect
(
page
).
to
have_content
(
'No expiration set'
)
end
end
end
end
end
it
'clears expiration date'
do
context
'when `vue_project_members_list` feature flag is disabled'
do
project
.
team
.
add_users
([
new_member
.
id
],
:developer
,
expires_at:
3
.
days
.
from_now
.
to_date
)
before
do
visit
project_project_members_path
(
project
)
stub_feature_flags
(
vue_project_members_list:
false
)
end
it
'expiration date is displayed in the members list'
do
stub_feature_flags
(
invite_members_group_modal:
false
)
visit
project_project_members_path
(
project
)
page
.
within
'.invite-users-form'
do
select2
(
new_member
.
id
,
from:
'#user_ids'
,
multiple:
true
)
fill_in
'expires_at'
,
with:
3
.
days
.
from_now
.
to_date
find_field
(
'expires_at'
).
native
.
send_keys
:enter
click_on
'Invite'
end
page
.
within
"#project_member_
#{
project_member_id
}
"
do
expect
(
page
).
to
have_content
(
'Expires in 3 days'
)
end
end
it
'changes expiration date'
do
project
.
team
.
add_users
([
new_member
.
id
],
:developer
,
expires_at:
1
.
day
.
from_now
.
to_date
)
visit
project_project_members_path
(
project
)
page
.
within
"#project_member_
#{
project_member_id
}
"
do
fill_in
'Expiration date'
,
with:
3
.
days
.
from_now
.
to_date
find_field
(
'Expiration date'
).
native
.
send_keys
:enter
wait_for_requests
expect
(
page
).
to
have_content
(
'Expires in 3 days'
)
end
end
it
'clears expiration date'
do
project
.
team
.
add_users
([
new_member
.
id
],
:developer
,
expires_at:
3
.
days
.
from_now
.
to_date
)
visit
project_project_members_path
(
project
)
page
.
within
"#project_member_
#{
project_member_id
}
"
do
page
.
within
"#project_member_
#{
project_member_id
}
"
do
expect
(
page
).
to
have_content
(
'Expires in 3 days'
)
expect
(
page
).
to
have_content
(
'Expires in 3 days'
)
find
(
'.js-clear-input'
).
click
find
(
'.js-clear-input'
).
click
wait_for_requests
wait_for_requests
expect
(
page
).
not_to
have_content
(
'Expires in'
)
expect
(
page
).
not_to
have_content
(
'Expires in'
)
end
end
end
end
end
...
...
spec/features/projects/members/sorting_spec.rb
View file @
8fadde83
...
@@ -3,90 +3,181 @@
...
@@ -3,90 +3,181 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
'Projects > Members > Sorting'
do
RSpec
.
describe
'Projects > Members > Sorting'
do
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
let
(
:maintainer
)
{
create
(
:user
,
name:
'John Doe'
)
}
let
(
:maintainer
)
{
create
(
:user
,
name:
'John Doe'
)
}
let
(
:developer
)
{
create
(
:user
,
name:
'Mary Jane'
,
last_sign_in_at:
5
.
days
.
ago
)
}
let
(
:developer
)
{
create
(
:user
,
name:
'Mary Jane'
,
last_sign_in_at:
5
.
days
.
ago
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
maintainer
.
namespace
,
creator:
maintainer
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
maintainer
.
namespace
,
creator:
maintainer
)
}
before
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
create
(
:project_member
,
:developer
,
user:
developer
,
project:
project
,
created_at:
3
.
days
.
ago
)
create
(
:project_member
,
:developer
,
user:
developer
,
project:
project
,
created_at:
3
.
days
.
ago
)
sign_in
(
maintainer
)
sign_in
(
maintainer
)
end
end
it
'sorts alphabetically by default'
do
context
'when `vue_project_members_list` feature flag is enabled'
,
:js
do
visit_members_list
(
sort:
nil
)
it
'sorts by account by default'
do
visit_members_list
(
sort:
nil
)
expect
(
first_member
).
to
include
(
maintainer
.
name
)
expect
(
first_row
).
to
have_content
(
maintainer
.
name
)
expect
(
second_member
).
to
include
(
developer
.
name
)
expect
(
second_row
).
to
have_content
(
developer
.
name
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Name, ascending'
)
end
it
'sorts by access level ascending'
do
expect_sort_by
(
'Account'
,
:asc
)
visit_members_list
(
sort: :access_level_asc
)
end
expect
(
first_member
).
to
include
(
developer
.
name
)
it
'sorts by max role ascending'
do
expect
(
second_member
).
to
include
(
maintainer
.
name
)
visit_members_list
(
sort: :access_level_asc
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Access level, ascending'
)
end
it
'sorts by access level descending'
do
expect
(
first_row
).
to
have_content
(
developer
.
name
)
visit_members_list
(
sort: :access_level_desc
)
expect
(
second_row
).
to
have_content
(
maintainer
.
name
)
expect
(
first_member
).
to
include
(
maintainer
.
name
)
expect_sort_by
(
'Max role'
,
:asc
)
expect
(
second_member
).
to
include
(
developer
.
name
)
end
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Access level, descending'
)
end
it
'sorts by last joined
'
do
it
'sorts by max role descending
'
do
visit_members_list
(
sort: :last_joined
)
visit_members_list
(
sort: :access_level_desc
)
expect
(
first_member
).
to
include
(
maintainer
.
name
)
expect
(
first_row
).
to
have_content
(
maintainer
.
name
)
expect
(
second_member
).
to
include
(
developer
.
name
)
expect
(
second_row
).
to
have_content
(
developer
.
name
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Last joined'
)
end
it
'sorts by oldest joined'
do
expect_sort_by
(
'Max role'
,
:desc
)
visit_members_list
(
sort: :oldest_joined
)
end
expect
(
first_member
).
to
include
(
developer
.
name
)
it
'sorts by access granted ascending'
do
expect
(
second_member
).
to
include
(
maintainer
.
name
)
visit_members_list
(
sort: :last_joined
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Oldest joined'
)
end
it
'sorts by name ascending'
do
expect
(
first_row
).
to
have_content
(
maintainer
.
name
)
visit_members_list
(
sort: :name_asc
)
expect
(
second_row
).
to
have_content
(
developer
.
name
)
expect
(
first_member
).
to
include
(
maintainer
.
name
)
expect_sort_by
(
'Access granted'
,
:asc
)
expect
(
second_member
).
to
include
(
developer
.
name
)
end
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Name, ascending'
)
end
it
'sorts by name
descending'
do
it
'sorts by access granted
descending'
do
visit_members_list
(
sort: :name_desc
)
visit_members_list
(
sort: :oldest_joined
)
expect
(
first_member
).
to
include
(
developer
.
name
)
expect
(
first_row
).
to
have_content
(
developer
.
name
)
expect
(
second_member
).
to
include
(
maintainer
.
name
)
expect
(
second_row
).
to
have_content
(
maintainer
.
name
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Name, descending'
)
end
expect_sort_by
(
'Access granted'
,
:desc
)
end
it
'sorts by account ascending'
do
visit_members_list
(
sort: :name_asc
)
expect
(
first_row
).
to
have_content
(
maintainer
.
name
)
expect
(
second_row
).
to
have_content
(
developer
.
name
)
expect_sort_by
(
'Account'
,
:asc
)
end
it
'sorts by account descending'
do
visit_members_list
(
sort: :name_desc
)
expect
(
first_row
).
to
have_content
(
developer
.
name
)
expect
(
second_row
).
to
have_content
(
maintainer
.
name
)
expect_sort_by
(
'Account'
,
:desc
)
end
it
'sorts by last sign-in ascending'
,
:clean_gitlab_redis_shared_state
do
visit_members_list
(
sort: :recent_sign_in
)
expect
(
first_row
).
to
have_content
(
maintainer
.
name
)
expect
(
second_row
).
to
have_content
(
developer
.
name
)
expect_sort_by
(
'Last sign-in'
,
:asc
)
end
it
'sorts by last sign-in descending'
,
:clean_gitlab_redis_shared_state
do
visit_members_list
(
sort: :oldest_sign_in
)
it
'sorts by recent sign in'
,
:clean_gitlab_redis_shared_state
do
expect
(
first_row
).
to
have_content
(
developer
.
name
)
visit_members_list
(
sort: :recent_sign_in
)
expect
(
second_row
).
to
have_content
(
maintainer
.
name
)
expect
(
first_member
).
to
include
(
maintainer
.
name
)
expect_sort_by
(
'Last sign-in'
,
:desc
)
expect
(
second_member
).
to
include
(
developer
.
name
)
end
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Recent sign in'
)
end
end
it
'sorts by oldest sign in'
,
:clean_gitlab_redis_shared_state
do
context
'when `vue_project_members_list` feature flag is disabled'
do
visit_members_list
(
sort: :oldest_sign_in
)
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
end
expect
(
first_member
).
to
include
(
developer
.
name
)
it
'sorts alphabetically by default'
do
expect
(
second_member
).
to
include
(
maintainer
.
name
)
visit_members_list
(
sort:
nil
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Oldest sign in'
)
expect
(
first_member
).
to
include
(
maintainer
.
name
)
expect
(
second_member
).
to
include
(
developer
.
name
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Name, ascending'
)
end
it
'sorts by access level ascending'
do
visit_members_list
(
sort: :access_level_asc
)
expect
(
first_member
).
to
include
(
developer
.
name
)
expect
(
second_member
).
to
include
(
maintainer
.
name
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Access level, ascending'
)
end
it
'sorts by access level descending'
do
visit_members_list
(
sort: :access_level_desc
)
expect
(
first_member
).
to
include
(
maintainer
.
name
)
expect
(
second_member
).
to
include
(
developer
.
name
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Access level, descending'
)
end
it
'sorts by last joined'
do
visit_members_list
(
sort: :last_joined
)
expect
(
first_member
).
to
include
(
maintainer
.
name
)
expect
(
second_member
).
to
include
(
developer
.
name
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Last joined'
)
end
it
'sorts by oldest joined'
do
visit_members_list
(
sort: :oldest_joined
)
expect
(
first_member
).
to
include
(
developer
.
name
)
expect
(
second_member
).
to
include
(
maintainer
.
name
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Oldest joined'
)
end
it
'sorts by name ascending'
do
visit_members_list
(
sort: :name_asc
)
expect
(
first_member
).
to
include
(
maintainer
.
name
)
expect
(
second_member
).
to
include
(
developer
.
name
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Name, ascending'
)
end
it
'sorts by name descending'
do
visit_members_list
(
sort: :name_desc
)
expect
(
first_member
).
to
include
(
developer
.
name
)
expect
(
second_member
).
to
include
(
maintainer
.
name
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Name, descending'
)
end
it
'sorts by recent sign in'
,
:clean_gitlab_redis_shared_state
do
visit_members_list
(
sort: :recent_sign_in
)
expect
(
first_member
).
to
include
(
maintainer
.
name
)
expect
(
second_member
).
to
include
(
developer
.
name
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Recent sign in'
)
end
it
'sorts by oldest sign in'
,
:clean_gitlab_redis_shared_state
do
visit_members_list
(
sort: :oldest_sign_in
)
expect
(
first_member
).
to
include
(
developer
.
name
)
expect
(
second_member
).
to
include
(
maintainer
.
name
)
expect
(
page
).
to
have_css
(
'.qa-user-sort-dropdown .dropdown-toggle-text'
,
text:
'Oldest sign in'
)
end
end
end
private
def
visit_members_list
(
sort
:)
def
visit_members_list
(
sort
:)
visit
project_project_members_path
(
project
,
sort:
sort
)
visit
project_project_members_path
(
project
,
sort:
sort
)
end
end
...
@@ -98,4 +189,11 @@ RSpec.describe 'Projects > Members > Sorting' do
...
@@ -98,4 +189,11 @@ RSpec.describe 'Projects > Members > Sorting' do
def
second_member
def
second_member
page
.
all
(
'ul.content-list > li'
).
last
.
text
page
.
all
(
'ul.content-list > li'
).
last
.
text
end
end
def
expect_sort_by
(
text
,
sort_direction
)
within
(
'[data-testid="members-sort-dropdown"]'
)
do
expect
(
page
).
to
have_css
(
'button[aria-haspopup="true"]'
,
text:
text
)
expect
(
page
).
to
have_button
(
"Sorting Direction:
#{
sort_direction
==
:asc
?
'Ascending'
:
'Descending'
}
"
)
end
end
end
end
spec/features/projects/members/tabs_spec.rb
View file @
8fadde83
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
'Projects > Members > Tabs'
do
RSpec
.
describe
'Projects > Members > Tabs'
do
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
using
RSpec
::
Parameterized
::
TableSyntax
using
RSpec
::
Parameterized
::
TableSyntax
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
...
@@ -19,56 +20,93 @@ RSpec.describe 'Projects > Members > Tabs' do
...
@@ -19,56 +20,93 @@ RSpec.describe 'Projects > Members > Tabs' do
end
end
end
end
before
do
context
'tabs'
do
stub_feature_flags
(
vue_project_members_list:
false
)
before
do
allow
(
Kaminari
.
config
).
to
receive
(
:default_per_page
).
and_return
(
1
)
sign_in
(
user
)
visit
project_project_members_path
(
project
)
sign_in
(
user
)
end
visit
project_project_members_path
(
project
)
end
where
(
:tab
,
:count
)
do
where
(
:tab
,
:count
)
do
'Members'
|
3
'Members'
|
3
'Invited'
|
2
'Invited'
|
2
'Groups'
|
2
'Groups'
|
2
'Access requests'
|
2
'Access requests'
|
2
end
end
with_them
do
with_them
do
it
"renders
#{
params
[
:tab
]
}
tab"
do
it
"renders
#{
params
[
:tab
]
}
tab"
do
expect
(
page
).
to
have_selector
(
'.nav-link'
,
text:
"
#{
tab
}
#{
count
}
"
)
expect
(
page
).
to
have_selector
(
'.nav-link'
,
text:
"
#{
tab
}
#{
count
}
"
)
end
end
end
end
context
'displays "Members" tab by default'
do
context
'displays "Members" tab by default'
do
it_behaves_like
'active "Members" tab'
it_behaves_like
'active "Members" tab'
end
end
end
context
'when
searching "Groups"'
,
:js
do
context
'when
`vue_project_members_list` feature flag is enabled'
do
before
do
before
do
click_link
'Groups'
sign_in
(
user
)
visit
project_project_members_path
(
project
)
end
context
'when searching "Groups"'
,
:js
do
before
do
click_link
'Groups'
fill_in_filtered_search
'Search groups'
,
with:
'group'
end
page
.
within
'[data-testid="group-link-search-form"]'
do
it
'displays "Groups" tab'
do
fill_in
'search_groups'
,
with:
'group'
expect
(
page
).
to
have_selector
(
'.nav-link.active'
,
text:
'Groups'
)
find
(
'button[type="submit"]'
).
click
end
context
'and then searching "Members"'
do
before
do
click_link
'Members 3'
fill_in_filtered_search
'Filter members'
,
with:
'user'
end
it_behaves_like
'active "Members" tab'
end
end
end
end
end
context
'when `vue_project_members_list` feature flag is disabled'
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
it
'displays "Groups" tab'
do
sign_in
(
user
)
expect
(
page
).
to
have_selector
(
'.nav-link.active'
,
text:
'Groups'
)
visit
project_project_members_path
(
project
)
end
end
context
'
and then searching "Members"'
do
context
'
when searching "Groups"'
,
:js
do
before
do
before
do
click_link
'
Members 3
'
click_link
'
Groups
'
page
.
within
'[data-testid="
user
-search-form"]'
do
page
.
within
'[data-testid="
group-link
-search-form"]'
do
fill_in
'search
'
,
with:
'user
'
fill_in
'search
_groups'
,
with:
'group
'
find
(
'button[type="submit"]'
).
click
find
(
'button[type="submit"]'
).
click
end
end
end
end
it_behaves_like
'active "Members" tab'
it
'displays "Groups" tab'
do
expect
(
page
).
to
have_selector
(
'.nav-link.active'
,
text:
'Groups'
)
end
context
'and then searching "Members"'
do
before
do
click_link
'Members 3'
page
.
within
'[data-testid="user-search-form"]'
do
fill_in
'search'
,
with:
'user'
find
(
'button[type="submit"]'
).
click
end
end
it_behaves_like
'active "Members" tab'
end
end
end
end
end
end
end
spec/features/projects/settings/user_manages_project_members_spec.rb
View file @
8fadde83
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
'Projects > Settings > User manages project members'
do
RSpec
.
describe
'Projects > Settings > User manages project members'
do
include
Spec
::
Support
::
Helpers
::
Features
::
MembersHelpers
include
Select2Helper
let
(
:group
)
{
create
(
:group
,
name:
'OpenSource'
)
}
let
(
:group
)
{
create
(
:group
,
name:
'OpenSource'
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project2
)
{
create
(
:project
)
}
let
(
:project2
)
{
create
(
:project
)
}
...
@@ -11,71 +14,128 @@ RSpec.describe 'Projects > Settings > User manages project members' do
...
@@ -11,71 +14,128 @@ RSpec.describe 'Projects > Settings > User manages project members' do
let
(
:user_mike
)
{
create
(
:user
,
name:
'Mike'
)
}
let
(
:user_mike
)
{
create
(
:user
,
name:
'Mike'
)
}
before
do
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
project
.
add_maintainer
(
user
)
project
.
add_maintainer
(
user
)
project
.
add_developer
(
user_dmitriy
)
project
.
add_developer
(
user_dmitriy
)
sign_in
(
user
)
sign_in
(
user
)
end
end
it
'cancels a team member'
,
:js
do
context
'when `vue_project_members_list` feature flag is enabled'
do
visit
(
project_project_members_path
(
project
))
it
'cancels a team member'
,
:js
do
visit
(
project_project_members_path
(
project
))
page
.
within
find_member_row
(
user_dmitriy
)
do
click_button
'Remove member'
end
page
.
within
(
'[role="dialog"]'
)
do
expect
(
page
).
to
have_unchecked_field
'Also unassign this user from related issues and merge requests'
click_button
(
'Remove member'
)
end
visit
(
project_project_members_path
(
project
))
expect
(
members_table
).
not_to
have_content
(
user_dmitriy
.
name
)
expect
(
members_table
).
not_to
have_content
(
user_dmitriy
.
username
)
end
it
'imports a team from another project'
,
:js
do
stub_feature_flags
(
invite_members_group_modal:
false
)
project2
.
add_maintainer
(
user
)
project2
.
add_reporter
(
user_mike
)
project_member
=
project
.
project_members
.
find_by
(
user_id:
user_dmitriy
.
id
)
visit
(
project_project_members_path
(
project
)
)
page
.
within
(
"#project_member_
#{
project_member
.
id
}
"
)
do
page
.
within
(
'.invite-users-form'
)
do
# Open modal
click_link
(
'Import'
)
click_on
(
'Remove user from project'
)
end
select2
(
project2
.
id
,
from:
'#source_project_id'
)
click_button
(
'Import project members'
)
expect
(
find_member_row
(
user_mike
)).
to
have_content
(
'Reporter'
)
end
end
expect
(
page
).
to
have_unchecked_field
'Also unassign this user from related issues and merge requests'
it
'shows all members of project shared group'
,
:js
do
group
.
add_owner
(
user
)
group
.
add_developer
(
user_dmitriy
)
share_link
=
project
.
project_group_links
.
new
(
group_access:
Gitlab
::
Access
::
MAINTAINER
)
share_link
.
group_id
=
group
.
id
share_link
.
save!
click_on
(
'Remove member'
)
visit
(
project_project_members_path
(
project
)
)
visit
(
project_project_members_path
(
project
))
click_link
'Groups'
expect
(
page
).
not_to
have_content
(
user_dmitriy
.
name
)
expect
(
find_group_row
(
group
)).
to
have_content
(
'Maintainer'
)
e
xpect
(
page
).
not_to
have_content
(
user_dmitriy
.
username
)
e
nd
end
end
it
'imports a team from another project'
do
context
'when `vue_project_members_list` feature flag is disabled'
do
stub_feature_flags
(
invite_members_group_modal:
false
)
before
do
stub_feature_flags
(
vue_project_members_list:
false
)
end
it
'cancels a team member'
,
:js
do
visit
(
project_project_members_path
(
project
))
project_member
=
project
.
project_members
.
find_by
(
user_id:
user_dmitriy
.
id
)
page
.
within
(
"#project_member_
#{
project_member
.
id
}
"
)
do
# Open modal
click_on
(
'Remove user from project'
)
end
expect
(
page
).
to
have_unchecked_field
'Also unassign this user from related issues and merge requests'
project2
.
add_maintainer
(
user
)
click_on
(
'Remove member'
)
project2
.
add_reporter
(
user_mike
)
visit
(
project_project_members_path
(
project
))
visit
(
project_project_members_path
(
project
))
page
.
within
(
'.invite-users-form'
)
do
expect
(
page
).
not_to
have_content
(
user_dmitriy
.
name
)
click_link
(
'Import'
)
expect
(
page
).
not_to
have_content
(
user_dmitriy
.
username
)
end
end
select
(
project2
.
full_name
,
from:
'source_project_id'
)
it
'imports a team from another project'
do
click_button
(
'Import'
)
stub_feature_flags
(
invite_members_group_modal:
false
)
project_member
=
project
.
project_members
.
find_by
(
user_id:
user_mike
.
id
)
project2
.
add_maintainer
(
user
)
project2
.
add_reporter
(
user_mike
)
page
.
within
(
"#project_member_
#{
project_member
.
id
}
"
)
do
visit
(
project_project_members_path
(
project
))
expect
(
page
).
to
have_content
(
'Mike'
)
expect
(
page
).
to
have_content
(
'Reporter'
)
page
.
within
(
'.invite-users-form'
)
do
click_link
(
'Import'
)
end
select
(
project2
.
full_name
,
from:
'source_project_id'
)
click_button
(
'Import'
)
project_member
=
project
.
project_members
.
find_by
(
user_id:
user_mike
.
id
)
page
.
within
(
"#project_member_
#{
project_member
.
id
}
"
)
do
expect
(
page
).
to
have_content
(
'Mike'
)
expect
(
page
).
to
have_content
(
'Reporter'
)
end
end
end
end
it
'shows all members of project shared group'
,
:js
do
it
'shows all members of project shared group'
,
:js
do
group
.
add_owner
(
user
)
group
.
add_owner
(
user
)
group
.
add_developer
(
user_dmitriy
)
group
.
add_developer
(
user_dmitriy
)
share_link
=
project
.
project_group_links
.
new
(
group_access:
Gitlab
::
Access
::
MAINTAINER
)
share_link
=
project
.
project_group_links
.
new
(
group_access:
Gitlab
::
Access
::
MAINTAINER
)
share_link
.
group_id
=
group
.
id
share_link
.
group_id
=
group
.
id
share_link
.
save!
share_link
.
save!
visit
(
project_project_members_path
(
project
))
visit
(
project_project_members_path
(
project
))
click_link
'Groups'
click_link
'Groups'
page
.
within
(
'[data-testid="project-member-groups"]'
)
do
page
.
within
(
'[data-testid="project-member-groups"]'
)
do
expect
(
page
).
to
have_content
(
'OpenSource'
)
expect
(
page
).
to
have_content
(
'OpenSource'
)
expect
(
first
(
'.group_member'
)).
to
have_content
(
'Maintainer'
)
expect
(
first
(
'.group_member'
)).
to
have_content
(
'Maintainer'
)
end
end
end
end
end
end
end
spec/support/helpers/features/members_table_helpers.rb
View file @
8fadde83
...
@@ -30,6 +30,32 @@ module Spec
...
@@ -30,6 +30,32 @@ module Spec
def
invite_users_form
def
invite_users_form
page
.
find
(
'[data-testid="invite-users-form"]'
)
page
.
find
(
'[data-testid="invite-users-form"]'
)
end
end
def
find_row
(
name
)
page
.
within
(
members_table
)
do
page
.
find
(
'tbody > tr'
,
text:
name
)
end
end
def
find_member_row
(
user
)
find_row
(
user
.
name
)
end
def
find_invited_member_row
(
email
)
find_row
(
email
)
end
def
find_group_row
(
group
)
find_row
(
group
.
full_name
)
end
def
fill_in_filtered_search
(
label
,
with
:)
page
.
within
'[data-testid="members-filtered-search-bar"]'
do
find_field
(
label
).
click
find
(
'input'
).
native
.
send_keys
(
with
)
click_button
'Search'
end
end
end
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