diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 18:25:58 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 18:25:58 +0000 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /qa/qa/specs/features/browser_ui/1_manage | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) | |
download | gitlab-ce-a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4.tar.gz |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'qa/qa/specs/features/browser_ui/1_manage')
4 files changed, 125 insertions, 92 deletions
diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb index 055300122d4..d4c4ec5611a 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb @@ -2,20 +2,21 @@ module QA RSpec.describe 'Manage', :requires_admin do - describe 'Group bulk import' do - let!(:api_client) { Runtime::API::Client.as_admin } + describe 'Bulk group import' do + let!(:admin_api_client) { Runtime::API::Client.as_admin } let!(:user) do Resource::User.fabricate_via_api! do |usr| - usr.api_client = api_client + usr.api_client = admin_api_client usr.hard_delete_on_api_removal = true end end - let!(:personal_access_token) { Runtime::API::Client.new(user: user).personal_access_token } + let!(:api_client) { Runtime::API::Client.new(user: user) } + let!(:personal_access_token) { api_client.personal_access_token } let!(:sandbox) do Resource::Sandbox.fabricate_via_api! do |group| - group.api_client = api_client + group.api_client = admin_api_client end end @@ -37,6 +38,7 @@ module QA let(:imported_group) do Resource::Group.new.tap do |group| group.api_client = api_client + group.sandbox = sandbox group.path = source_group.path end end @@ -54,42 +56,65 @@ module QA end before(:all) do - Runtime::Feature.enable(:bulk_import) + Runtime::Feature.enable(:bulk_import) unless staging? Runtime::Feature.enable(:top_level_group_creation_enabled) if staging? end before do sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER) - source_group.add_member(user, Resource::Members::AccessLevel::MAINTAINER) Flow::Login.sign_in(as: user) - Page::Main::Menu.new.go_to_import_group - Page::Group::New.new.connect_gitlab_instance(Runtime::Scenario.gitlab_address, personal_access_token) + Page::Main::Menu.perform(&:go_to_create_group) + Page::Group::New.perform do |group| + group.switch_to_import_tab + group.connect_gitlab_instance(Runtime::Scenario.gitlab_address, personal_access_token) + end end + # Non blocking issues: + # https://gitlab.com/gitlab-org/gitlab/-/issues/331252 it( - 'performs bulk group import from another gitlab instance', + 'imports group with subgroups and labels', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1785', - exclude: { job: ['ce:relative_url', 'ee:relative_url'] } # https://gitlab.com/gitlab-org/gitlab/-/issues/330344 + quarantine: { + only: { job: 'relative_url' }, + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/330344', + type: :bug + } ) do + Resource::GroupLabel.fabricate_via_api! do |label| + label.api_client = api_client + label.group = source_group + label.title = "source-group-#{SecureRandom.hex(4)}" + end + Resource::GroupLabel.fabricate_via_api! do |label| + label.api_client = api_client + label.group = subgroup + label.title = "subgroup-#{SecureRandom.hex(4)}" + end + Page::Group::BulkImport.perform do |import_page| import_page.import_group(source_group.path, sandbox.path) aggregate_failures do - expect(import_page).to have_imported_group(source_group.path, wait: 120) - expect(imported_group).to eq(source_group) - expect(imported_subgroup).to eq(subgroup) + expect(import_page).to have_imported_group(source_group.path, wait: 180) + + expect { imported_group.reload! }.to eventually_eq(source_group).within(duration: 10) + expect { imported_group.labels }.to eventually_include(*source_group.labels).within(duration: 10) + + # Do not validate subgroups until https://gitlab.com/gitlab-org/gitlab/-/issues/332818 is resolved + # expect { imported_subgroup.reload! }.to eventually_eq(subgroup).within(duration: 30) + # expect { imported_subgroup.labels }.to eventually_include(*subgroup.labels).within(duration: 30) end end end after do user.remove_via_api! - source_group.remove_via_api! end after(:all) do - Runtime::Feature.disable(:bulk_import) + Runtime::Feature.disable(:bulk_import) unless staging? Runtime::Feature.disable(:top_level_group_creation_enabled) if staging? end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb index 7bcc1fa4e1c..192c1a3908b 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb @@ -10,9 +10,13 @@ module QA Page::Dashboard::Groups.perform do |groups| groups.click_new_group - expect(groups).to have_content( - /Create a Mattermost team for this group/ - ) + Page::Group::New.perform do |group_new| + group_new.click_create_group + + expect(group_new).to have_content( + /Create a Mattermost team for this group/ + ) + end end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_group_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_group_spec.rb index d6bcd134a03..84464f7174a 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_group_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_group_spec.rb @@ -28,14 +28,17 @@ module QA end it 'transfers a subgroup to another group', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1724' do + testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1724' do Page::Group::Menu.perform(&:click_group_general_settings_item) Page::Group::Settings::General.perform do |general| general.transfer_group(target_group.path) + + sub_group_for_transfer.sandbox = target_group + sub_group_for_transfer.reload! end expect(page).to have_text("Group '#{sub_group_for_transfer.path}' was successfully transferred.") - expect(page.driver.current_url).to include("#{target_group.path}/#{sub_group_for_transfer.path}") + expect(page.driver.current_url).to include(sub_group_for_transfer.full_path) end after do diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb index 5072b6d48bf..55ad8baf872 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb @@ -3,25 +3,26 @@ module QA RSpec.describe 'Manage', :github, :requires_admin do describe 'Project import' do + let!(:api_client) { Runtime::API::Client.as_admin } + let!(:group) { Resource::Group.fabricate_via_api! { |resource| resource.api_client = api_client } } let!(:user) do Resource::User.fabricate_via_api! do |resource| - resource.api_client = Runtime::API::Client.as_admin + resource.api_client = api_client + resource.hard_delete_on_api_removal = true end end - let(:group) { Resource::Group.fabricate_via_api! } - let(:imported_project) do Resource::ProjectImportedFromGithub.fabricate_via_browser_ui! do |project| project.name = 'imported-project' project.group = group project.github_personal_access_token = Runtime::Env.github_access_token project.github_repository_path = 'gitlab-qa-github/test-project' + project.api_client = api_client end end before do - Runtime::Feature.enable(:invite_members_group_modal, group: group) group.add_member(user, Resource::Members::AccessLevel::MAINTAINER) end @@ -32,90 +33,90 @@ module QA it 'imports a GitHub repo', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1762' do Flow::Login.sign_in(as: user) - imported_project # import the project + imported_project.reload! # import the project and reload all fields - Page::Main::Menu.perform(&:go_to_projects) - Page::Dashboard::Projects.perform do |dashboard| - dashboard.go_to_project(imported_project.name) + aggregate_failures do + verify_repository_import + verify_commits_import + verify_labels_import + verify_issues_import + verify_milestones_import + verify_wikis_import + verify_merge_requests_import end - - Page::Project::Show.perform(&:wait_for_import) - - verify_repository_import - verify_issues_import - verify_merge_requests_import - verify_labels_import - verify_milestones_import - verify_wiki_import end def verify_repository_import - Page::Project::Show.perform do |project| - expect(project).to have_content('This test project is used for automated GitHub import by GitLab QA.') - expect(project).to have_content(imported_project.name) - end + expect(imported_project.api_response).to include( + description: 'A new repo for test', + import_status: 'finished', + import_error: nil + ) end - def verify_issues_import - QA::Support::Retrier.retry_on_exception do - Page::Project::Menu.perform(&:click_issues) - - Page::Project::Issue::Show.perform do |issue_page| - expect(issue_page).to have_content('This is a sample issue') - - click_link 'This is a sample issue' - - expect(issue_page).to have_content('This is a sample first comment') - - # Comments - comment_text = 'This is a comment from @sliaquat' - - expect(issue_page).to have_comment(comment_text) - expect(issue_page).to have_label('custom new label') - expect(issue_page).to have_label('help wanted') - expect(issue_page).to have_label('good first issue') - end - end + def verify_commits_import + expect(imported_project.commits.length).to eq(20) end - def verify_merge_requests_import - Page::Project::Menu.perform(&:click_merge_requests) - - Page::MergeRequest::Show.perform do |merge_request| - expect(merge_request).to have_content('Improve readme') - - click_link 'Improve readme' - - expect(merge_request).to have_content('This improves the README file a bit.') - - # Comments - expect(merge_request).to have_content('[PR comment by @sliaquat] Nice work!') - - # Diff comments - expect(merge_request).to have_content('[Single diff comment] Good riddance') - expect(merge_request).to have_content('[Single diff comment] Nice addition') - - expect(merge_request).to have_label('bug') - expect(merge_request).to have_label('documentation') - end + def verify_labels_import + labels = imported_project.labels.map { |label| label.slice(:name, :color) } + + expect(labels).to eq( + [ + { name: 'bug', color: '#d73a4a' }, + { name: 'custom new label', color: '#fc8f91' }, + { name: 'documentation', color: '#0075ca' }, + { name: 'duplicate', color: '#cfd3d7' }, + { name: 'enhancement', color: '#a2eeef' }, + { name: 'good first issue', color: '#7057ff' }, + { name: 'help wanted', color: '#008672' }, + { name: 'invalid', color: '#e4e669' }, + { name: 'question', color: '#d876e3' }, + { name: 'wontfix', color: '#ffffff' } + ] + ) end - def verify_labels_import - # TODO: Waiting on https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/19228 - # to build upon it. + def verify_issues_import + issues = imported_project.issues + + expect(issues.length).to eq(1) + expect(issues.first).to include( + title: 'This is a sample issue', + description: "*Created by: gitlab-qa-github*\n\nThis is a sample first comment", + labels: ['custom new label', 'good first issue', 'help wanted'], + user_notes_count: 1 + ) end def verify_milestones_import - # TODO: Waiting on https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/18727 - # to build upon it. + milestones = imported_project.milestones + + expect(milestones.length).to eq(1) + expect(milestones.first).to include(title: 'v1.0', description: nil, state: 'active') end - def verify_wiki_import - Page::Project::Menu.perform(&:click_wiki) + def verify_wikis_import + wikis = imported_project.wikis - Page::Project::Wiki::Show.perform do |wiki| - expect(wiki).to have_content('Welcome to the test-project wiki!') - end + expect(wikis.length).to eq(1) + expect(wikis.first).to include(title: 'Home', format: 'markdown') + end + + def verify_merge_requests_import + merge_requests = imported_project.merge_requests + + expect(merge_requests.length).to eq(1) + expect(merge_requests.first).to include( + title: 'Improve readme', + state: 'opened', + target_branch: 'main', + source_branch: 'improve-readme', + labels: %w[bug documentation], + description: <<~DSC.strip + *Created by: gitlab-qa-github*\n\nThis improves the README file a bit.\r\n\r\nTODO:\r\n\r\n \r\n\r\n- [ ] Do foo\r\n- [ ] Make bar\r\n - [ ] Think about baz + DSC + ) end end end |