diff options
Diffstat (limited to 'qa/qa/specs/features')
48 files changed, 911 insertions, 70 deletions
diff --git a/qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb index aa06947e93b..90f58090ccd 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb @@ -22,7 +22,7 @@ module QA end end - after(:context) do + after(:context, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/238187', type: :stale }) do # Leave the cluster in a suitable state for subsequent tests, # if there was a problem during the tests here praefect_manager.reset_primary_to_original 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 4515e76539b..6654a35915f 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 @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do context 'Gitaly' do - describe 'Backend node recovery', :orchestrated, :gitaly_cluster, :skip_live_env do + describe 'Backend node recovery', :orchestrated, :gitaly_cluster, :skip_live_env, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/238186', type: :investigating } do let(:praefect_manager) { Service::PraefectManager.new } let(:project) do Resource::Project.fabricate! do |project| @@ -22,7 +22,7 @@ module QA praefect_manager.reset_primary_to_original end - it 'recovers from dataloss', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/238186', type: :investigating }, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/978' do + it 'recovers from dataloss', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/978' do # Create a new project with a commit and wait for it to replicate praefect_manager.wait_for_replication(project.id) 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 758ba582929..e96b9ad9258 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 @@ -4,7 +4,6 @@ module QA RSpec.describe 'Create' do describe 'Changing Gitaly repository storage', :requires_admin do praefect_manager = Service::PraefectManager.new - praefect_manager.gitlab = 'gitlab' shared_examples 'repository storage move' do it 'confirms a `finished` status after moving project repository storage' do @@ -28,7 +27,6 @@ module QA context 'when moving from one Gitaly storage to another', :orchestrated, :repository_storage, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/973' do let(:source_storage) { { type: :gitaly, name: 'default' } } let(:destination_storage) { { type: :gitaly, name: QA::Runtime::Env.additional_repository_storage } } - let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'repo-storage-move-status' @@ -37,6 +35,10 @@ module QA end end + before do + praefect_manager.gitlab = 'gitlab' + end + it_behaves_like 'repository storage move' end @@ -46,7 +48,6 @@ module QA context 'when moving from Gitaly to Gitaly Cluster', :requires_praefect, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/974' 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 Resource::Project.fabricate_via_api! do |project| project.name = 'repo-storage-move' @@ -56,6 +57,10 @@ module QA end end + before do + praefect_manager.gitlab = 'gitlab-gitaly-cluster' + end + it_behaves_like 'repository storage move' end end diff --git a/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb index 29f131ac322..c3cb503ed3f 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb @@ -17,12 +17,12 @@ module QA end before do - Runtime::Feature.enable_and_verify('gitaly_distributed_reads') + Runtime::Feature.enable(:gitaly_distributed_reads) praefect_manager.wait_for_replication(project.id) end after do - Runtime::Feature.disable_and_verify('gitaly_distributed_reads') + Runtime::Feature.disable(:gitaly_distributed_reads) end it 'reads from each node', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/979' 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 new file mode 100644 index 00000000000..82a06780830 --- /dev/null +++ b/qa/qa/specs/features/api/3_create/merge_request/push_options_labels_spec.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Merge request push options' do + # If run locally on GDK, push options need to be enabled on the host with the following command: + # + # 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' + + project = Resource::Project.fabricate_via_api! do |project| + project.name = 'merge-request-push-options' + project.initialize_with_readme = true + end + + it 'sets labels', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1032' do + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.commit_message = commit_message + push.branch_name = branch + push.merge_request_push_options = { + create: true, + title: title, + label: %w[one two three] + } + end + + merge_request = project.merge_request_with_title(title) + + expect(merge_request).not_to be_nil, "There was a problem creating the merge request" + expect(merge_request[:labels]).to include('one').and include('two').and include('three') + end + + context 'when labels are set already' do + it 'removes them', 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)}" + push.commit_message = commit_message + push.branch_name = branch + push.new_branch = false + push.merge_request_push_options = { + title: title, + unlabel: %w[one three] + } + end + + merge_request = project.merge_request_with_title(title) + + expect(merge_request).not_to be_nil, "There was a problem creating the merge request" + + aggregate_failures do + expect(merge_request[:labels]).to include('two') + expect(merge_request[:labels]).not_to include('one') + expect(merge_request[:labels]).not_to include('three') + end + end + end + end + end +end diff --git a/qa/qa/specs/features/api/3_create/merge_request/push_options_mwps_spec.rb b/qa/qa/specs/features/api/3_create/merge_request/push_options_mwps_spec.rb new file mode 100644 index 00000000000..dde4708874d --- /dev/null +++ b/qa/qa/specs/features/api/3_create/merge_request/push_options_mwps_spec.rb @@ -0,0 +1,124 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Merge request push options' do + # If run locally on GDK, push options need to be enabled on the host with the following command: + # + # git config --global receive.advertisepushoptions true + + let(:branch) { "push-options-test-#{SecureRandom.hex(8)}" } + let(:title) { "MR push options test #{SecureRandom.hex(8)}" } + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'merge-request-push-options' + project.initialize_with_readme = true + end + end + + let!(:runner) do + Resource::Runner.fabricate! do |runner| + runner.project = project + runner.name = "runner-for-#{project.name}" + runner.tags = ["runner-for-#{project.name}"] + end + end + + after do + runner.remove_via_api! + end + + it 'sets merge when pipeline succeeds', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1037' do + 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: <<~YAML + no-op: + tags: + - "runner-for-#{project.name}" + script: sleep 999 # Leave the pipeline pending + YAML + } + ] + ) + end + + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.branch_name = branch + push.merge_request_push_options = { + create: true, + merge_when_pipeline_succeeds: true, + title: title + } + end + + merge_request = project.merge_request_with_title(title) + + expect(merge_request).not_to be_nil, "There was a problem creating the merge request" + + merge_request = Resource::MergeRequest.fabricate_via_api! do |mr| + mr.project = project + mr.id = merge_request[:iid] + end + + expect(merge_request.state).to eq('opened') + expect(merge_request.merge_status).to eq('checking') + expect(merge_request.merge_when_pipeline_succeeds).to be true + end + + it 'merges when pipeline succeeds', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1036' do + 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: <<~YAML + no-op: + tags: + - "runner-for-#{project.name}" + script: echo 'OK' + YAML + } + ] + ) + end + + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.branch_name = branch + push.merge_request_push_options = { + create: true, + merge_when_pipeline_succeeds: true, + title: title + } + end + + merge_request = project.merge_request_with_title(title) + + expect(merge_request).not_to be_nil, "There was a problem creating the merge request" + expect(merge_request[:merge_when_pipeline_succeeds]).to be true + + merge_request = Support::Waiter.wait_until(sleep_interval: 5) do + mr = Resource::MergeRequest.fabricate_via_api! do |mr| + mr.project = project + mr.id = merge_request[:iid] + end + + next unless mr.state == 'merged' + + mr + end + + expect(merge_request.state).to eq('merged') + end + end + end +end diff --git a/qa/qa/specs/features/api/3_create/merge_request/push_options_remove_source_branch_spec.rb b/qa/qa/specs/features/api/3_create/merge_request/push_options_remove_source_branch_spec.rb new file mode 100644 index 00000000000..d6bd668fa8a --- /dev/null +++ b/qa/qa/specs/features/api/3_create/merge_request/push_options_remove_source_branch_spec.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Merge request push options' do + # If run locally on GDK, push options need to be enabled on the host with the following command: + # + # git config --global receive.advertisepushoptions true + + let(:branch) { "push-options-test-#{SecureRandom.hex(8)}" } + let(:title) { "MR push options test #{SecureRandom.hex(8)}" } + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'merge-request-push-options' + project.initialize_with_readme = true + end + end + + it 'removes the source branch', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1035' do + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.branch_name = branch + push.merge_request_push_options = { + create: true, + remove_source_branch: true, + title: title + } + end + + merge_request = project.merge_request_with_title(title) + + expect(merge_request).not_to be_nil, "There was a problem creating the merge request" + + merge_request = Resource::MergeRequest.fabricate_via_api! do |mr| + mr.project = project + mr.id = merge_request[:iid] + end.merge_via_api! + + expect(merge_request[:state]).to eq('merged') + expect(project).not_to have_branch(branch) + end + end + end +end diff --git a/qa/qa/specs/features/api/3_create/merge_request/push_options_target_branch_spec.rb b/qa/qa/specs/features/api/3_create/merge_request/push_options_target_branch_spec.rb new file mode 100644 index 00000000000..6072fd8c1a2 --- /dev/null +++ b/qa/qa/specs/features/api/3_create/merge_request/push_options_target_branch_spec.rb @@ -0,0 +1,53 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Merge request push options' do + # If run locally on GDK, push options need to be enabled on the host with the following command: + # + # git config --global receive.advertisepushoptions true + + let(:title) { "MR push options test #{SecureRandom.hex(8)}" } + + 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 a target branch', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1034' do + target_branch = "push-options-test-target-#{SecureRandom.hex(8)}" + + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.branch_name = target_branch + push.file_content = "Target branch test target branch #{SecureRandom.hex(8)}" + end + + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.branch_name = "push-options-test-#{SecureRandom.hex(8)}" + push.file_content = "Target branch test source branch #{SecureRandom.hex(8)}" + push.merge_request_push_options = { + create: true, + title: title, + target: target_branch + } + end + + merge_request = project.merge_request_with_title(title) + + expect(merge_request).not_to be_nil, "There was a problem creating the merge request" + expect(merge_request[:target_branch]).to eq(target_branch) + + merge_request = Resource::MergeRequest.fabricate_via_api! do |mr| + mr.project = project + mr.id = merge_request[:iid] + end.merge_via_api! + + expect(merge_request[:state]).to eq('merged') + end + end + end +end diff --git a/qa/qa/specs/features/api/3_create/merge_request/push_options_title_description_spec.rb b/qa/qa/specs/features/api/3_create/merge_request/push_options_title_description_spec.rb new file mode 100644 index 00000000000..f49a8a229dc --- /dev/null +++ b/qa/qa/specs/features/api/3_create/merge_request/push_options_title_description_spec.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Merge request push options' do + # If run locally on GDK, push options need to be enabled on the host with the following command: + # + # git config --global receive.advertisepushoptions 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 title and description', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1038' do + description = "This is a test of MR push options" + title = "MR push options test #{SecureRandom.hex(8)}" + + Resource::Repository::ProjectPush.fabricate! do |push| + push.project = project + push.branch_name = "push-options-test-#{SecureRandom.hex(8)}" + push.merge_request_push_options = { + create: true, + title: title, + description: description + } + end + + merge_request = project.merge_request_with_title(title) + + expect(merge_request).not_to be_nil, "There was a problem creating the merge request" + + aggregate_failures do + expect(merge_request[:title]).to eq(title) + expect(merge_request[:description]).to eq(description) + end + + merge_request = Resource::MergeRequest.fabricate_via_api! do |mr| + mr.project = project + mr.id = merge_request[:iid] + end.merge_via_api! + + expect(merge_request[:state]).to eq('merged') + end + end + end +end diff --git a/qa/qa/specs/features/api/3_create/repository/default_branch_name_setting_spec.rb b/qa/qa/specs/features/api/3_create/repository/default_branch_name_setting_spec.rb index af155b22618..f86bbee05c2 100644 --- a/qa/qa/specs/features/api/3_create/repository/default_branch_name_setting_spec.rb +++ b/qa/qa/specs/features/api/3_create/repository/default_branch_name_setting_spec.rb @@ -13,7 +13,7 @@ module QA Runtime::ApplicationSettings.restore_application_settings(:default_branch_name) end - it 'sets the default branch name for a new project' do + it 'sets the default branch name for a new project', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1018' do project = Resource::Project.fabricate_via_api! do |project| project.name = "default-branch-name" project.initialize_with_readme = true @@ -32,7 +32,7 @@ module QA end end - it 'allows a project to be created via the CLI with a different default branch name' do + it 'allows a project to be created via the CLI with a different default branch name', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1019' do project_name = "default-branch-name-via-cli-#{SecureRandom.hex(8)}" group = Resource::Group.fabricate_via_api! diff --git a/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb b/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb index 4bd99b4820e..548933d2cde 100644 --- a/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb +++ b/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb @@ -28,6 +28,13 @@ module QA end end + after do + # Delete the .netrc file created during this test so that subsequent tests don't try to use the logins + Git::Repository.perform do |repository| + repository.delete_netrc + end + end + it 'download archives of each user project then check they are different', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/427' do archive_checksums = {} 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 new file mode 100644 index 00000000000..e81ebd5fa9d --- /dev/null +++ b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +module QA + context 'Manage', :requires_admin, :skip_live_env do + describe '2FA' do + let!(:user) { Resource::User.fabricate_via_api! } + let!(:user_api_client) { Runtime::API::Client.new(:gitlab, user: user) } + let(:address) { QA::Runtime::Scenario.gitlab_address } + let(:uri) { URI.parse(address) } + let(:ssh_port) { uri.port == 80 ? '' : '2222' } + let!(:ssh_key) do + Resource::SSHKey.fabricate_via_api! do |resource| + resource.title = "key for ssh tests #{Time.now.to_f}" + resource.api_client = user_api_client + end + end + + before do + enable_2fa_for_user(user) + end + + it 'allows 2FA code recovery via ssh' do + recovery_code = Support::SSH.perform do |ssh| + ssh.key = ssh_key + ssh.uri = address.gsub(uri.port.to_s, ssh_port) + ssh.setup + output = ssh.reset_2fa_codes + output.scan(/([A-Za-z0-9]{16})\n/).flatten.first + end + + Flow::Login.sign_in(as: user, skip_page_validation: true) + Page::Main::TwoFactorAuth.perform do |two_fa_auth| + two_fa_auth.set_2fa_code(recovery_code) + two_fa_auth.click_verify_code_button + end + + expect(Page::Main::Menu.perform(&:signed_in?)).to be_truthy + + Page::Main::Menu.perform(&:sign_out) + Flow::Login.sign_in(as: user, skip_page_validation: true) + Page::Main::TwoFactorAuth.perform do |two_fa_auth| + two_fa_auth.set_2fa_code(recovery_code) + two_fa_auth.click_verify_code_button + end + + expect(page).to have_text('Invalid two-factor code') + end + + def enable_2fa_for_user(user) + Flow::Login.while_signed_in(as: user) do + Page::Main::Menu.perform(&:click_settings_link) + Page::Profile::Menu.perform(&:click_account) + Page::Profile::Accounts::Show.perform(&:click_enable_2fa_button) + + Page::Profile::TwoFactorAuth.perform do |two_fa_auth| + 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 + end + end + end + 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 bd0d28c86be..e514507fcb6 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 @@ -18,7 +18,7 @@ module QA QA::Resource::Group.fabricate_via_api! do |group| group.sandbox = sandbox_group group.api_client = owner_api_client - group.name = 'group-with-2fa' + group.path = "group-with-2fa-#{SecureRandom.hex(8)}" end end 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 a10329d5936..863c394a9f9 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 @@ -41,7 +41,7 @@ module QA context 'when using attachments in comments', :object_storage do let(:gif_file_name) { 'banana_sample.gif' } let(:file_to_attach) do - File.absolute_path(File.join('spec', 'fixtures', gif_file_name)) + File.absolute_path(File.join('qa', 'fixtures', 'designs', gif_file_name)) end before do diff --git a/qa/qa/specs/features/browser_ui/2_plan/milestone/assign_milestone_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/milestone/assign_milestone_spec.rb index b011978dce6..c908b1c46a1 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/milestone/assign_milestone_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/milestone/assign_milestone_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Plan' do + RSpec.describe 'Plan', :reliable do describe 'Milestones' do include Support::Dates diff --git a/qa/qa/specs/features/browser_ui/2_plan/milestone/create_group_milestone_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/milestone/create_group_milestone_spec.rb index 5f7e28190b2..564cfbb8399 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/milestone/create_group_milestone_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/milestone/create_group_milestone_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Plan' do + RSpec.describe 'Plan', :reliable do describe 'Group milestone' do include Support::Dates diff --git a/qa/qa/specs/features/browser_ui/2_plan/milestone/create_project_milestone_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/milestone/create_project_milestone_spec.rb index 489691b4d0c..99d547acb26 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/milestone/create_project_milestone_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/milestone/create_project_milestone_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Plan' do + RSpec.describe 'Plan', :reliable do describe 'Project milestone' do include Support::Dates 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 a2190a8cf41..13761244300 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Plan' do + RSpec.describe 'Plan', :reliable do describe 'Related issues' do let(:project) do Resource::Project.fabricate_via_api! do |project| diff --git a/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_content_spec.rb b/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_content_spec.rb index ff2b4fa5364..051e8fcecbe 100644 --- a/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_content_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_content_spec.rb @@ -5,7 +5,7 @@ module QA context 'Design Management' do let(:issue) { Resource::Issue.fabricate_via_api! } let(:design_filename) { 'banana_sample.gif' } - let(:design) { File.absolute_path(File.join('spec', 'fixtures', design_filename)) } + let(:design) { File.absolute_path(File.join('qa', 'fixtures', 'designs', design_filename)) } let(:annotation) { "This design is great!" } before do diff --git a/qa/qa/specs/features/browser_ui/3_create/design_management/archive_design_content_spec.rb b/qa/qa/specs/features/browser_ui/3_create/design_management/archive_design_content_spec.rb new file mode 100644 index 00000000000..7090427e5a4 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/design_management/archive_design_content_spec.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + context 'Design Management' do + let(:first_design) { Resource::Design.fabricate! } + + let(:second_design) do + Resource::Design.fabricate! do |design| + design.issue = first_design.issue + design.filename = 'values.png' + end + end + + let(:third_design) do + Resource::Design.fabricate! do |design| + design.issue = second_design.issue + design.filename = 'tanuki.jpg' + end + end + + before do + Flow::Login.sign_in + end + + it 'user archives a design', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/274' do + third_design.issue.visit! + + Page::Project::Issue::Show.perform do |issue| + issue.select_design(third_design.filename) + + issue.archive_selected_designs + + expect(issue).not_to have_design(third_design.filename) + expect(issue).to have_design(first_design.filename) + expect(issue).to have_design(second_design.filename) + end + + Page::Project::Issue::Show.perform do |issue| + issue.select_design(second_design.filename) + issue.select_design(first_design.filename) + + issue.archive_selected_designs + + expect(issue).not_to have_design(first_design.filename) + expect(issue).not_to have_design(second_design.filename) + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/design_management/modify_design_content_spec.rb b/qa/qa/specs/features/browser_ui/3_create/design_management/modify_design_content_spec.rb new file mode 100644 index 00000000000..135063b6644 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/design_management/modify_design_content_spec.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + context 'Design Management' do + let(:design) do + Resource::Design.fabricate! do |design| + design.filename = 'tanuki.jpg' + end + end + + before do + Flow::Login.sign_in + end + + it 'user adds a design and modifies it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/273' do + design.issue.visit! + + Page::Project::Issue::Show.perform do |issue| + expect(issue).to have_created_icon + end + + Page::Project::Issue::Show.perform do |issue| + issue.update_design(design.filename) + expect(issue).to have_modified_icon + end + end + end + end +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 new file mode 100644 index 00000000000..7844d0d7ccb --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create', :requires_admin do + describe 'View merge request merge-ref diff' do + let(:merge_request) do + Resource::MergeRequest.fabricate_via_api! do |merge_request| + merge_request.title = 'This is a merge request' + merge_request.description = '... for viewing merge-ref and merge-base diffs' + merge_request.file_content = 'This exists on the source branch only' + end + end + + let(:new_file_name) { "added_file-#{SecureRandom.hex(8)}.txt" } + + before do + commit_to_branch(merge_request.target_branch, new_file_name) + commit_to_branch(merge_request.source_branch, new_file_name) + + Flow::Login.sign_in + end + + context 'when the feature flag default_merge_ref_for_diffs is enabled' do + before do + Runtime::Feature.enable('default_merge_ref_for_diffs', project: merge_request.project) + + merge_request.visit! + end + + it 'views the merge-ref diff by default' do + Page::MergeRequest::Show.perform do |mr_page| + 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).to have_file(merge_request.file_name) + expect(mr_page).not_to have_file(new_file_name) + end + end + end + + context 'when the feature flag default_merge_ref_for_diffs is disabled' do + before do + Runtime::Feature.disable('default_merge_ref_for_diffs', project: merge_request.project) + + merge_request.visit! + end + + it 'views the merge-base diff by default' do + Page::MergeRequest::Show.perform do |mr_page| + 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).to have_file(merge_request.file_name) + expect(mr_page).to have_file(new_file_name) + end + end + end + + def commit_to_branch(branch, file) + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = merge_request.project + commit.branch = branch + commit.commit_message = "Add new file on #{branch}" + commit.add_files( + [ + { + file_path: file, + content: "This exists on source and target branches" + } + ] + ) + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb index 43f4b080c73..5aa5f0fc0a3 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb @@ -18,7 +18,6 @@ module QA file.commit_message = commit_message_for_create end - expect(page).to have_content('The file has been successfully created.') expect(page).to have_content(file_name) expect(page).to have_content(file_content) expect(page).to have_content(commit_message_for_create) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb index 8ac7285d70c..5781bf8a7f0 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb @@ -37,8 +37,10 @@ module QA project.wait_for_push_new_branch # Check that the push worked - expect(page).to have_content(file_name) - expect(page).to have_content(file_content) + Page::Project::Show.perform do |project_page| + expect(project_page).to have_file(file_name) + expect(project_page).to have_readme_content(file_content) + end # And check that the correct Git protocol was used expect(git_protocol_reported).to eq(git_protocol) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb index f96b424d233..45afa252305 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb @@ -4,7 +4,6 @@ module QA RSpec.describe 'Create' do describe 'Push mirror a repository over HTTP' do it 'configures and syncs LFS objects for a (push) mirrored repository', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/414' do - Runtime::Feature.enable_and_verify('push_mirror_syncs_lfs') Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) @@ -37,8 +36,10 @@ module QA # Check that the target project has the commit from the source target_project.visit! - expect(page).to have_content('README.md') - expect(page).to have_content('The rendered file could not be displayed because it is stored in LFS') + Page::Project::Show.perform do |project_page| + expect(project_page).to have_file('README.md') + expect(project_page).to have_readme_content('The rendered file could not be displayed because it is stored in LFS') + end end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb index 2ebab7d2a30..222eb3771ad 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb @@ -41,7 +41,7 @@ module QA retry_on_fail do expect { push_new_file('oversize_file_2.bin', wait_for_push: false) } - .to raise_error(QA::Git::Repository::RepositoryCommandError, /remote: fatal: pack exceeds maximum allowed size/) + .to raise_error(QA::Support::Run::CommandError, /remote: fatal: pack exceeds maximum allowed size/) end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb index 8b6973e6cea..cf14017b7f1 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb @@ -36,8 +36,10 @@ module QA project.visit! - expect(page).to have_content('README.md') - expect(page).to have_content("This is a test project named #{project.name}") + Page::Project::Show.perform do |project_page| + expect(project_page).to have_file('README.md') + expect(project_page).to have_readme_content("This is a test project named #{project.name}") + end end end end 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 d20abd658c6..54d00209cc7 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 @@ -35,7 +35,7 @@ module QA roles: Resource::ProtectedBranch::Roles::NO_ONE }) - expect { push_new_file(branch_name) }.to raise_error(QA::Git::Repository::RepositoryCommandError, /remote: GitLab: You are not allowed to push code to protected branches on this project\.([\s\S]+)\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/) + expect { push_new_file(branch_name) }.to raise_error(QA::Support::Run::CommandError, /remote: GitLab: You are not allowed to push code to protected branches on this project\.([\s\S]+)\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/) end end 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 ef3b315506f..a3f6d521766 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 @@ -36,6 +36,10 @@ module QA Flow::Login.sign_in end + after do + ssh_key.remove_via_api! + 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.repository_http_uri = repository_uri_http @@ -87,7 +91,7 @@ module QA repository.init_repository expect { repository.pull(repository_uri_ssh, branch_name) } - .to raise_error(QA::Git::Repository::RepositoryCommandError, /fatal: Could not read from remote repository\./) + .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 34f6b464f29..be56b870490 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 @@ -36,6 +36,10 @@ module QA Flow::Login.sign_in end + after do + ssh_key.remove_via_api! + end + it 'clones, pushes, and pulls a project snippet over HTTP, edits via UI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/833' do Resource::Repository::Push.fabricate! do |push| push.repository_http_uri = repository_uri_http @@ -86,7 +90,7 @@ module QA repository.init_repository expect { repository.pull(repository_uri_ssh, branch_name) } - .to raise_error(QA::Git::Repository::RepositoryCommandError, /fatal: Could not read from remote repository\./) + .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/create_personal_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb new file mode 100644 index 00000000000..50f2f4789fa --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Multiple file snippet' do + it 'creates a personal snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/842' do + Flow::Login.sign_in + + Page::Main::Menu.perform do |menu| + menu.go_to_more_dropdown_option(:snippets_link) + end + + Resource::Snippet.fabricate_via_browser_ui! do |snippet| + snippet.title = 'Personal snippet with multiple files' + snippet.description = 'Snippet description' + snippet.visibility = 'Public' + snippet.file_name = 'First file name' + snippet.file_content = 'First file content' + + snippet.add_files do |files| + files.append(name: 'Second file name', content: 'Second file content') + files.append(name: 'Third file name', content: 'Third file content') + end + end + + Page::Dashboard::Snippet::Show.perform do |snippet| + expect(snippet).to have_snippet_title('Personal snippet with multiple files') + expect(snippet).to have_snippet_description('Snippet description') + expect(snippet).to have_visibility_type(/public/i) + expect(snippet).to have_file_name('First file name', 1) + expect(snippet).to have_file_content('First file content', 1) + expect(snippet).to have_file_name('Second file name', 2) + expect(snippet).to have_file_content('Second file content', 2) + expect(snippet).to have_file_name('Third file name', 3) + expect(snippet).to have_file_content('Third file content', 3) + end + end + end + end +end 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 0a8f6e13b2e..d80fc4c5b95 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 @@ -21,8 +21,8 @@ module QA 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).not_to have_file_content('###') - expect(snippet).not_to have_file_content('https://gitlab.com/') + expect(snippet).to have_no_file_content('###') + expect(snippet).to have_no_file_content('https://gitlab.com/') end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb new file mode 100644 index 00000000000..7b4ec573f53 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Multiple file snippet' do + it 'creates a project snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1024' do + Flow::Login.sign_in + + Resource::ProjectSnippet.fabricate_via_browser_ui! do |snippet| + snippet.title = 'Project snippet with multiple files' + snippet.description = 'Snippet description' + snippet.visibility = 'Private' + snippet.file_name = '01 file name' + snippet.file_content = '1 file content' + + # Ten is the limit of files you can have under one snippet at the moment + snippet.add_files do |files| + (2..10).each do |i| + files.append(name: file_name(i), content: file_content(i)) + end + end + end + + Page::Dashboard::Snippet::Show.perform do |snippet| + aggregate_failures 'file content verification' do + expect(snippet).to have_snippet_title('Project snippet with multiple files') + expect(snippet).to have_snippet_description('Snippet description') + expect(snippet).to have_visibility_type(/private/i) + + (1..10).each do |i| + expect(snippet).to have_file_name(file_name(i), i) + expect(snippet).to have_file_content(file_content(i), i) + end + end + end + end + + # Currently the files are returned in alphabetical order and not in the order they are created. + # However, it might soon change - see https://gitlab.com/gitlab-org/gitlab/-/issues/250836. + # By using a leading "0" we make sure the test works with either implementation. + def file_name(index) + "#{index.to_s.rjust(2, '0')} file name" + end + + def file_content(index) + "#{index} file content" + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb index ea821f8b3e6..f7a2e3081fb 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/create_first_file_in_web_ide_spec.rb @@ -10,7 +10,6 @@ module QA end end - let(:web_ide_url) { current_url + '-/ide/project/' + project.path_with_namespace } let(:file_name) { 'the very first file.txt' } before do @@ -18,10 +17,8 @@ module QA end it "creates the first file in an empty project via Web IDE", testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/847' do - # In the first iteration, the test opens Web IDE by modifying the URL to address past regressions. - # Once the Web IDE button is introduced for empty projects, the test will be modified to go through UI. - # See https://gitlab.com/gitlab-org/gitlab/-/issues/27915 and https://gitlab.com/gitlab-org/gitlab/-/issues/27535. - page.visit(web_ide_url) + project.visit! + Page::Project::Show.perform(&:create_first_new_file!) Page::Project::WebIDE::Edit.perform do |ide| ide.create_first_file(file_name) diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb index e8053600930..4f1d9ac1696 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb @@ -4,7 +4,7 @@ module QA RSpec.describe 'Create' do context 'Wiki' do let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } - let(:new_path) { "a/new/path" } + let(:new_path) { "a/new/path-with-spaces" } before do Flow::Login.sign_in @@ -23,7 +23,9 @@ module QA Page::Project::Wiki::Edit.perform(&:click_save_changes) Page::Project::Wiki::Show.perform do |wiki| - expect(wiki).to have_directory(new_path) + expect(wiki).to have_directory('a') + expect(wiki).to have_directory('new') + expect(wiki).to have_directory('path with spaces') end end end 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 cc4d0e1f6b5..ccd4d34a916 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 @@ -3,7 +3,7 @@ module QA RSpec.describe 'Verify' do describe 'Add or Remove CI variable via UI', :smoke do - let!(:project) do + let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'project-with-ci-variables' project.description = 'project with CI variables' @@ -12,31 +12,27 @@ module QA before do Flow::Login.sign_in + project.visit! add_ci_variable - open_ci_cd_settings end it 'user adds a CI variable', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/395' do - Page::Project::Settings::CICD.perform do |settings| - settings.expand_ci_variables do |page| - expect(page).to have_text('VARIABLE_KEY') - expect(page).not_to have_text('some_CI_variable') + 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') - page.click_reveal_ci_variable_value_button + ci_variable.click_reveal_ci_variable_value_button - expect(page).to have_text('some_CI_variable') - end + expect(ci_variable).to have_text('some_CI_variable') end end it 'user removes a CI variable', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/394' do - Page::Project::Settings::CICD.perform do |settings| - settings.expand_ci_variables do |page| - page.click_edit_ci_variable - page.click_ci_variable_delete_button + Page::Project::Settings::CiVariables.perform do |ci_variable| + ci_variable.click_edit_ci_variable + ci_variable.click_ci_variable_delete_button - expect(page).not_to have_text('VARIABLE_KEY') - end + expect(ci_variable).to have_text('There are no variables yet', wait: 60) end end @@ -50,11 +46,6 @@ module QA ci_variable.masked = false end end - - def open_ci_cd_settings - project.visit! - Page::Project::Menu.perform(&:go_to_ci_cd_settings) - end end end end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb index 326647b25f7..8de739f1559 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :docker, :runner do + RSpec.describe 'Verify', :runner do describe 'Pipeline creation and processing' do let(:executor) { "qa-runner-#{Time.now.to_i}" } let(:max_wait) { 30 } 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 new file mode 100644 index 00000000000..153ccafaa20 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Verify' do + describe 'Run pipeline', :requires_admin, :skip_live_env do + # [TODO]: Developer to remove :requires_admin and :skip_live_env once FF is removed in https://gitlab.com/gitlab-org/gitlab/-/issues/229632 + + context 'with web only rule' do + let(:feature_flag) { :new_pipeline_form } + let(:job_name) { 'test_job' } + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'web-only-pipeline' + end + end + + let!(:ci_file) do + 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: <<~YAML + #{job_name}: + tags: + - #{project.name} + script: echo 'OK' + only: + - web + YAML + } + ] + ) + end + end + + before do + Runtime::Feature.enable(feature_flag) # [TODO]: Developer to remove when feature flag is removed + Flow::Login.sign_in + project.visit! + Page::Project::Menu.perform(&:click_ci_cd_pipelines) + end + + after do + Runtime::Feature.disable(feature_flag) # [TODO]: Developer to remove when feature flag is removed + end + + it 'can trigger pipeline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/946' do + Page::Project::Pipeline::Index.perform do |index| + expect(index).not_to have_pipeline # should not auto trigger pipeline + index.click_run_pipeline_button + end + + Page::Project::Pipeline::New.perform(&:click_run_pipeline_button) + + Page::Project::Pipeline::Show.perform do |pipeline| + expect(pipeline).to have_job(job_name) + end + end + end + end + end +end 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 new file mode 100644 index 00000000000..39d5fbaba6b --- /dev/null +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_child_pipeline_with_manual_spec.rb @@ -0,0 +1,109 @@ +# frozen_string_literal: true + +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 + + 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 + Resource::Project.fabricate_via_api! do |project| + project.name = 'project-with-pipeline' + end + end + + let!(:runner) do + Resource::Runner.fabricate! do |runner| + runner.project = project + runner.name = executor + runner.tags = [executor] + end + 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! + view_the_last_pipeline + end + + after do + Runtime::Feature.disable(feature_flag) # [TODO]: Developer to remove when feature flag is removed + runner.remove_via_api! + end + + it 'can trigger bridge job', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1049' do + Page::Project::Pipeline::Show.perform do |parent_pipeline| + expect(parent_pipeline).not_to have_child_pipeline + + parent_pipeline.click_job_action('trigger') + Support::Waiter.wait_until { parent_pipeline.has_child_pipeline? } + parent_pipeline.expand_child_pipeline + + expect(parent_pipeline).to have_build('child_build', status: nil) + end + end + + private + + def add_ci_files + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add parent and child pipelines CI files.' + commit.add_files( + [ + child_ci_file, + parent_ci_file + ] + ) + 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 parent_ci_file + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + build: + stage: build + tags: ["#{executor}"] + script: echo build + + trigger: + stage: test + when: manual + trigger: + include: '.child-pipeline.yml' + + deploy: + stage: deploy + tags: ["#{executor}"] + script: echo deploy + YAML + } + end + + def child_ci_file + { + file_path: '.child-pipeline.yml', + content: <<~YAML + child_build: + stage: build + tags: ["#{executor}"] + script: echo build + YAML + } + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb index a296d60b27c..9ce87f353d0 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :docker, :runner do + RSpec.describe 'Verify', :runner do describe 'Runner registration' do let(:executor) { "qa-runner-#{Time.now.to_i}" } let!(:runner) do diff --git a/qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb index f4edaaa84a8..5bfc88e45f2 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/testing/view_code_coverage_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :docker, :runner do + RSpec.describe 'Verify', :runner do describe 'Code coverage statistics' do let(:simplecov) { '\(\d+.\d+\%\) covered' } let(:executor) { "qa-runner-#{Time.now.to_i}" } 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 a617f3b3e29..4ca356c9b65 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Package', :docker, :orchestrated, :packages do + RSpec.describe 'Package', :orchestrated, :packages do describe 'Maven Repository' do include Runtime::Fixtures 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 e97ede35610..817e146adfe 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Package', :docker, :orchestrated, :packages do + RSpec.describe 'Package', :orchestrated, :packages do describe 'NPM registry' do include Runtime::Fixtures @@ -21,7 +21,7 @@ module QA end end - it 'publishes an npm package and then deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/944', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/247281', type: :investigating } do + it 'publishes an npm package and then deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/944' do uri = URI.parse(Runtime::Scenario.gitlab_address) gitlab_host_with_port = "#{uri.host}:#{uri.port}" gitlab_address_with_port = "#{uri.scheme}://#{uri.host}:#{uri.port}" @@ -68,7 +68,7 @@ module QA end Page::Project::Packages::Index.perform do |index| - expect(index).to have_content("Package was removed") + expect(index).to have_content("Package deleted successfully") expect(index).to have_no_package(package_name) end end diff --git a/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb b/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb index 18eb52830a2..abac4f2b91d 100644 --- a/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb @@ -3,7 +3,7 @@ require 'digest/sha1' module QA - RSpec.describe 'Release', :docker, :runner do + RSpec.describe 'Release', :runner do describe 'Git clone using a deploy key' do before do Flow::Login.sign_in 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 47a1b3b5670..ece45d093a7 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Release', :docker, :runner, :reliable do + RSpec.describe 'Release', :runner, :reliable do describe 'Parent-child pipelines dependent relationship' do let!(:project) do Resource::Project.fabricate_via_api! do |project| 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 9eb81244aa4..38cee0e62ca 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Release', :docker, :runner, :reliable do + RSpec.describe 'Release', :runner, :reliable do describe 'Parent-child pipelines independent relationship' do let!(:project) do Resource::Project.fabricate_via_api! do |project| diff --git a/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb b/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb index 53a1c8010af..6d31780f196 100644 --- a/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb +++ b/qa/qa/specs/features/browser_ui/7_configure/auto_devops/create_project_with_auto_devops_spec.rb @@ -15,7 +15,7 @@ module QA disable_optional_jobs(project) end - describe 'Auto DevOps support', :orchestrated, :kubernetes, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/230927', type: :stale } do + describe 'Auto DevOps support', :orchestrated, :kubernetes, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/251090', type: :stale } do context 'when rbac is enabled' do let(:cluster) { Service::KubernetesCluster.new.create! } @@ -24,6 +24,8 @@ module QA end it 'runs auto devops', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/702' do + skip('Test requires tunnel: see https://gitlab.com/gitlab-org/gitlab/-/issues/251090') + Flow::Login.sign_in # Set an application secret CI variable (prefixed with K8S_SECRET_) diff --git a/qa/qa/specs/features/sanity/framework_spec.rb b/qa/qa/specs/features/sanity/framework_spec.rb index 611c6c7b1ff..feec56478c0 100644 --- a/qa/qa/specs/features/sanity/framework_spec.rb +++ b/qa/qa/specs/features/sanity/framework_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - context 'Framework sanity checks', :orchestrated, :framework do + RSpec.describe 'Framework sanity checks', :orchestrated, :framework do describe 'Passing orchestrated example' do it 'succeeds' do Runtime::Browser.visit(:gitlab, Page::Main::Login) |