diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/features/groups | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/features/groups')
-rw-r--r-- | spec/features/groups/import_export/connect_instance_spec.rb | 16 | ||||
-rw-r--r-- | spec/features/groups/navbar_spec.rb | 8 | ||||
-rw-r--r-- | spec/features/groups/settings/packages_and_registries_spec.rb | 68 | ||||
-rw-r--r-- | spec/features/groups/show_spec.rb | 1 |
4 files changed, 78 insertions, 15 deletions
diff --git a/spec/features/groups/import_export/connect_instance_spec.rb b/spec/features/groups/import_export/connect_instance_spec.rb index 2e1bf27ba8b..73de49101ea 100644 --- a/spec/features/groups/import_export/connect_instance_spec.rb +++ b/spec/features/groups/import_export/connect_instance_spec.rb @@ -23,8 +23,8 @@ RSpec.describe 'Import/Export - Connect to another instance', :js do source_url = 'https://gitlab.com' pat = 'demo-pat' stub_path = 'stub-group' - - stub_request(:get, "%{url}/api/v4/groups?page=1&per_page=30&top_level_only=true&min_access_level=40" % { url: source_url }).to_return( + total = 37 + stub_request(:get, "%{url}/api/v4/groups?page=1&per_page=20&top_level_only=true&min_access_level=40&search=" % { url: source_url }).to_return( body: [{ id: 2595438, web_url: 'https://gitlab.com/groups/auto-breakfast', @@ -33,17 +33,25 @@ RSpec.describe 'Import/Export - Connect to another instance', :js do full_name: 'Stub', full_path: stub_path }].to_json, - headers: { 'Content-Type' => 'application/json' } + headers: { + 'Content-Type' => 'application/json', + 'X-Next-Page' => 2, + 'X-Page' => 1, + 'X-Per-Page' => 20, + 'X-Total' => total, + 'X-Total-Pages' => 2 + } ) 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 click_on 'Connect instance' - expect(page).to have_content 'Importing groups from %{url}' % { url: source_url } + expect(page).to have_content 'Showing 1-1 of %{total} groups from %{url}' % { url: source_url, total: total } expect(page).to have_content stub_path end end diff --git a/spec/features/groups/navbar_spec.rb b/spec/features/groups/navbar_spec.rb index a4c450c9a2c..7025874a4ff 100644 --- a/spec/features/groups/navbar_spec.rb +++ b/spec/features/groups/navbar_spec.rb @@ -87,12 +87,4 @@ RSpec.describe 'Group navbar' do it_behaves_like 'verified navigation bar' end - - context 'when invite team members is not available' do - it 'does not display the js-invite-members-trigger' do - visit group_path(group) - - expect(page).not_to have_selector('.js-invite-members-trigger') - end - end end diff --git a/spec/features/groups/settings/packages_and_registries_spec.rb b/spec/features/groups/settings/packages_and_registries_spec.rb index b8ffd73335d..45ea77e3868 100644 --- a/spec/features/groups/settings/packages_and_registries_spec.rb +++ b/spec/features/groups/settings/packages_and_registries_spec.rb @@ -7,15 +7,17 @@ RSpec.describe 'Group Packages & Registries settings' do let(:user) { create(:user) } let(:group) { create(:group) } + let(:sub_group) { create(:group, parent: group) } before do group.add_owner(user) + sub_group.add_owner(user) sign_in(user) end - context 'when the feature flag is off' do + context 'when packges feature is disabled on the group' do before do - stub_feature_flags(packages_and_registries_group_settings: false) + stub_packages_setting(enabled: false) end it 'the menu item is not visible' do @@ -25,9 +27,15 @@ RSpec.describe 'Group Packages & Registries settings' do expect(settings_menu).not_to have_content 'Packages & Registries' end + + it 'renders 404 when navigating to page' do + visit_settings_page + + expect(page).to have_content('Not Found') + end end - context 'when the feature flag is on' do + context 'when packages feature is enabled on the group' do it 'the menu item is visible' do visit group_path(group) @@ -47,6 +55,56 @@ RSpec.describe 'Group Packages & Registries settings' do sidebar = find('.nav-sidebar') expect(sidebar).to have_link _('Packages & Registries') end + + it 'has a Package Registry section', :js do + visit_settings_page + + expect(page).to have_content('Package Registry') + expect(page).to have_button('Collapse') + end + + it 'automatically saves changes to the server', :js do + visit_settings_page + + expect(page).to have_content('Allow duplicates') + + find('.gl-toggle').click + + expect(page).to have_content('Do not allow duplicates') + + visit_settings_page + + expect(page).to have_content('Do not allow duplicates') + end + + it 'shows an error on wrong regex', :js do + visit_settings_page + + expect(page).to have_content('Allow duplicates') + + find('.gl-toggle').click + + expect(page).to have_content('Do not allow duplicates') + + fill_in 'Exceptions', with: ')' + + # simulate blur event + find('body').click + + expect(page).to have_content('is an invalid regexp') + end + + context 'in a sub group' do + it 'works correctly', :js do + visit_sub_group_settings_page + + expect(page).to have_content('Allow duplicates') + + find('.gl-toggle').click + + expect(page).to have_content('Do not allow duplicates') + end + end end def find_settings_menu @@ -56,4 +114,8 @@ RSpec.describe 'Group Packages & Registries settings' do def visit_settings_page visit group_settings_packages_and_registries_path(group) end + + def visit_sub_group_settings_page + visit group_settings_packages_and_registries_path(sub_group) + end end diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb index 3a42fd508b4..5067f11be67 100644 --- a/spec/features/groups/show_spec.rb +++ b/spec/features/groups/show_spec.rb @@ -163,6 +163,7 @@ RSpec.describe 'Group show page' do let!(:project) { create(:project, namespace: group) } before do + stub_feature_flags(vue_notification_dropdown: false) group.add_maintainer(maintainer) sign_in(maintainer) end |