diff options
Diffstat (limited to 'spec/features/groups')
-rw-r--r-- | spec/features/groups/clusters/eks_spec.rb | 37 | ||||
-rw-r--r-- | spec/features/groups/crm/contacts/create_spec.rb | 28 | ||||
-rw-r--r-- | spec/features/groups/dependency_proxy_spec.rb | 16 | ||||
-rw-r--r-- | spec/features/groups/empty_states_spec.rb | 18 | ||||
-rw-r--r-- | spec/features/groups/group_settings_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/groups/issues_spec.rb | 65 | ||||
-rw-r--r-- | spec/features/groups/members/manage_groups_spec.rb | 138 | ||||
-rw-r--r-- | spec/features/groups/settings/ci_cd_spec.rb | 65 |
8 files changed, 81 insertions, 288 deletions
diff --git a/spec/features/groups/clusters/eks_spec.rb b/spec/features/groups/clusters/eks_spec.rb deleted file mode 100644 index 0e64a2faf3e..00000000000 --- a/spec/features/groups/clusters/eks_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Group AWS EKS Cluster', :js do - let(:group) { create(:group) } - let(:user) { create(:user) } - - before do - group.add_maintainer(user) - gitlab_sign_in(user) - - allow(Groups::ClustersController).to receive(:STATUS_POLLING_INTERVAL) { 100 } - allow_any_instance_of(Clusters::Kubernetes::CreateOrUpdateNamespaceService).to receive(:execute) - allow_any_instance_of(Clusters::Cluster).to receive(:retrieve_connection_status).and_return(:connected) - stub_application_setting(eks_integration_enabled: true) - end - - context 'when user does not have a cluster and visits group clusters page' do - before do - visit group_clusters_path(group) - - click_button(class: 'dropdown-toggle-split') - click_link 'Create a cluster (deprecated)' - end - - context 'when user creates a cluster on AWS EKS' do - before do - click_link 'Amazon EKS' - end - - it 'user sees a form to create an EKS cluster' do - expect(page).to have_content('Authenticate with Amazon Web Services') - end - end - end -end diff --git a/spec/features/groups/crm/contacts/create_spec.rb b/spec/features/groups/crm/contacts/create_spec.rb new file mode 100644 index 00000000000..d6c6e3f1745 --- /dev/null +++ b/spec/features/groups/crm/contacts/create_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Create a CRM contact', :js do + let(:user) { create(:user) } + let(:group) { create(:group, :crm_enabled) } + let!(:organization) { create(:organization, group: group, name: 'GitLab') } + + before do + group.add_owner(user) + sign_in(user) + visit new_group_crm_contact_path(group) + end + + it 'creates a new contact' do + fill_in 'firstName', with: 'Forename' + fill_in 'lastName', with: 'Surname' + fill_in 'email', with: 'gitlab@example.com' + fill_in 'phone', with: '01234 555666' + select 'GitLab', from: 'organizationId' + fill_in 'description', with: 'VIP' + click_button 'Save changes' + + expect(page).to have_content 'gitlab@example.com' + expect(page).to have_current_path("#{group_crm_contacts_path(group)}/", ignore_query: true) + end +end diff --git a/spec/features/groups/dependency_proxy_spec.rb b/spec/features/groups/dependency_proxy_spec.rb index 623fb065bfc..af9c4a40729 100644 --- a/spec/features/groups/dependency_proxy_spec.rb +++ b/spec/features/groups/dependency_proxy_spec.rb @@ -88,22 +88,6 @@ RSpec.describe 'Group Dependency Proxy' do sign_in(owner) end - context 'feature flag is disabled', :js do - before do - stub_feature_flags(dependency_proxy_for_private_groups: false) - end - - context 'group is private' do - let(:group) { create(:group, :private) } - - it 'informs user that feature is only available for public groups' do - visit path - - expect(page).to have_content('Dependency Proxy feature is limited to public groups for now.') - end - end - end - context 'feature is disabled globally' do it 'renders 404 page' do disable_feature diff --git a/spec/features/groups/empty_states_spec.rb b/spec/features/groups/empty_states_spec.rb index 0317f9162cc..71f38401fa1 100644 --- a/spec/features/groups/empty_states_spec.rb +++ b/spec/features/groups/empty_states_spec.rb @@ -7,6 +7,8 @@ RSpec.describe 'Group empty states' do let(:user) { create(:group_member, :developer, user: create(:user), group: group ).user } before do + stub_feature_flags(vue_issues_list: true) + sign_in(user) end @@ -100,21 +102,23 @@ RSpec.describe 'Group empty states' do end it "the new #{issuable_name} button opens a project dropdown" do - within '.empty-state' do - click_button 'Toggle project select' - end + click_button 'Toggle project select' - expect(page).to have_selector('.ajax-project-dropdown') + if issuable == :issue + expect(page).to have_button project.name + else + expect(page).to have_selector('.ajax-project-dropdown') + end end end end shared_examples "no projects" do - it 'displays an empty state' do + it 'displays an empty state', :js do expect(page).to have_selector('.empty-state') end - it "does not show a new #{issuable_name} button" do + it "does not show a new #{issuable_name} button", :js do within '.empty-state' do expect(page).not_to have_link("create #{issuable_name}") end @@ -143,7 +147,7 @@ RSpec.describe 'Group empty states' do visit path end - it 'displays an empty state' do + it 'displays an empty state', :js do expect(page).to have_selector('.empty-state') end end diff --git a/spec/features/groups/group_settings_spec.rb b/spec/features/groups/group_settings_spec.rb index 50982cb1452..019b094ccb5 100644 --- a/spec/features/groups/group_settings_spec.rb +++ b/spec/features/groups/group_settings_spec.rb @@ -223,7 +223,7 @@ RSpec.describe 'Edit group settings' do check 'group_prevent_sharing_groups_outside_hierarchy' expect { save_permissions_group }.to change { - group.reload.namespace_settings.prevent_sharing_groups_outside_hierarchy + group.reload.prevent_sharing_groups_outside_hierarchy }.to(true) end diff --git a/spec/features/groups/issues_spec.rb b/spec/features/groups/issues_spec.rb index 6b663445124..ef3346b9763 100644 --- a/spec/features/groups/issues_spec.rb +++ b/spec/features/groups/issues_spec.rb @@ -11,6 +11,10 @@ RSpec.describe 'Group issues page' do let(:project_with_issues_disabled) { create(:project, :issues_disabled, group: group) } let(:path) { issues_group_path(group) } + before do + stub_feature_flags(vue_issues_list: true) + end + context 'with shared examples', :js do let(:issuable) { create(:issue, project: project, title: "this is my created issuable")} @@ -58,10 +62,10 @@ RSpec.describe 'Group issues page' do let(:user2) { user_outside_group } it 'filters by only group users' do - filtered_search.set('assignee:=') + select_tokens 'Assignee', '=' - expect(find('#js-dropdown-assignee .filter-dropdown')).to have_content(user.name) - expect(find('#js-dropdown-assignee .filter-dropdown')).not_to have_content(user2.name) + expect_suggestion(user.name) + expect_no_suggestion(user2.name) end end end @@ -76,23 +80,9 @@ RSpec.describe 'Group issues page' do it 'returns all group and subgroup issues' do visit issues_group_path(group) - page.within('.issuable-list') do - expect(page).to have_selector('li.issue', count: 2) - expect(page).to have_content('root group issue') - expect(page).to have_content('subgroup issue') - end - end - - it 'truncates issue counts if over the threshold', :clean_gitlab_redis_cache do - allow(Rails.cache).to receive(:read).and_call_original - allow(Rails.cache).to receive(:read).with( - ['group', group.id, 'issues'], - { expires_in: Gitlab::IssuablesCountForState::CACHE_EXPIRES_IN } - ).and_return({ opened: 1050, closed: 500, all: 1550 }) - - visit issues_group_path(group) - - expect(page).to have_text('Open 1.1k Closed 500 All 1.6k') + expect(page).to have_selector('li.issue', count: 2) + expect(page).to have_content('root group issue') + expect(page).to have_content('subgroup issue') end context 'when project is archived' do @@ -115,7 +105,6 @@ RSpec.describe 'Group issues page' do let!(:subgroup_issue) { create(:issue, project: subgroup_project) } before do - stub_feature_flags(vue_issues_list: true) visit issues_group_path(group_with_no_issues) end @@ -135,14 +124,10 @@ RSpec.describe 'Group issues page' do end it 'shows projects only with issues feature enabled', :js do - within '.empty-state' do - click_button 'Toggle project select' - end + click_button 'Toggle project select' - page.within('.select2-results') do - expect(page).to have_content(project.full_name) - expect(page).not_to have_content(project_with_issues_disabled.full_name) - end + expect(page).to have_button project.full_name + expect(page).not_to have_button project_with_issues_disabled.full_name end end end @@ -155,15 +140,15 @@ RSpec.describe 'Group issues page' do let!(:issue3) { create(:issue, project: project, title: 'Issue #3', relative_position: 3) } before do + stub_feature_flags(vue_issues_list: false) + sign_in(user_in_group) end it 'displays all issues' do visit issues_group_path(group, sort: 'relative_position') - page.within('.issues-list') do - expect(page).to have_selector('li.issue', count: 3) - end + expect(page).to have_selector('li.issue', count: 3) end it 'has manual-ordering css applied' do @@ -218,11 +203,9 @@ RSpec.describe 'Group issues page' do end def check_issue_order - page.within('.manual-ordering') do - expect(find('.issue:nth-child(1) .title')).to have_content('Issue #2') - expect(find('.issue:nth-child(2) .title')).to have_content('Issue #3') - expect(find('.issue:nth-child(3) .title')).to have_content('Issue #1') - end + expect(page).to have_css('.issue:nth-child(1) .title', text: 'Issue #2') + expect(page).to have_css('.issue:nth-child(2) .title', text: 'Issue #3') + expect(page).to have_css('.issue:nth-child(3) .title', text: 'Issue #1') end end @@ -239,14 +222,8 @@ RSpec.describe 'Group issues page' do end it 'shows the pagination' do - expect(page).to have_link 'Prev' - expect(page).to have_link 'Next' - end - - it 'first pagination item is active' do - page.within('.gl-pagination') do - expect(find('li.active')).to have_content('1') - end + expect(page).to have_button 'Prev', disabled: true + expect(page).to have_button 'Next' end end end diff --git a/spec/features/groups/members/manage_groups_spec.rb b/spec/features/groups/members/manage_groups_spec.rb index 5a9223d9ee8..e4252e2f3aa 100644 --- a/spec/features/groups/members/manage_groups_spec.rb +++ b/spec/features/groups/members/manage_groups_spec.rb @@ -119,141 +119,11 @@ RSpec.describe 'Groups > Members > Manage groups', :js do describe 'group search results' do let_it_be(:group, refind: true) { create(:group) } - context 'with instance admin considerations' do - let_it_be(:group_to_share) { create(:group) } - - context 'when user is an admin' do - let_it_be(:admin) { create(:admin) } - - before do - sign_in(admin) - gitlab_enable_admin_mode_sign_in(admin) - end - - it 'shows groups where the admin has no direct membership' do - visit group_group_members_path(group) - - click_on 'Invite a group' - click_on 'Select a group' - wait_for_requests - - page.within(group_dropdown_selector) do - expect_to_have_group(group_to_share) - expect_not_to_have_group(group) - end - end - - it 'shows groups where the admin has at least guest level membership' do - group_to_share.add_guest(admin) - - visit group_group_members_path(group) - - click_on 'Invite a group' - click_on 'Select a group' - wait_for_requests - - page.within(group_dropdown_selector) do - expect_to_have_group(group_to_share) - expect_not_to_have_group(group) - end - end - end - - context 'when user is not an admin' do - before do - group.add_owner(user) - end - - it 'shows groups where the user has no direct membership' do - visit group_group_members_path(group) - - click_on 'Invite a group' - click_on 'Select a group' - wait_for_requests - - page.within(group_dropdown_selector) do - expect_not_to_have_group(group_to_share) - expect_not_to_have_group(group) - end - end - - it 'shows groups where the user has at least guest level membership' do - group_to_share.add_guest(user) - - visit group_group_members_path(group) - - click_on 'Invite a group' - click_on 'Select a group' - wait_for_requests - - page.within(group_dropdown_selector) do - expect_to_have_group(group_to_share) - expect_not_to_have_group(group) - end - end - end - end - - context 'when user is not an admin and there are hierarchy considerations' do + it_behaves_like 'inviting groups search results' do + let_it_be(:entity) { group } let_it_be(:group_within_hierarchy) { create(:group, parent: group) } - let_it_be(:group_outside_hierarchy) { create(:group) } - - before_all do - group.add_owner(user) - group_within_hierarchy.add_owner(user) - group_outside_hierarchy.add_owner(user) - end - - it 'does not show self or ancestors', :aggregate_failures do - group_sibbling = create(:group, parent: group) - group_sibbling.add_owner(user) - - visit group_group_members_path(group_within_hierarchy) - - click_on 'Invite a group' - click_on 'Select a group' - wait_for_requests - - page.within(group_dropdown_selector) do - expect_to_have_group(group_outside_hierarchy) - expect_to_have_group(group_sibbling) - expect_not_to_have_group(group) - expect_not_to_have_group(group_within_hierarchy) - end - end - - context 'when sharing with groups outside the hierarchy is enabled' do - it 'shows groups within and outside the hierarchy in search results' do - visit group_group_members_path(group) - - click_on 'Invite a group' - click_on 'Select a group' - wait_for_requests - - page.within(group_dropdown_selector) do - expect_to_have_group(group_within_hierarchy) - expect_to_have_group(group_outside_hierarchy) - end - end - end - - context 'when sharing with groups outside the hierarchy is disabled' do - before do - group.namespace_settings.update!(prevent_sharing_groups_outside_hierarchy: true) - end - - it 'shows only groups within the hierarchy in search results' do - visit group_group_members_path(group) - - click_on 'Invite a group' - click_on 'Select a group' - - page.within(group_dropdown_selector) do - expect_to_have_group(group_within_hierarchy) - expect_not_to_have_group(group_outside_hierarchy) - end - end - end + let_it_be(:members_page_path) { group_group_members_path(entity) } + let_it_be(:members_page_path_within_hierarchy) { group_group_members_path(group_within_hierarchy) } end end end diff --git a/spec/features/groups/settings/ci_cd_spec.rb b/spec/features/groups/settings/ci_cd_spec.rb index c5ad524e647..50c481c115c 100644 --- a/spec/features/groups/settings/ci_cd_spec.rb +++ b/spec/features/groups/settings/ci_cd_spec.rb @@ -17,62 +17,29 @@ RSpec.describe 'Group CI/CD settings' do end describe 'Runners section' do - let(:shared_runners_toggle) { page.find('[data-testid="enable-runners-toggle"]') } + let(:shared_runners_toggle) { page.find('[data-testid="shared-runners-toggle"]') } - context 'with runner_list_group_view_vue_ui enabled' do - before do - visit group_settings_ci_cd_path(group) - end - - it 'displays the new group runners view banner' do - expect(page).to have_content(s_('Runners|New group runners view')) - expect(page).to have_link(href: group_runners_path(group)) - end - - it 'has "Enable shared runners for this group" toggle', :js do - expect(shared_runners_toggle).to have_content(_('Enable shared runners for this group')) - end + before do + visit group_settings_ci_cd_path(group) end - context 'with runner_list_group_view_vue_ui disabled' do - before do - stub_feature_flags(runner_list_group_view_vue_ui: false) - - visit group_settings_ci_cd_path(group) - end - - it 'does not display the new group runners view banner' do - expect(page).not_to have_content(s_('Runners|New group runners view')) - expect(page).not_to have_link(href: group_runners_path(group)) - end - - it 'has "Enable shared runners for this group" toggle', :js do - expect(shared_runners_toggle).to have_content(_('Enable shared runners for this group')) - end - - context 'with runners registration token' do - let!(:token) { group.runners_token } - - before do - visit group_settings_ci_cd_path(group) - end + it 'displays the new group runners view banner' do + expect(page).to have_content(s_('Runners|New group runners view')) + expect(page).to have_link(href: group_runners_path(group)) + end - it 'displays the registration token' do - expect(page.find('#registration_token')).to have_content(token) - end + it 'has "Enable shared runners for this group" toggle', :js do + expect(shared_runners_toggle).to have_content(_('Enable shared runners for this group')) + end - describe 'reload registration token' do - let(:page_token) { find('#registration_token').text } + it 'clicks on toggle to enable setting', :js do + expect(group.shared_runners_setting).to be(Namespace::SR_ENABLED) - before do - click_button 'Reset registration token' - end + shared_runners_toggle.find('button').click + wait_for_requests - it 'changes the registration token' do - expect(page_token).not_to eq token - end - end - end + group.reload + expect(group.shared_runners_setting).to be(Namespace::SR_DISABLED_AND_UNOVERRIDABLE) end end |