debian-mirror-gitlab/spec/features/groups/members/manage_groups_spec.rb

71 lines
1.8 KiB
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'Groups > Members > Manage groups', :js do
2020-03-13 15:44:24 +05:30
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
2020-05-24 23:13:21 +05:30
it 'add group to group' do
visit group_group_members_path(shared_group)
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
add_group(shared_with_group.id, 'Reporter')
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
page.within(first_row) do
expect(page).to have_content(shared_with_group.name)
expect(page).to have_content('Reporter')
2020-03-13 15:44:24 +05:30
end
2020-05-24 23:13:21 +05:30
end
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
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)
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
visit group_group_members_path(shared_group)
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
expect(page).to have_content(shared_with_group.name)
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
accept_confirm do
find(:css, '#existing_shares li', text: shared_with_group.name).find(:css, 'a.btn-remove').click
2020-03-13 15:44:24 +05:30
end
2020-05-24 23:13:21 +05:30
wait_for_requests
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
expect(page).not_to have_content(shared_with_group.name)
end
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
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)
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
visit group_group_members_path(shared_group)
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
page.within(first_row) do
click_button('Developer')
click_link('Maintainer')
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
wait_for_requests
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
expect(page).to have_button('Maintainer')
2020-03-13 15:44:24 +05:30
end
2020-05-24 23:13:21 +05:30
end
2020-03-13 15:44:24 +05:30
2020-05-24 23:13:21 +05:30
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"
2020-03-13 15:44:24 +05:30
end
end
end