summaryrefslogtreecommitdiff
path: root/spec/features/groups
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-13 15:07:53 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-13 15:07:53 +0000
commita5ab3467a705b62911feacc3cf627fdbb00aa198 (patch)
tree65143ce13405efccb922fc428624ad57c38b6efa /spec/features/groups
parenteb30dd6e28f6fc9eb8021d205f6ed84511f001e2 (diff)
downloadgitlab-ce-a5ab3467a705b62911feacc3cf627fdbb00aa198.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/groups')
-rw-r--r--spec/features/groups/members/manage_groups_spec.rb89
-rw-r--r--spec/features/groups/members/manage_members_spec.rb8
-rw-r--r--spec/features/groups/members/search_members_spec.rb2
3 files changed, 94 insertions, 5 deletions
diff --git a/spec/features/groups/members/manage_groups_spec.rb b/spec/features/groups/members/manage_groups_spec.rb
new file mode 100644
index 00000000000..55f9418521f
--- /dev/null
+++ b/spec/features/groups/members/manage_groups_spec.rb
@@ -0,0 +1,89 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'Groups > Members > Manage groups', :js do
+ include Select2Helper
+ include Spec::Support::Helpers::Features::ListRowsHelpers
+
+ let(:user) { create(:user) }
+ let(:shared_with_group) { create(:group) }
+ let(:shared_group) { create(:group) }
+
+ before do
+ shared_group.add_owner(user)
+ sign_in(user)
+ end
+
+ context 'with share groups with groups feature flag' do
+ before do
+ stub_feature_flags(shared_with_group: true)
+ end
+
+ it 'add group to group' do
+ visit group_group_members_path(shared_group)
+
+ add_group(shared_with_group.id, 'Reporter')
+
+ page.within(first_row) do
+ expect(page).to have_content(shared_with_group.name)
+ expect(page).to have_content('Reporter')
+ end
+ end
+
+ it 'remove user from group' do
+ create(:group_group_link, shared_group: shared_group,
+ shared_with_group: shared_with_group, group_access: ::Gitlab::Access::DEVELOPER)
+
+ visit group_group_members_path(shared_group)
+
+ expect(page).to have_content(shared_with_group.name)
+
+ accept_confirm do
+ find(:css, '#existing_shares li', text: shared_with_group.name).find(:css, 'a.btn-remove').click
+ end
+
+ wait_for_requests
+
+ expect(page).not_to have_content(shared_with_group.name)
+ end
+
+ it 'update group to owner level' do
+ create(:group_group_link, shared_group: shared_group,
+ shared_with_group: shared_with_group, group_access: ::Gitlab::Access::DEVELOPER)
+
+ visit group_group_members_path(shared_group)
+
+ page.within(first_row) do
+ click_button('Developer')
+ click_link('Maintainer')
+
+ wait_for_requests
+
+ expect(page).to have_button('Maintainer')
+ end
+ end
+
+ def add_group(id, role)
+ page.click_link 'Invite group'
+ page.within ".invite-group-form" do
+ select2(id, from: "#shared_with_group_id")
+ select(role, from: "shared_group_access")
+ click_button "Invite"
+ end
+ end
+ end
+
+ context 'without share groups with groups feature flag' do
+ before do
+ stub_feature_flags(share_group_with_group: false)
+ end
+
+ it 'does not render invitation form and tabs' do
+ visit group_group_members_path(shared_group)
+
+ expect(page).not_to have_link('Invite member')
+ expect(page).not_to have_link('Invite group')
+ end
+ end
+end
diff --git a/spec/features/groups/members/manage_members_spec.rb b/spec/features/groups/members/manage_members_spec.rb
index cdd16ae9441..e4ba3022d8b 100644
--- a/spec/features/groups/members/manage_members_spec.rb
+++ b/spec/features/groups/members/manage_members_spec.rb
@@ -113,7 +113,8 @@ describe 'Groups > Members > Manage members' do
visit group_group_members_path(group)
- expect(page).not_to have_button 'Add to group'
+ expect(page).not_to have_selector '.invite-users-form'
+ expect(page).not_to have_selector '.invite-group-form'
page.within(second_row) do
# Can not modify user2 role
@@ -125,11 +126,10 @@ describe 'Groups > Members > Manage members' do
end
def add_user(id, role)
- page.within ".users-group-form" do
+ page.within ".invite-users-form" do
select2(id, from: "#user_ids", multiple: true)
select(role, from: "access_level")
+ click_button "Invite"
end
-
- click_button "Add to group"
end
end
diff --git a/spec/features/groups/members/search_members_spec.rb b/spec/features/groups/members/search_members_spec.rb
index 9c17aac09e8..fda129ce422 100644
--- a/spec/features/groups/members/search_members_spec.rb
+++ b/spec/features/groups/members/search_members_spec.rb
@@ -24,7 +24,7 @@ describe 'Search group member' do
find('.user-search-btn').click
end
- group_members_list = find(".card .content-list")
+ group_members_list = find('[data-qa-selector="members_list"]')
expect(group_members_list).to have_content(member.name)
expect(group_members_list).not_to have_content(user.name)
end