diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 14:59:07 +0300 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /spec/features/groups | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'spec/features/groups')
-rw-r--r-- | spec/features/groups/board_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/groups/container_registry_spec.rb | 7 | ||||
-rw-r--r-- | spec/features/groups/dependency_proxy_spec.rb | 16 | ||||
-rw-r--r-- | spec/features/groups/import_export/connect_instance_spec.rb | 88 | ||||
-rw-r--r-- | spec/features/groups/import_export/import_file_spec.rb | 8 | ||||
-rw-r--r-- | spec/features/groups/members/filter_members_spec.rb | 26 | ||||
-rw-r--r-- | spec/features/groups/members/search_members_spec.rb | 7 | ||||
-rw-r--r-- | spec/features/groups/members/sort_members_spec.rb | 204 | ||||
-rw-r--r-- | spec/features/groups/members/tabs_spec.rb | 14 | ||||
-rw-r--r-- | spec/features/groups/navbar_spec.rb | 1 | ||||
-rw-r--r-- | spec/features/groups/show_spec.rb | 65 |
11 files changed, 349 insertions, 89 deletions
diff --git a/spec/features/groups/board_spec.rb b/spec/features/groups/board_spec.rb index 29d0347086c..b25aa26d906 100644 --- a/spec/features/groups/board_spec.rb +++ b/spec/features/groups/board_spec.rb @@ -16,7 +16,7 @@ RSpec.describe 'Group Boards' do visit group_boards_path(group) end - it 'Adds an issue to the backlog' do + it 'adds an issue to the backlog' do page.within(find('.board', match: :first)) do issue_title = 'New Issue' find(:css, '.issue-count-badge-add-button').click diff --git a/spec/features/groups/container_registry_spec.rb b/spec/features/groups/container_registry_spec.rb index 1b23b8b4bf9..cacabdda22d 100644 --- a/spec/features/groups/container_registry_spec.rb +++ b/spec/features/groups/container_registry_spec.rb @@ -51,13 +51,6 @@ RSpec.describe 'Container Registry', :js do expect(page).to have_content 'my/image' end - it 'image repository delete is disabled' do - visit_container_registry - - delete_btn = find('[title="Remove repository"]') - expect(delete_btn).to be_disabled - end - it 'navigates to repo details' do visit_container_registry_details('my/image') diff --git a/spec/features/groups/dependency_proxy_spec.rb b/spec/features/groups/dependency_proxy_spec.rb index 9bbfdc488fb..51371ddc532 100644 --- a/spec/features/groups/dependency_proxy_spec.rb +++ b/spec/features/groups/dependency_proxy_spec.rb @@ -79,13 +79,19 @@ RSpec.describe 'Group Dependency Proxy' do sign_in(developer) end - context 'group is private' do - let(:group) { create(:group, :private) } + context 'feature flag is disabled' do + before do + stub_feature_flags(dependency_proxy_for_private_groups: false) + end - it 'informs user that feature is only available for public groups' do - visit path + context 'group is private' do + let(:group) { create(:group, :private) } - expect(page).to have_content('Dependency proxy feature is limited to public groups for now.') + 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 diff --git a/spec/features/groups/import_export/connect_instance_spec.rb b/spec/features/groups/import_export/connect_instance_spec.rb new file mode 100644 index 00000000000..c0f967fd0b9 --- /dev/null +++ b/spec/features/groups/import_export/connect_instance_spec.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe 'Import/Export - Connect to another instance', :js do + let_it_be(:user) { create(:user) } + let_it_be(:group) { create(:group) } + + before_all do + group.add_owner(user) + end + + before do + gitlab_sign_in(user) + + visit new_group_path + + find('#import-group-tab').click + end + + context 'when the user provides valid credentials' do + it 'successfully connects to remote instance' 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" % { url: source_url }).to_return( + body: [{ + id: 2595438, + web_url: 'https://gitlab.com/groups/auto-breakfast', + name: 'Stub', + path: stub_path, + full_name: 'Stub', + full_path: stub_path + }].to_json, + headers: { 'Content-Type' => 'application/json' } + ) + + expect(page).to have_content 'Import groups from another instance of GitLab' + + 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 stub_path + 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 + + click_on 'Connect instance' + + expect(page).to have_content 'Specified URL cannot be used' + end + end + + context 'when the user does not fill in source URL' do + it 'reports an error' do + pat = 'demo-pat' + + fill_in :bulk_import_gitlab_access_token, with: pat + + click_on 'Connect instance' + + expect(page).to have_content 'Please fill in GitLab source URL' + 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 + + click_on 'Connect instance' + + expect(page).to have_content 'Please fill in your personal access token' + end + end +end diff --git a/spec/features/groups/import_export/import_file_spec.rb b/spec/features/groups/import_export/import_file_spec.rb index f117b5d56e9..7018f3b1086 100644 --- a/spec/features/groups/import_export/import_file_spec.rb +++ b/spec/features/groups/import_export/import_file_spec.rb @@ -32,12 +32,12 @@ RSpec.describe 'Import/Export - Group Import', :js do fill_in :group_name, with: group_name find('#import-group-tab').click - expect(page).to have_content 'Import a GitLab group export file' + expect(page).to have_content 'Import group from file' attach_file(file) do find('.js-filepicker-button').click end - expect { click_on 'Import group' }.to change { Group.count }.by 1 + expect { click_on 'Import' }.to change { Group.count }.by 1 group = Group.find_by(name: group_name) @@ -60,7 +60,7 @@ RSpec.describe 'Import/Export - Group Import', :js do find('.js-filepicker-button').click end - expect { click_on 'Import group' }.to change { Group.count }.by 1 + expect { click_on 'Import' }.to change { Group.count }.by 1 group = Group.find_by(name: 'Test Group Import') expect(group.path).to eq 'custom-path' @@ -94,7 +94,7 @@ RSpec.describe 'Import/Export - Group Import', :js do find('.js-filepicker-button').click end - expect { click_on 'Import group' }.not_to change { Group.count } + expect { click_on 'Import' }.not_to change { Group.count } page.within('.flash-container') do expect(page).to have_content('Unable to process group import file') diff --git a/spec/features/groups/members/filter_members_spec.rb b/spec/features/groups/members/filter_members_spec.rb index b6d33b3f4aa..917b35659a6 100644 --- a/spec/features/groups/members/filter_members_spec.rb +++ b/spec/features/groups/members/filter_members_spec.rb @@ -11,8 +11,7 @@ RSpec.describe 'Groups > Members > Filter members', :js do let(:group) { create(:group) } let(:nested_group) { create(:group, parent: group) } - two_factor_auth_dropdown_toggle_selector = '[data-testid="member-filter-2fa-dropdown"] [data-testid="dropdown-toggle"]' - active_inherited_members_filter_selector = '[data-testid="filter-members-with-inherited-permissions"] a.is-active' + filtered_search_bar_selector = '[data-testid="members-filtered-search-bar"]' before do group.add_owner(user) @@ -27,7 +26,6 @@ RSpec.describe 'Groups > Members > Filter members', :js do expect(member(0)).to include(user.name) expect(member(1)).to include(user_with_2fa.name) - expect(page).to have_css(two_factor_auth_dropdown_toggle_selector, text: 'Everyone') end it 'shows only 2FA members' do @@ -35,7 +33,10 @@ RSpec.describe 'Groups > Members > Filter members', :js do expect(member(0)).to include(user_with_2fa.name) expect(all_rows.size).to eq(1) - expect(page).to have_css(two_factor_auth_dropdown_toggle_selector, text: 'Enabled') + + within filtered_search_bar_selector do + expect(page).to have_content '2FA = Enabled' + end end it 'shows only non 2FA members' do @@ -43,7 +44,10 @@ RSpec.describe 'Groups > Members > Filter members', :js do expect(member(0)).to include(user.name) expect(all_rows.size).to eq(1) - expect(page).to have_css(two_factor_auth_dropdown_toggle_selector, text: 'Disabled') + + within filtered_search_bar_selector do + expect(page).to have_content '2FA = Disabled' + end end it 'shows inherited members by default' do @@ -53,15 +57,16 @@ RSpec.describe 'Groups > Members > Filter members', :js do expect(member(1)).to include(user_with_2fa.name) expect(member(2)).to include(nested_group_user.name) expect(all_rows.size).to eq(3) - - expect(page).to have_css(active_inherited_members_filter_selector, text: 'Show all members', visible: false) end it 'shows only group members' do visit_members_list(nested_group, with_inherited_permissions: 'exclude') expect(member(0)).to include(nested_group_user.name) expect(all_rows.size).to eq(1) - expect(page).to have_css(active_inherited_members_filter_selector, text: 'Show only direct members', visible: false) + + within filtered_search_bar_selector do + expect(page).to have_content 'Membership = Direct' + end end it 'shows only inherited members' do @@ -69,7 +74,10 @@ RSpec.describe 'Groups > Members > Filter members', :js do expect(member(0)).to include(user.name) expect(member(1)).to include(user_with_2fa.name) expect(all_rows.size).to eq(2) - expect(page).to have_css(active_inherited_members_filter_selector, text: 'Show only inherited members', visible: false) + + within filtered_search_bar_selector do + expect(page).to have_content 'Membership = Inherited' + end end def visit_members_list(group, options = {}) diff --git a/spec/features/groups/members/search_members_spec.rb b/spec/features/groups/members/search_members_spec.rb index 0b2d2fd478d..fe5fed307d7 100644 --- a/spec/features/groups/members/search_members_spec.rb +++ b/spec/features/groups/members/search_members_spec.rb @@ -21,9 +21,10 @@ RSpec.describe 'Search group member', :js do end it 'renders member users' do - page.within '[data-testid="user-search-form"]' do - fill_in 'search', with: member.name - find('[data-testid="user-search-submit"]').click + page.within '[data-testid="members-filtered-search-bar"]' do + find_field('Filter members').click + find('input').native.send_keys(member.name) + click_button 'Search' end expect(members_table).to have_content(member.name) diff --git a/spec/features/groups/members/sort_members_spec.rb b/spec/features/groups/members/sort_members_spec.rb index f03cc36df18..68a748aa76a 100644 --- a/spec/features/groups/members/sort_members_spec.rb +++ b/spec/features/groups/members/sort_members_spec.rb @@ -9,8 +9,6 @@ RSpec.describe 'Groups > Members > Sort members', :js do let(:developer) { create(:user, name: 'Mary Jane', last_sign_in_at: 5.days.ago) } let(:group) { create(:group) } - dropdown_toggle_selector = '[data-testid="user-sort-dropdown"] [data-testid="dropdown-toggle"]' - before do create(:group_member, :owner, user: owner, group: group, created_at: 5.days.ago) create(:group_member, :developer, user: developer, group: group, created_at: 3.days.ago) @@ -18,76 +16,174 @@ RSpec.describe 'Groups > Members > Sort members', :js do sign_in(owner) end - it 'sorts alphabetically by default' do - visit_members_list(sort: nil) + context 'when `group_members_filtered_search` feature flag is enabled' do + def expect_sort_by(text, sort_direction) + within('[data-testid="members-sort-dropdown"]') do + expect(page).to have_css('button[aria-haspopup="true"]', text: text) + expect(page).to have_button("Sorting Direction: #{sort_direction == :asc ? 'Ascending' : 'Descending'}") + end + end - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Name, ascending') - end + it 'sorts by account by default' do + visit_members_list(sort: nil) - it 'sorts by access level ascending' do - visit_members_list(sort: :access_level_asc) + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) - expect(first_row.text).to include(developer.name) - expect(second_row.text).to include(owner.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Access level, ascending') - end + expect_sort_by('Account', :asc) + end - it 'sorts by access level descending' do - visit_members_list(sort: :access_level_desc) + it 'sorts by max role ascending' do + visit_members_list(sort: :access_level_asc) - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Access level, descending') - end + expect(first_row.text).to include(developer.name) + expect(second_row.text).to include(owner.name) - it 'sorts by last joined' do - visit_members_list(sort: :last_joined) + expect_sort_by('Max role', :asc) + end - expect(first_row.text).to include(developer.name) - expect(second_row.text).to include(owner.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Last joined') - end + it 'sorts by max role descending' do + visit_members_list(sort: :access_level_desc) - it 'sorts by oldest joined' do - visit_members_list(sort: :oldest_joined) + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Oldest joined') - end + expect_sort_by('Max role', :desc) + end - it 'sorts by name ascending' do - visit_members_list(sort: :name_asc) + it 'sorts by access granted ascending' do + visit_members_list(sort: :last_joined) - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Name, ascending') - end + expect(first_row.text).to include(developer.name) + expect(second_row.text).to include(owner.name) - it 'sorts by name descending' do - visit_members_list(sort: :name_desc) + expect_sort_by('Access granted', :asc) + end - expect(first_row.text).to include(developer.name) - expect(second_row.text).to include(owner.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Name, descending') - end + it 'sorts by access granted descending' do + visit_members_list(sort: :oldest_joined) + + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) + + expect_sort_by('Access granted', :desc) + end + + it 'sorts by account ascending' do + visit_members_list(sort: :name_asc) + + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) + + expect_sort_by('Account', :asc) + end + + it 'sorts by account descending' do + visit_members_list(sort: :name_desc) + + expect(first_row.text).to include(developer.name) + expect(second_row.text).to include(owner.name) + + expect_sort_by('Account', :desc) + end + + it 'sorts by last sign-in ascending', :clean_gitlab_redis_shared_state do + visit_members_list(sort: :recent_sign_in) + + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) + + expect_sort_by('Last sign-in', :asc) + end - it 'sorts by recent sign in', :clean_gitlab_redis_shared_state do - visit_members_list(sort: :recent_sign_in) + it 'sorts by last sign-in descending', :clean_gitlab_redis_shared_state do + visit_members_list(sort: :oldest_sign_in) - expect(first_row.text).to include(owner.name) - expect(second_row.text).to include(developer.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Recent sign in') + expect(first_row.text).to include(developer.name) + expect(second_row.text).to include(owner.name) + + expect_sort_by('Last sign-in', :desc) + end end - it 'sorts by oldest sign in', :clean_gitlab_redis_shared_state do - visit_members_list(sort: :oldest_sign_in) + context 'when `group_members_filtered_search` feature flag is disabled' do + dropdown_toggle_selector = '[data-testid="user-sort-dropdown"] [data-testid="dropdown-toggle"]' + + before do + stub_feature_flags(group_members_filtered_search: false) + end + + it 'sorts alphabetically by default' do + visit_members_list(sort: nil) + + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) + expect(page).to have_css(dropdown_toggle_selector, text: 'Name, ascending') + end + + it 'sorts by access level ascending' do + visit_members_list(sort: :access_level_asc) + + expect(first_row.text).to include(developer.name) + expect(second_row.text).to include(owner.name) + expect(page).to have_css(dropdown_toggle_selector, text: 'Access level, ascending') + end + + it 'sorts by access level descending' do + visit_members_list(sort: :access_level_desc) + + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) + expect(page).to have_css(dropdown_toggle_selector, text: 'Access level, descending') + end + + it 'sorts by last joined' do + visit_members_list(sort: :last_joined) + + expect(first_row.text).to include(developer.name) + expect(second_row.text).to include(owner.name) + expect(page).to have_css(dropdown_toggle_selector, text: 'Last joined') + end + + it 'sorts by oldest joined' do + visit_members_list(sort: :oldest_joined) + + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) + expect(page).to have_css(dropdown_toggle_selector, text: 'Oldest joined') + end + + it 'sorts by name ascending' do + visit_members_list(sort: :name_asc) + + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) + expect(page).to have_css(dropdown_toggle_selector, text: 'Name, ascending') + end + + it 'sorts by name descending' do + visit_members_list(sort: :name_desc) + + expect(first_row.text).to include(developer.name) + expect(second_row.text).to include(owner.name) + expect(page).to have_css(dropdown_toggle_selector, text: 'Name, descending') + end + + it 'sorts by recent sign in', :clean_gitlab_redis_shared_state do + visit_members_list(sort: :recent_sign_in) + + expect(first_row.text).to include(owner.name) + expect(second_row.text).to include(developer.name) + expect(page).to have_css(dropdown_toggle_selector, text: 'Recent sign in') + end + + it 'sorts by oldest sign in', :clean_gitlab_redis_shared_state do + visit_members_list(sort: :oldest_sign_in) - expect(first_row.text).to include(developer.name) - expect(second_row.text).to include(owner.name) - expect(page).to have_css(dropdown_toggle_selector, text: 'Oldest sign in') + expect(first_row.text).to include(developer.name) + expect(second_row.text).to include(owner.name) + expect(page).to have_css(dropdown_toggle_selector, text: 'Oldest sign in') + end end def visit_members_list(sort:) diff --git a/spec/features/groups/members/tabs_spec.rb b/spec/features/groups/members/tabs_spec.rb index fa77d1a2ff8..2f95e9fa6d3 100644 --- a/spec/features/groups/members/tabs_spec.rb +++ b/spec/features/groups/members/tabs_spec.rb @@ -62,9 +62,10 @@ RSpec.describe 'Groups > Members > Tabs' do click_link 'Invited' - page.within '[data-testid="user-search-form"]' do - fill_in 'search_invited', with: 'email' - find('button[type="submit"]').click + page.within '[data-testid="members-filtered-search-bar"]' do + find_field('Search invited').click + find('input').native.send_keys('email') + click_button 'Search' end end @@ -74,9 +75,10 @@ RSpec.describe 'Groups > Members > Tabs' do before do click_link 'Members' - page.within '[data-testid="user-search-form"]' do - fill_in 'search', with: 'test' - find('button[type="submit"]').click + page.within '[data-testid="members-filtered-search-bar"]' do + find_field('Filter members').click + find('input').native.send_keys('test') + click_button 'Search' end end diff --git a/spec/features/groups/navbar_spec.rb b/spec/features/groups/navbar_spec.rb index dec07eb3783..a4c450c9a2c 100644 --- a/spec/features/groups/navbar_spec.rb +++ b/spec/features/groups/navbar_spec.rb @@ -33,6 +33,7 @@ RSpec.describe 'Group navbar' do nav_item: _('Merge Requests'), nav_sub_items: [] }, + (security_and_compliance_nav_item if Gitlab.ee?), (push_rules_nav_item if Gitlab.ee?), { nav_item: _('Kubernetes'), diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb index 97732374eb9..3a42fd508b4 100644 --- a/spec/features/groups/show_spec.rb +++ b/spec/features/groups/show_spec.rb @@ -193,4 +193,69 @@ RSpec.describe 'Group show page' do it_behaves_like 'page meta description', 'Lorem ipsum dolor sit amet' end + + context 'structured schema markup' do + let_it_be(:group) { create(:group, :public, :with_avatar, description: 'foo') } + let_it_be(:subgroup) { create(:group, :public, :with_avatar, parent: group, description: 'bar') } + let_it_be_with_reload(:project) { create(:project, :public, :with_avatar, namespace: group, description: 'foo') } + let_it_be(:subproject) { create(:project, :public, :with_avatar, namespace: subgroup, description: 'bar') } + + it 'shows Organization structured markup', :js do + visit path + wait_for_all_requests + + aggregate_failures do + expect(page).to have_selector('.content[itemscope][itemtype="https://schema.org/Organization"]') + + page.within('.group-home-panel') do + expect(page).to have_selector('img.avatar[itemprop="logo"]') + expect(page).to have_selector('[itemprop="name"]', text: group.name) + expect(page).to have_selector('[itemprop="description"]', text: group.description) + end + + page.within('[itemprop="owns"][itemtype="https://schema.org/SoftwareSourceCode"]') do + expect(page).to have_selector('img.avatar[itemprop="image"]') + expect(page).to have_selector('[itemprop="name"]', text: project.name) + expect(page).to have_selector('[itemprop="description"]', text: project.description) + end + + # Finding the subgroup row and expanding it + el = find('[itemprop="subOrganization"][itemtype="https://schema.org/Organization"]') + el.click + wait_for_all_requests + page.within(el) do + expect(page).to have_selector('img.avatar[itemprop="logo"]') + expect(page).to have_selector('[itemprop="name"]', text: subgroup.name) + expect(page).to have_selector('[itemprop="description"]', text: subgroup.description) + + page.within('[itemprop="owns"][itemtype="https://schema.org/SoftwareSourceCode"]') do + expect(page).to have_selector('img.avatar[itemprop="image"]') + expect(page).to have_selector('[itemprop="name"]', text: subproject.name) + expect(page).to have_selector('[itemprop="description"]', text: subproject.description) + end + end + end + end + + it 'does not include structured markup in shared projects tab', :js do + other_project = create(:project, :public) + other_project.project_group_links.create!(group: group) + + visit group_shared_path(group) + wait_for_all_requests + + expect(page).to have_selector('li.group-row') + expect(page).not_to have_selector('[itemprop="owns"][itemtype="https://schema.org/SoftwareSourceCode"]') + end + + it 'does not include structured markup in archived projects tab', :js do + project.update!(archived: true) + + visit group_archived_path(group) + wait_for_all_requests + + expect(page).to have_selector('li.group-row') + expect(page).not_to have_selector('[itemprop="owns"][itemtype="https://schema.org/SoftwareSourceCode"]') + end + end end |