diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-17 11:59:07 +0000 |
commit | 8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca (patch) | |
tree | 544930fb309b30317ae9797a9683768705d664c4 /qa/qa/specs/features | |
parent | 4b1de649d0168371549608993deac953eb692019 (diff) | |
download | gitlab-ce-8b573c94895dc0ac0e1d9d59cf3e8745e8b539ca.tar.gz |
Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42
Diffstat (limited to 'qa/qa/specs/features')
46 files changed, 532 insertions, 150 deletions
diff --git a/qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb index 6654a35915f..89bf92cd3af 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb @@ -37,7 +37,7 @@ module QA Support::Waiter.wait_until(retry_on_exception: true, sleep_interval: 5) do Resource::Repository::Commit.fabricate_via_api! do |commits| commits.project = project - commits.sha = 'master' + commits.sha = project.default_branch end end diff --git a/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb index e96b9ad9258..631056ed52e 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb @@ -45,7 +45,7 @@ module QA # Note: This test doesn't have the :orchestrated tag because it runs in the Test::Integration::Praefect # scenario with other tests that aren't considered orchestrated. # It also runs on staging using nfs-file07 as non-cluster storage and nfs-file22 as cluster/praefect storage - context 'when moving from Gitaly to Gitaly Cluster', :requires_praefect, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/974' do + context 'when moving from Gitaly to Gitaly Cluster', :requires_praefect, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/974', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/284645', type: :investigating } do let(:source_storage) { { type: :gitaly, name: QA::Runtime::Env.non_cluster_repository_storage } } let(:destination_storage) { { type: :praefect, name: QA::Runtime::Env.praefect_repository_storage } } let(:project) do diff --git a/qa/qa/specs/features/api/3_create/merge_request/push_options_labels_spec.rb b/qa/qa/specs/features/api/3_create/merge_request/push_options_labels_spec.rb index 82a06780830..2391154030b 100644 --- a/qa/qa/specs/features/api/3_create/merge_request/push_options_labels_spec.rb +++ b/qa/qa/specs/features/api/3_create/merge_request/push_options_labels_spec.rb @@ -7,16 +7,18 @@ module QA # # git config --global receive.advertisepushoptions true - branch = "push-options-test-#{SecureRandom.hex(8)}" - title = "MR push options test #{SecureRandom.hex(8)}" - commit_message = 'Add README.md' + let(:branch) { "push-options-test-#{SecureRandom.hex(8)}" } + let(:title) { "MR push options test #{SecureRandom.hex(8)}" } + let(:commit_message) { 'Add README.md' } - project = Resource::Project.fabricate_via_api! do |project| - project.name = 'merge-request-push-options' - project.initialize_with_readme = true + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'merge-request-push-options' + project.initialize_with_readme = true + end end - it 'sets labels', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1032' do + def create_new_mr_via_push Resource::Repository::ProjectPush.fabricate! do |push| push.project = project push.commit_message = commit_message @@ -27,6 +29,10 @@ module QA label: %w[one two three] } end + end + + it 'sets labels', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1032' do + create_new_mr_via_push merge_request = project.merge_request_with_title(title) @@ -35,7 +41,11 @@ module QA end context 'when labels are set already' do - it 'removes them', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1033' do + before do + create_new_mr_via_push + end + + it 'removes them on subsequent push', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1033' do Resource::Repository::ProjectPush.fabricate! do |push| push.project = project push.file_content = "Unlabel test #{SecureRandom.hex(8)}" diff --git a/qa/qa/specs/features/api/3_create/repository/files_spec.rb b/qa/qa/specs/features/api/3_create/repository/files_spec.rb index f539aae9b29..1099234537a 100644 --- a/qa/qa/specs/features/api/3_create/repository/files_spec.rb +++ b/qa/qa/specs/features/api/3_create/repository/files_spec.rb @@ -21,27 +21,29 @@ module QA a_hash_including(name: project_name, path: project_name) ) + default_branch = json_body[:default_branch].to_s.empty? ? Runtime::Env.default_branch : json_body[:default_branch] + create_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/README.md") - post create_file_request.url, branch: 'master', content: 'Hello world', commit_message: 'Add README.md' + post create_file_request.url, branch: default_branch, content: 'Hello world', commit_message: 'Add README.md' expect_status(201) expect(json_body).to match( - a_hash_including(branch: 'master', file_path: 'README.md') + a_hash_including(branch: default_branch, file_path: 'README.md') ) - get_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/README.md", ref: 'master') + get_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/README.md", ref: default_branch) get get_file_request.url expect_status(200) expect(json_body).to match( a_hash_including( - ref: 'master', + ref: default_branch, file_path: 'README.md', file_name: 'README.md', encoding: 'base64', content: 'SGVsbG8gd29ybGQ=' ) ) - delete_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/README.md", branch: 'master', commit_message: 'Remove README.md') + delete_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/README.md", branch: default_branch, commit_message: 'Remove README.md') delete delete_file_request.url expect_status(204) @@ -80,10 +82,12 @@ module QA create_project_request = Runtime::API::Request.new(@api_client, '/projects') post create_project_request.url, path: project_name, name: project_name + default_branch = json_body[:default_branch].to_s.empty? ? Runtime::Env.default_branch : json_body[:default_branch] + create_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/test.svg") - post create_file_request.url, branch: 'master', content: svg_file, commit_message: 'Add test.svg' + post create_file_request.url, branch: default_branch, content: svg_file, commit_message: 'Add test.svg' - get_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/test.svg/raw", ref: 'master') + get_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/test.svg/raw", ref: default_branch) 3.times do response = get get_file_request.url diff --git a/qa/qa/specs/features/api/4_verify/pipeline_deletion_spec.rb b/qa/qa/specs/features/api/4_verify/pipeline_deletion_spec.rb index 0bbb0ed897a..1d1b765bb9f 100644 --- a/qa/qa/specs/features/api/4_verify/pipeline_deletion_spec.rb +++ b/qa/qa/specs/features/api/4_verify/pipeline_deletion_spec.rb @@ -42,7 +42,7 @@ module QA end let!(:pipeline_id) do - pipeline_create_request = Runtime::API::Request.new(api_client, "/projects/#{project.id}/pipeline?ref=master") + pipeline_create_request = Runtime::API::Request.new(api_client, "/projects/#{project.id}/pipeline?ref=#{project.default_branch}") JSON.parse(post(pipeline_create_request.url, nil))['id'] end @@ -65,6 +65,9 @@ module QA deleted_pipeline = pipeline !pipeline.empty? end + + raise "Pipeline response does not have a 'message' key: #{deleted_pipeline}" unless deleted_pipeline&.key?('message') + expect(deleted_pipeline['message'].downcase).to have_content('404 not found') end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/2fa_recovery_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_recovery_spec.rb index 163469e1e88..e38a9f47bd6 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/2fa_recovery_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_recovery_spec.rb @@ -81,7 +81,7 @@ module QA recovery_code = two_fa_auth.recovery_codes.sample - two_fa_auth.click_proceed_button + two_fa_auth.click_copy_and_proceed recovery_code end diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb index 7f3c3049499..f6d2492c011 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb @@ -56,7 +56,7 @@ module QA otp = QA::Support::OTP.new(two_fa_auth.otp_secret_content) two_fa_auth.set_pin_code(otp.fresh_otp) two_fa_auth.click_register_2fa_app_button - two_fa_auth.click_proceed_button + two_fa_auth.click_copy_and_proceed end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb index 12a1b419f8b..f81dfe4b5c8 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb @@ -99,9 +99,9 @@ module QA two_fa_auth.set_pin_code(@otp.fresh_otp) two_fa_auth.click_register_2fa_app_button - expect(two_fa_auth).to have_text('Congratulations! You have enabled Two-factor Authentication!') + two_fa_auth.click_copy_and_proceed - two_fa_auth.click_proceed_button + expect(two_fa_auth).to have_text('Congratulations! You have enabled Two-factor Authentication!') end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb index e4ac59cf5e0..6cd486bc84b 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Manage', :orchestrated, :instance_saml do describe 'Instance wide SAML SSO' do - it 'User logs in to gitlab with SAML SSO', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/671' do + it 'user logs in to gitlab with SAML SSO', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/671' do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_with_saml) diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb index 2bb03b6154f..d58857f6da2 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb @@ -26,7 +26,7 @@ module QA ldap_username = Runtime::Env.ldap_username Runtime::Env.ldap_username = nil - disable_require_admin_approval_after_user_signup + set_require_admin_approval_after_user_signup_via_api(false) Runtime::Env.ldap_username = ldap_username end @@ -39,60 +39,136 @@ module QA end describe 'standard', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/936' do - before(:all) do - disable_require_admin_approval_after_user_signup - end + context 'when admin approval is not required' do + before(:all) do + set_require_admin_approval_after_user_signup_via_api(false) + end - it_behaves_like 'registration and login' + it_behaves_like 'registration and login' + + context 'when user account is deleted' do + let(:user) do + Resource::User.fabricate_via_api! do |resource| + resource.api_client = admin_api_client + end + end + + before do + # Use the UI instead of API to delete the account since + # this is the only test that exercise this UI. + # Other tests should use the API for this purpose. + Flow::Login.sign_in(as: user) + Page::Main::Menu.perform(&:click_settings_link) + Page::Profile::Menu.perform(&:click_account) + Page::Profile::Accounts::Show.perform do |show| + show.delete_account(user.password) + end + end + + it 'allows recreating with same credentials', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/937' do + expect(Page::Main::Menu.perform(&:signed_in?)).to be_falsy + + Flow::Login.sign_in(as: user, skip_page_validation: true) - context 'when user account is deleted' do - let(:user) do - Resource::User.fabricate_via_api! do |resource| - resource.api_client = admin_api_client + expect(page).to have_text("Invalid Login or password") + + @recreated_user = Resource::User.fabricate_via_browser_ui! do |resource| + resource.name = user.name + resource.username = user.username + resource.email = user.email + end + + expect(Page::Main::Menu.perform(&:signed_in?)).to be_truthy + end + + after do + @recreated_user.remove_via_api! + end + + def admin_api_client + @admin_api_client ||= Runtime::API::Client.as_admin end end + end + + context 'when admin approval is required' do + let(:signed_up_waiting_approval_text) { 'You have signed up successfully. However, we could not sign you in because your account is awaiting approval from your GitLab administrator.' } + let(:pending_approval_blocked_text) { 'Your account is pending approval from your GitLab administrator and hence blocked. Please contact your GitLab administrator if you think this is an error.' } before do - # Use the UI instead of API to delete the account since - # this is the only test that exercise this UI. - # Other tests should use the API for this purpose. - Flow::Login.sign_in(as: user) - Page::Main::Menu.perform(&:click_settings_link) - Page::Profile::Menu.perform(&:click_account) - Page::Profile::Accounts::Show.perform do |show| - show.delete_account(user.password) + enable_require_admin_approval_after_user_signup_via_ui + + @user = Resource::User.fabricate_via_browser_ui! do |user| + user.expect_fabrication_success = false end end - it 'allows recreating with same credentials', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/937' do - expect(Page::Main::Menu.perform(&:signed_in?)).to be_falsy + it 'allows user login after approval', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1076' do + expect(page).to have_text(signed_up_waiting_approval_text) - Flow::Login.sign_in(as: user, skip_page_validation: true) + Flow::Login.sign_in(as: @user, skip_page_validation: true) - expect(page).to have_text("Invalid Login or password") + expect(page).to have_text(pending_approval_blocked_text) - @recreated_user = Resource::User.fabricate_via_browser_ui! do |resource| - resource.name = user.name - resource.username = user.username - resource.email = user.email - end + approve_user(@user) + + Flow::Login.sign_in(as: @user, skip_page_validation: true) + + Page::Registration::Welcome.perform(&:click_get_started_button_if_available) - expect(Page::Main::Menu.perform(&:signed_in?)).to be_truthy + Page::Main::Menu.perform do |menu| + expect(menu).to have_personal_area + end end after do - @recreated_user.remove_via_api! + set_require_admin_approval_after_user_signup_via_api(false) + @user.remove_via_api! if @user + end + end + end + + def approve_user(user) + Flow::Login.while_signed_in_as_admin do + Page::Main::Menu.perform(&:go_to_admin_area) + Page::Admin::Menu.perform(&:go_to_users_overview) + Page::Admin::Overview::Users::Index.perform do |index| + index.click_pending_approval_tab + index.search_user(user.username) + index.click_user(user.username) end - def admin_api_client - @admin_api_client ||= Runtime::API::Client.as_admin + Page::Admin::Overview::Users::Show.perform do |show| + user.id = show.user_id.to_i + show.approve_user end + + expect(page).to have_text('Successfully approved') end end - def disable_require_admin_approval_after_user_signup - Runtime::ApplicationSettings.set_application_settings(require_admin_approval_after_user_signup: false) + def set_require_admin_approval_after_user_signup_via_api(enable_or_disable) + return if Runtime::ApplicationSettings.get_application_settings[:require_admin_approval_after_user_signup] == enable_or_disable + + Runtime::ApplicationSettings.set_application_settings(require_admin_approval_after_user_signup: enable_or_disable) + sleep 10 # It takes a moment for the setting to come into effect end + + def enable_require_admin_approval_after_user_signup_via_ui + unless Runtime::ApplicationSettings.get_application_settings[:require_admin_approval_after_user_signup] + Flow::Login.while_signed_in_as_admin do + Page::Main::Menu.perform(&:go_to_admin_area) + QA::Page::Admin::Menu.perform(&:go_to_general_settings) + Page::Admin::Settings::General.perform do |setting| + setting.expand_sign_up_restrictions do |settings| + settings.require_admin_approval_after_user_signup + end + end + end + + sleep 10 # It takes a moment for the setting to come into effect + end + end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb index 2f2f40cba3b..ff13b769e3a 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb @@ -3,7 +3,9 @@ module QA RSpec.describe 'Manage', :smoke do describe 'Project creation' do - it 'user creates a new project', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/429' do + it 'user creates a new project', + testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/429', + quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/283925', type: :investigating } do Flow::Login.sign_in created_project = Resource::Project.fabricate_via_browser_ui! do |project| diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb index 3609d083fde..db96c2d4ad3 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb @@ -6,17 +6,18 @@ module QA it 'user creates an event in the activity page upon Git push', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/407' do Flow::Login.sign_in - Resource::Repository::ProjectPush.fabricate! do |push| + project = Resource::Repository::ProjectPush.fabricate! do |push| push.file_name = 'README.md' push.file_content = '# This is a test project' push.commit_message = 'Add README.md' - end.project.visit! + end.project + project.visit! Page::Project::Menu.perform(&:click_activity) Page::Project::Activity.perform do |activity| activity.click_push_events - expect(activity).to have_content('pushed new branch master') + expect(activity).to have_content("pushed new branch #{project.default_branch}") end end end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb index 5d863a80877..e394f6b1e9c 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb @@ -27,6 +27,10 @@ module QA end.visit! end + after do + user&.remove_via_api! + end + it 'mentions a user in a comment', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/452' do Page::Project::Issue::Show.perform do |show| show.select_all_activities_filter diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb index 22157d648ca..6ed204a98d4 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb @@ -4,22 +4,20 @@ module QA RSpec.describe 'Plan', :reliable do describe 'collapse comments in issue discussions' do let(:my_first_reply) { 'My first reply' } + let(:one_reply) { '1 reply' } + let(:issue) { Resource::Issue.fabricate_via_api! } before do Flow::Login.sign_in - Resource::Issue.fabricate_via_api!.visit! + issue.visit! + end + it 'collapses and expands reply for comments in an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/434' do Page::Project::Issue::Show.perform do |show| show.select_all_activities_filter show.start_discussion('My first discussion') show.reply_to_discussion(1, my_first_reply) - end - end - - it 'collapses and expands reply for comments in an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/434' do - Page::Project::Issue::Show.perform do |show| - one_reply = "1 reply" show.collapse_replies expect(show).to have_content(one_reply) diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb index 9550572bd5c..688f42c48c6 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb @@ -19,7 +19,7 @@ module QA end end - it 'closes an issue', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/225303', type: :bug }, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1085' do + it 'closes an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1085' do closed_issue.visit! Page::Project::Issue::Show.perform do |issue_page| diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/real_time_assignee_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/real_time_assignee_spec.rb index 26a83fc3caa..11f93d6a97e 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/real_time_assignee_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/real_time_assignee_spec.rb @@ -40,12 +40,12 @@ module QA issue.set_issue_assignees(assignee_ids: [user2.id]) expect(show).to have_assignee(user2.name) - expect(show).to have_no_assignee_named(user1.name) + expect(show).not_to have_assignee(user1.name) issue.set_issue_assignees(assignee_ids: []) - expect(show).to have_no_assignee_named(user1.name) - expect(show).to have_no_assignee_named(user2.name) + expect(show).not_to have_assignee(user1.name) + expect(show).not_to have_assignee(user2.name) end end end diff --git a/qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb index 13761244300..6a133540f87 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb @@ -37,7 +37,7 @@ module QA show.click_remove_related_issue_button - expect(show).to have_no_text(issue_2.title, wait: max_wait) + expect(show).not_to have_text(issue_2.title, wait: max_wait) end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb b/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb new file mode 100644 index 00000000000..0fec7bc9e9d --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb @@ -0,0 +1,155 @@ +# frozen_string_literal: true +require 'securerandom' + +module QA + RSpec.describe 'Create', :requires_admin, :skip_live_env, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/195179', type: :flaky } do + describe 'Jenkins integration' do + let(:project_name) { "project_with_jenkins_#{SecureRandom.hex(4)}" } + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = project_name + project.initialize_with_readme = true + project.auto_devops_enabled = false + end + end + + before do + jenkins_server = run_jenkins_server + + Vendor::Jenkins::Page::Base.host = jenkins_server.host_address + + Runtime::Env.personal_access_token ||= fabricate_personal_access_token + + allow_requests_to_local_networks + + setup_jenkins + end + + it 'integrates and displays build status for MR pipeline in GitLab', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/719' do + login_to_gitlab + + setup_project_integration_with_jenkins + + expect(page).to have_text("Jenkins CI activated.") + + QA::Support::Retrier.retry_on_exception do + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.new_branch = false + push.file_name = "file_#{SecureRandom.hex(4)}.txt" + end + + Vendor::Jenkins::Page::LastJobConsole.perform do |job_console| + job_console.job_name = project_name + + job_console.visit! + + Support::Waiter.wait_until(sleep_interval: 2, reload_page: page) do + job_console.has_successful_build? && job_console.no_failed_status_update? + end + end + + project.visit! + + Flow::Pipeline.visit_latest_pipeline + + Page::Project::Pipeline::Show.perform do |show| + expect(show).to have_build('jenkins', status: :success, wait: 15) + end + end + end + + after do + remove_jenkins_server + end + + def setup_jenkins + Vendor::Jenkins::Page::Login.perform do |login_page| + login_page.visit! + login_page.login + end + + token_description = "token-#{SecureRandom.hex(8)}" + + Vendor::Jenkins::Page::NewCredentials.perform do |new_credentials| + new_credentials.visit_and_set_gitlab_api_token(Runtime::Env.personal_access_token, token_description) + end + + Vendor::Jenkins::Page::Configure.perform do |configure| + configure.visit_and_setup_gitlab_connection(patch_host_name(Runtime::Scenario.gitlab_address, 'gitlab'), token_description) do + configure.click_test_connection + expect(configure).to have_success + end + end + + Vendor::Jenkins::Page::NewJob.perform do |new_job| + new_job.visit_and_create_new_job_with_name(project_name) + end + + Vendor::Jenkins::Page::ConfigureJob.perform do |configure_job| + configure_job.job_name = project_name + configure_job.configure(scm_url: patch_host_name(project.repository_http_location.git_uri, 'gitlab')) + end + end + + def run_jenkins_server + Service::DockerRun::Jenkins.new.tap do |runner| + runner.pull + runner.register! + end + end + + def remove_jenkins_server + Service::DockerRun::Jenkins.new.remove! + end + + def fabricate_personal_access_token + login_to_gitlab + + token = Resource::PersonalAccessToken.fabricate!.access_token + Page::Main::Menu.perform(&:sign_out) + token + end + + def login_to_gitlab + Flow::Login.sign_in + end + + def patch_host_name(host_name, container_name) + return host_name unless host_name.include?('localhost') + + ip_address = `docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' #{container_name}`.strip + host_name.gsub('localhost', ip_address) + end + + def setup_project_integration_with_jenkins + project.visit! + + Page::Project::Menu.perform(&:click_project) + Page::Project::Menu.perform(&:go_to_integrations_settings) + Page::Project::Settings::Integrations.perform(&:click_jenkins_ci_link) + + QA::Page::Project::Settings::Services::Jenkins.perform do |jenkins| + jenkins.setup_service_with(jenkins_url: patch_host_name(Vendor::Jenkins::Page::Base.host, 'jenkins-server'), + project_name: project_name) + end + end + + def allow_requests_to_local_networks + Page::Main::Menu.perform(&:sign_out_if_signed_in) + Flow::Login.sign_in_as_admin + Page::Main::Menu.perform(&:go_to_admin_area) + Page::Admin::Menu.perform(&:go_to_network_settings) + + Page::Admin::Settings::Network.perform do |network| + network.expand_outbound_requests do |outbound_requests| + outbound_requests.allow_requests_to_local_network_from_services + end + end + + Page::Main::Menu.perform(&:sign_out) + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb b/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb index 37ddd1425a8..d53e7fcf69a 100644 --- a/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb @@ -80,7 +80,6 @@ module QA def push_commit(commit_message) Resource::Repository::ProjectPush.fabricate! do |push| - push.branch_name = 'master' push.commit_message = commit_message push.file_content = commit_message push.project = project @@ -101,7 +100,7 @@ module QA end def master_branch_exists? - project.repository_branches.map { |item| item[:name] }.include?("master") + project.repository_branches.map { |item| item[:name] }.include?(project.default_branch) end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb index b58e820a6c9..d2ba97400e6 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb @@ -2,21 +2,23 @@ module QA RSpec.describe 'Create' do - describe 'Merge request creation from fork' do - let(:merge_request) do - Resource::MergeRequestFromFork.fabricate_via_api! do |merge_request| + describe 'Merge request creation from fork', :smoke do + let!(:merge_request) do + Resource::MergeRequestFromFork.fabricate_via_browser_ui! do |merge_request| merge_request.fork_branch = 'feature-branch' end end it 'can merge feature branch fork to mainline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/928' do - Flow::Login.sign_in + Flow::Login.while_signed_in do + merge_request.visit! - merge_request.visit! + Page::MergeRequest::Show.perform do |merge_request| + merge_request.merge! - Page::MergeRequest::Show.perform(&:merge!) - - expect(page).to have_content('The changes were merged') + expect(merge_request).to have_content('The changes were merged') + end + end end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb index 02fbb0bbbd7..823a033ab6d 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb @@ -27,7 +27,6 @@ module QA push.project = project push.file_name = "other.txt" push.file_content = "New file added!" - push.branch_name = "master" push.new_branch = false end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb index 970615e8b90..24b92164060 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', :requires_admin do + RSpec.describe 'Create', :requires_admin, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/261793', type: :investigating } do describe 'View merge request merge-ref diff' do let(:project) do Resource::Project.fabricate_via_api! do |project| @@ -37,8 +37,8 @@ module QA mr_page.click_diffs_tab mr_page.click_target_version_dropdown - expect(mr_page.version_dropdown_content).to include('master (HEAD)') - expect(mr_page.version_dropdown_content).not_to include('master (base)') + expect(mr_page.version_dropdown_content).to include("#{project.default_branch} (HEAD)") + expect(mr_page.version_dropdown_content).not_to include("#{project.default_branch} (base)") expect(mr_page).to have_file(merge_request.file_name) expect(mr_page).not_to have_file(new_file_name) end @@ -62,8 +62,8 @@ module QA mr_page.click_diffs_tab mr_page.click_target_version_dropdown - expect(mr_page.version_dropdown_content).to include('master (HEAD)') - expect(mr_page.version_dropdown_content).to include('master (base)') + expect(mr_page.version_dropdown_content).to include("#{project.default_branch} (HEAD)") + expect(mr_page.version_dropdown_content).to include("#{project.default_branch} (base)") expect(mr_page).to have_file(merge_request.file_name) expect(mr_page).to have_file(new_file_name) end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb index 98cbc5c0a93..8df68e0f53b 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do describe 'Create, list, and delete branches via web' do - master_branch = 'master' + master_branch = nil second_branch = 'second-branch' third_branch = 'third-branch' file_1_master = 'file.txt' @@ -21,12 +21,16 @@ module QA project = Resource::Project.fabricate_via_api! do |proj| proj.name = 'project-qa-test' proj.description = 'project for qa test' + proj.initialize_with_readme = true end + master_branch = project.default_branch + Git::Repository.perform do |repository| repository.uri = project.repository_http_location.uri repository.use_default_credentials repository.try_add_credentials_to_netrc + repository.default_branch = master_branch repository.act do clone diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb index 54d00209cc7..2b249f779d9 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb @@ -40,7 +40,7 @@ module QA end def create_protected_branch(allowed_to_push:) - Resource::ProtectedBranch.fabricate! do |resource| + Resource::ProtectedBranch.fabricate_via_api! do |resource| resource.branch_name = branch_name resource.project = project resource.allowed_to_push = allowed_to_push diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb index efd61a2e63a..a21c5d58aad 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb @@ -7,7 +7,6 @@ module QA let(:changed_content) { 'changes' } let(:commit_message) { 'Changes to snippets' } let(:added_content) { 'updated ' } - let(:branch_name) { 'master' } let(:snippet) do Resource::Snippet.fabricate! do |snippet| @@ -41,7 +40,7 @@ module QA end it 'clones, pushes, and pulls a snippet over HTTP, edits via UI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/826' do - Resource::Repository::Push.fabricate! do |push| + push = Resource::Repository::Push.fabricate! do |push| push.repository_http_uri = repository_uri_http push.file_name = new_file push.file_content = changed_content @@ -61,7 +60,7 @@ module QA Git::Repository.perform do |repository| repository.init_repository - repository.pull(repository_uri_http, branch_name) + repository.pull(repository_uri_http, push.branch_name) expect(repository.commits.size).to eq(3) expect(repository.commits.first).to include('Update snippet') @@ -70,7 +69,7 @@ module QA end it 'clones, pushes, and pulls a snippet over SSH, deletes via UI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/825' do - Resource::Repository::Push.fabricate! do |push| + push = Resource::Repository::Push.fabricate! do |push| push.repository_ssh_uri = repository_uri_ssh push.ssh_key = ssh_key push.file_name = new_file @@ -90,7 +89,7 @@ module QA repository.use_ssh_key(ssh_key) repository.init_repository - expect { repository.pull(repository_uri_ssh, branch_name) } + expect { repository.pull(repository_uri_ssh, push.branch_name) } .to raise_error(QA::Support::Run::CommandError, /fatal: Could not read from remote repository\./) end end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb index 79e2677da66..4ce6c3fdcd3 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb @@ -7,7 +7,7 @@ module QA let(:changed_content) { 'changes' } let(:commit_message) { 'Changes to snippets' } let(:added_content) { 'updated ' } - let(:branch_name) { 'master' } + let(:branch_name) { snippet.project.default_branch } let(:snippet) do Resource::ProjectSnippet.fabricate! do |snippet| diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb index 8445fdafdd4..b74f27389a0 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create', :smoke do describe 'Personal snippet creation' do - it 'User creates a personal snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/840' do + it 'user creates a personal snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/840' do Flow::Login.sign_in Page::Main::Menu.perform do |menu| diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb index d80fc4c5b95..8c44cd6d642 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do # to be converted to a smoke test once proved to be stable describe 'Project snippet creation' do - it 'User creates a project snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/839' do + it 'user creates a project snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/839' do Flow::Login.sign_in Resource::ProjectSnippet.fabricate_via_browser_ui! do |snippet| @@ -16,13 +16,13 @@ module QA Page::Dashboard::Snippet::Show.perform do |snippet| expect(snippet).to have_snippet_title('Project snippet') - expect(snippet).to have_no_snippet_description + expect(snippet).not_to have_snippet_description expect(snippet).to have_visibility_type(/private/i) expect(snippet).to have_file_name('markdown_file.md') expect(snippet).to have_file_content('Snippet heading') expect(snippet).to have_file_content('Gitlab link') - expect(snippet).to have_no_file_content('###') - expect(snippet).to have_no_file_content('https://gitlab.com/') + expect(snippet).not_to have_file_content('###') + expect(snippet).not_to have_file_content('https://gitlab.com/') end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb index ca6ea5db65d..8002e95cf0d 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb @@ -46,8 +46,8 @@ module QA aggregate_failures 'file names and contents' do expect(snippet).to have_file_name('Original file name') expect(snippet).to have_file_content('Original file content') - expect(snippet).to have_no_file_name('Second file name') - expect(snippet).to have_no_file_content('Second file content') + expect(snippet).not_to have_file_name('Second file name') + expect(snippet).not_to have_file_content('Second file content') end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb index e2fa487c937..dad5ad74a4c 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - describe 'Open a fork in Web IDE' do + describe 'Open a fork in Web IDE', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/284081', type: :investigating } do let(:parent_project) do Resource::Project.fabricate_via_api! do |project| project.name = 'parent-project' diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb index ccd4d34a916..fcd8cb02870 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb @@ -19,7 +19,7 @@ module QA it 'user adds a CI variable', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/395' do Page::Project::Settings::CiVariables.perform do |ci_variable| expect(ci_variable).to have_text('VARIABLE_KEY') - expect(ci_variable).to have_no_text('some_CI_variable') + expect(ci_variable).not_to have_text('some_CI_variable') ci_variable.click_reveal_ci_variable_value_button diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb index cedc2db2a1a..c2ea568dbad 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_multiple_files_from_a_project_spec.rb @@ -3,9 +3,8 @@ require 'faker' module QA - RSpec.describe 'Verify', :runner, :requires_admin, :skip_live_env do - describe "Include multiple files from a project" do - let(:feature_flag) { :ci_include_multiple_files_from_project } + RSpec.describe 'Verify', :runner do + describe 'Include multiple files from a project' do let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } let(:expected_text) { Faker::Lorem.sentence } let(:unexpected_text) { Faker::Lorem.sentence } @@ -31,16 +30,14 @@ module QA end before do - Runtime::Feature.enable(feature_flag) Flow::Login.sign_in add_included_files add_main_ci_file project.visit! - view_the_last_pipeline + Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'succeeded') end after do - Runtime::Feature.disable(feature_flag) runner.remove_via_api! end @@ -57,7 +54,7 @@ module QA Page::Project::Job::Show.perform do |job| aggregate_failures 'main CI is not overridden' do - expect(job.output).to have_no_content("#{unexpected_text}") + expect(job.output).not_to have_content("#{unexpected_text}") expect(job.output).to have_content("#{expected_text}") end end @@ -81,12 +78,6 @@ module QA end end - def view_the_last_pipeline - Page::Project::Menu.perform(&:click_ci_cd_pipelines) - Page::Project::Pipeline::Index.perform(&:wait_for_latest_pipeline_success) - Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline) - end - def main_ci_file { file_path: '.gitlab-ci.yml', diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb index eafe28c1ee6..519777b32d9 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pass_dotenv_variables_to_downstream_via_bridge_spec.rb @@ -3,9 +3,8 @@ require 'faker' module QA - RSpec.describe 'Verify', :runner, :requires_admin do - describe "Pass dotenv variables to downstream via bridge" do - let(:feature_flag) { :ci_bridge_dependency_variables } + RSpec.describe 'Verify', :runner do + describe 'Pass dotenv variables to downstream via bridge' do let(:executor_1) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } let(:executor_2) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } @@ -38,16 +37,14 @@ module QA end before do - Runtime::Feature.enable(feature_flag) Flow::Login.sign_in add_ci_file(downstream_project, downstream_ci_file) add_ci_file(upstream_project, upstream_ci_file) upstream_project.visit! - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'success') + Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'succeeded') end after do - Runtime::Feature.disable(feature_flag) runner_1.remove_via_api! runner_2.remove_via_api! end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb index b79bda108af..5f3ec3ec870 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Verify' do - describe 'Run pipeline', only: { subdomain: :staging } do + describe 'Run pipeline' do context 'with web only rule' do let(:job_name) { 'test_job' } let(:project) do diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb index 2f66ed697a3..c89cda73711 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb @@ -3,11 +3,8 @@ require 'faker' module QA - RSpec.describe 'Verify', :runner, :requires_admin do - # [TODO]: Developer to remove :requires_admin once FF is removed in follow up issue - + RSpec.describe 'Verify', :runner do describe "Trigger child pipeline with 'when:manual'" do - let(:feature_flag) { :ci_manual_bridges } # [TODO]: Developer to remove when feature flag is removed let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } let(:project) do @@ -25,15 +22,13 @@ module QA end before do - Runtime::Feature.enable(feature_flag) # [TODO]: Developer to remove when feature flag is removed Flow::Login.sign_in add_ci_files project.visit! - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'success') + Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'succeeded') end after do - Runtime::Feature.disable(feature_flag) # [TODO]: Developer to remove when feature flag is removed runner.remove_via_api! end diff --git a/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb index 7783dba3fa7..be6f3b17ccd 100644 --- a/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb @@ -81,8 +81,7 @@ module QA end project.visit! - Page::Project::Menu.perform(&:click_ci_cd_pipelines) - Page::Project::Pipeline::Index.perform(&:click_on_latest_pipeline) + Flow::Pipeline.visit_latest_pipeline Page::Project::Pipeline::Show.perform do |pipeline| pipeline.click_job('publish') @@ -112,7 +111,7 @@ module QA Page::Project::Packages::Index.perform do |index| aggregate_failures 'package deletion' do expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb index 2b06ba8646f..ae0580ff51b 100644 --- a/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb @@ -31,7 +31,7 @@ module QA runner.remove_via_api! end - it 'publishes a conan package and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1077' do + it 'publishes, installs, and deletes a Conan package', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1077' do Flow::Login.sign_in Resource::Repository::Commit.fabricate_via_api! do |commit| @@ -43,13 +43,14 @@ module QA <<~YAML image: conanio/gcc7 - create_package: + test_package: stage: deploy script: - "conan remote add gitlab #{gitlab_address_with_port}/api/v4/projects/#{project.id}/packages/conan" - "conan new #{package_name}/0.1 -t" - "conan create . mycompany/stable" - "CONAN_LOGIN_USERNAME=ci_user CONAN_PASSWORD=${CI_JOB_TOKEN} conan upload #{package_name}/0.1@mycompany/stable --all --remote=gitlab" + - "conan install conantest/0.1@mycompany/stable --remote=gitlab" tags: - "runner-for-#{project.name}" YAML @@ -60,7 +61,7 @@ module QA Flow::Pipeline.visit_latest_pipeline Page::Project::Pipeline::Show.perform do |pipeline| - pipeline.click_job('create_package') + pipeline.click_job('test_package') end Page::Project::Job::Show.perform do |job| @@ -80,7 +81,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/generic_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/generic_repository_spec.rb new file mode 100644 index 00000000000..9a0d832de09 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/5_package/generic_repository_spec.rb @@ -0,0 +1,116 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Package', :orchestrated, :packages do + describe 'Generic Repository' do + let(:package_name) { 'my_package' } + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'generic-package-project' + end + end + + let!(:runner) do + Resource::Runner.fabricate! do |runner| + runner.name = "qa-runner-#{Time.now.to_i}" + runner.tags = ["runner-for-#{project.name}"] + runner.executor = :docker + runner.project = project + end + end + + let(:gitlab_ci_yaml) do + <<~YAML + image: curlimages/curl:latest + + stages: + - upload + - download + + upload: + stage: upload + script: + - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file file.txt ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/my_package/0.0.1/file.txt' + tags: + - "runner-for-#{project.name}" + download: + stage: download + script: + - 'wget --header="JOB-TOKEN: $CI_JOB_TOKEN" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/my_package/0.0.1/file.txt -O file_downloaded.txt' + tags: + - "runner-for-#{project.name}" + YAML + end + + let(:file_txt) do + <<~EOF + Hello, world! + EOF + end + + before do + Flow::Login.sign_in + + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([{ + file_path: '.gitlab-ci.yml', + content: gitlab_ci_yaml + }, + { + file_path: 'file.txt', + content: file_txt + }] + ) + end + + project.visit! + Flow::Pipeline.visit_latest_pipeline + + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job('upload') + end + + Page::Project::Job::Show.perform do |job| + expect(job).to be_successful(timeout: 800) + + job.click_element(:pipeline_path) + end + + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job('download') + end + + Page::Project::Job::Show.perform do |job| + expect(job).to be_successful(timeout: 800) + end + end + + after do + runner.remove_via_api! + end + + it 'uploads a generic package, downloads and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1108' do + Page::Project::Menu.perform(&:click_packages_link) + + Page::Project::Packages::Index.perform do |index| + expect(index).to have_package(package_name) + index.click_package(package_name) + end + + Page::Project::Packages::Show.perform do |package| + package.click_delete + end + + Page::Project::Packages::Index.perform do |index| + aggregate_failures 'package deletion' do + expect(index).to have_content("Package deleted successfully") + expect(index).to have_no_package(package_name) + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb index e163fcbe574..552302addf9 100644 --- a/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb @@ -54,7 +54,7 @@ module QA script: - 'gradle publish' only: - - master + - "#{project.default_branch}" tags: - "runner-for-#{project.name}" YAML @@ -118,7 +118,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb index 4ca356c9b65..5410b5023d9 100644 --- a/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/maven_repository_spec.rb @@ -96,7 +96,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb index 817e146adfe..fa88ace1556 100644 --- a/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/npm_registry_spec.rb @@ -69,7 +69,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb index 0b70adf9ff6..be806fcbb3e 100644 --- a/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb @@ -51,7 +51,7 @@ module QA - dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text - dotnet nuget push "bin/Release/*.nupkg" --source gitlab only: - - master + - "#{project.default_branch}" tags: - "runner-for-#{project.name}" YAML @@ -84,7 +84,7 @@ module QA Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) end end end diff --git a/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb index 35c41bbb2b0..d5eca171d6c 100644 --- a/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb @@ -87,6 +87,7 @@ module QA after do runner.remove_via_api! + project&.remove_via_api! end it 'publishes a pypi package and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1087' do @@ -104,7 +105,33 @@ module QA Page::Project::Packages::Index.perform do |index| aggregate_failures do expect(index).to have_content("Package deleted successfully") - expect(index).to have_no_package(package_name) + expect(index).not_to have_package(package_name) + end + end + end + + context 'Geo', :orchestrated, :geo do + it 'replicates a published pypi package to the Geo secondary site', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1120' do + QA::Runtime::Logger.debug('Visiting the secondary Geo site') + + QA::Flow::Login.while_signed_in(address: :geo_secondary) do + EE::Page::Main::Banner.perform do |banner| + expect(banner).to have_secondary_read_only_banner + end + + Page::Main::Menu.perform(&:go_to_projects) + + Page::Dashboard::Projects.perform do |dashboard| + dashboard.wait_for_project_replication(project.name) + dashboard.go_to_project(project.name) + end + + Page::Project::Menu.perform(&:click_packages_link) + + Page::Project::Packages::Index.perform do |index| + index.wait_for_package_replication(package_name) + expect(index).to have_package(package_name) + end end end end diff --git a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb index ec26e338b28..9ec05fcf5d3 100644 --- a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb @@ -27,7 +27,7 @@ module QA it 'parent pipelines passes if child passes', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/751' do add_ci_files(success_child_ci_file) - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completion') + Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') Page::Project::Pipeline::Show.perform do |parent_pipeline| expect(parent_pipeline).to have_child_pipeline @@ -37,7 +37,7 @@ module QA it 'parent pipeline fails if child fails', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/752' do add_ci_files(fail_child_ci_file) - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completion') + Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') Page::Project::Pipeline::Show.perform do |parent_pipeline| expect(parent_pipeline).to have_child_pipeline diff --git a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb index d7f5a326b0e..ed8c8baae0e 100644 --- a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb @@ -27,7 +27,7 @@ module QA it 'parent pipelines passes if child passes', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/754' do add_ci_files(success_child_ci_file) - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completion') + Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') Page::Project::Pipeline::Show.perform do |parent_pipeline| expect(parent_pipeline).to have_child_pipeline @@ -37,7 +37,7 @@ module QA it 'parent pipeline passes even if child fails', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/753' do add_ci_files(fail_child_ci_file) - Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completion') + Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') Page::Project::Pipeline::Show.perform do |parent_pipeline| expect(parent_pipeline).to have_child_pipeline diff --git a/qa/qa/specs/features/sanity/version_spec.rb b/qa/qa/specs/features/sanity/version_spec.rb index cace46c3590..e93a8a6fea1 100644 --- a/qa/qa/specs/features/sanity/version_spec.rb +++ b/qa/qa/specs/features/sanity/version_spec.rb @@ -7,7 +7,7 @@ module QA # environment variable is the version actually running. # # See https://gitlab.com/gitlab-com/gl-infra/delivery/-/issues/1179 - RSpec.describe 'Version sanity check', :smoke do + RSpec.describe 'Version sanity check', :smoke, only: { pipeline: [:pre, :release] } do let(:api_client) { Runtime::API::Client.new(:gitlab) } let(:request) { Runtime::API::Request.new(api_client, '/version') } |