Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-17 00:08:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-17 00:08:30 +0300
commitaf11eb63cf4eaab8801416cc4a65f0bd4fad8817 (patch)
tree1159645ca9b4034aaac935c4b62752ff3f28b7e8 /spec/features/groups
parent0122d00cac3c058508a2fcb258f12ecfb7bc9055 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/groups')
-rw-r--r--spec/features/groups/import_export/connect_instance_spec.rb106
1 files changed, 64 insertions, 42 deletions
diff --git a/spec/features/groups/import_export/connect_instance_spec.rb b/spec/features/groups/import_export/connect_instance_spec.rb
index 3b461739b4c..11cc4bb9b37 100644
--- a/spec/features/groups/import_export/connect_instance_spec.rb
+++ b/spec/features/groups/import_export/connect_instance_spec.rb
@@ -10,74 +10,96 @@ RSpec.describe 'Import/Export - Connect to another instance', :js, feature_categ
group.add_owner(user)
end
- before do
- gitlab_sign_in(user)
+ context 'when importing group by direct transfer is enabled' do
+ before do
+ stub_application_setting(bulk_import_enabled: true)
- visit new_group_path
+ open_import_group
+ end
- click_link 'Import group'
- end
+ context 'when the user provides valid credentials' do
+ source_url = 'https://gitlab.com'
- context 'when the user provides valid credentials' do
- source_url = 'https://gitlab.com'
+ include_context 'bulk imports requests context', source_url
- include_context 'bulk imports requests context', source_url
+ it 'successfully connects to remote instance' do
+ pat = 'demo-pat'
- it 'successfully connects to remote instance' do
- pat = 'demo-pat'
+ expect(page).to have_content 'Import groups from another instance of GitLab'
+ expect(page).to have_content 'Not all related objects are migrated'
- expect(page).to have_content 'Import groups from another instance of GitLab'
- expect(page).to have_content 'Not all related objects are migrated'
+ fill_in :bulk_import_gitlab_url, with: source_url
+ fill_in :bulk_import_gitlab_access_token, with: pat
- fill_in :bulk_import_gitlab_url, with: source_url
- fill_in :bulk_import_gitlab_access_token, with: pat
+ click_on 'Connect instance'
- click_on 'Connect instance'
+ expect(page).to have_content 'Showing 1-1 of 42 groups that you own from %{url}' % { url: source_url }
+ expect(page).to have_content 'stub-group'
- expect(page).to have_content 'Showing 1-1 of 42 groups that you own from %{url}' % { url: source_url }
- expect(page).to have_content 'stub-group'
+ visit '/'
- visit '/'
+ wait_for_all_requests
+ end
+ end
+
+ context 'when the user provides invalid url' do
+ it 'reports an error' do
+ source_url = 'invalid-url'
+ pat = 'demo-pat'
+
+ fill_in :bulk_import_gitlab_url, with: source_url
+ fill_in :bulk_import_gitlab_access_token, with: pat
- wait_for_all_requests
+ click_on 'Connect instance'
+
+ expect(page).to have_content 'Specified URL cannot be used'
+ end
end
- end
- context 'when the user provides invalid url' do
- it 'reports an error' do
- source_url = 'invalid-url'
- pat = 'demo-pat'
+ context 'when the user does not fill in source URL' do
+ it 'reports an error' do
+ pat = 'demo-pat'
- fill_in :bulk_import_gitlab_url, with: source_url
- fill_in :bulk_import_gitlab_access_token, with: pat
+ fill_in :bulk_import_gitlab_access_token, with: pat
- click_on 'Connect instance'
+ click_on 'Connect instance'
- expect(page).to have_content 'Specified URL cannot be used'
+ expect(page).to have_content 'Please fill in GitLab source URL'
+ end
end
- end
- context 'when the user does not fill in source URL' do
- it 'reports an error' do
- pat = 'demo-pat'
+ context 'when the user does not fill in access token' do
+ it 'reports an error' do
+ source_url = 'https://gitlab.com'
- fill_in :bulk_import_gitlab_access_token, with: pat
+ fill_in :bulk_import_gitlab_url, with: source_url
- click_on 'Connect instance'
+ click_on 'Connect instance'
- expect(page).to have_content 'Please fill in GitLab source URL'
+ expect(page).to have_content 'Please fill in your personal access token'
+ end
end
end
- context 'when the user does not fill in access token' do
- it 'reports an error' do
- source_url = 'https://gitlab.com'
-
- fill_in :bulk_import_gitlab_url, with: source_url
+ context 'when importing group by direct transfer is disabled' do
+ before do
+ stub_application_setting(bulk_import_enabled: false)
- click_on 'Connect instance'
+ open_import_group
+ end
- expect(page).to have_content 'Please fill in your personal access token'
+ it 'renders fields and button disabled' do
+ expect(page).to have_field('GitLab source URL', disabled: true)
+ expect(page).to have_field('Personal access token', disabled: true)
+ expect(page).to have_button('Connect instance', disabled: true)
end
end
+
+ def open_import_group
+ gitlab_sign_in(user)
+
+ visit new_group_path
+
+ click_link 'Import group'
+ end
end