Commit cd2c7262 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo Committed by Brandon Labuschagne

Add feature spec for group transfer settings

Updates the group settings spec to include tests
for transferring a subgroup or a root level group
to another namespace
parent c8780dfb
...@@ -64,6 +64,7 @@ export default { ...@@ -64,6 +64,7 @@ export default {
:empty-namespace-title="$options.i18n.emptyNamespaceTitle" :empty-namespace-title="$options.i18n.emptyNamespaceTitle"
:include-headers="false" :include-headers="false"
include-empty-namespace include-empty-namespace
data-testid="transfer-group-namespace-select"
@select="handleSelected" @select="handleSelected"
/> />
<input type="hidden" name="new_parent_group_id" :value="selectedId" /> <input type="hidden" name="new_parent_group_id" :value="selectedId" />
......
...@@ -138,6 +138,51 @@ RSpec.describe 'Edit group settings' do ...@@ -138,6 +138,51 @@ RSpec.describe 'Edit group settings' do
end end
end end
describe 'transfer group', :js do
let(:namespace_select) { page.find('[data-testid="transfer-group-namespace-select"]') }
let(:confirm_modal) { page.find('[data-testid="confirm-danger-modal"]') }
shared_examples 'can transfer the group' do
before do
selected_group.add_owner(user)
end
it 'can successfully transfer the group' do
visit edit_group_path(selected_group)
page.within('.js-group-transfer-form') do
namespace_select.find('button').click
namespace_select.find('.dropdown-menu p', text: target_group_name, match: :first).click
click_button "Transfer group"
end
page.within(confirm_modal) do
expect(page).to have_text "You are going to transfer #{selected_group.name} to another namespace. Are you ABSOLUTELY sure? "
fill_in "confirm_name_input", with: selected_group.name
click_button "Confirm"
end
expect(page).to have_text "Group '#{selected_group.name}' was successfully transferred."
end
end
context 'with a sub group' do
let(:selected_group) { create(:group, path: 'foo-subgroup', parent: group) }
let(:target_group_name) { "No parent group" }
it_behaves_like 'can transfer the group'
end
context 'with a root group' do
let(:selected_group) { create(:group, path: 'foo-rootgroup') }
let(:target_group_name) { group.name }
it_behaves_like 'can transfer the group'
end
end
context 'disable email notifications' do context 'disable email notifications' do
it 'is visible' do it 'is visible' do
visit edit_group_path(group) visit edit_group_path(group)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment