diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 19:00:14 +0000 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /qa/qa/specs | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) | |
download | gitlab-ce-05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2.tar.gz |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'qa/qa/specs')
88 files changed, 736 insertions, 411 deletions
diff --git a/qa/qa/specs/features/api/1_manage/import/import_github_repo_spec.rb b/qa/qa/specs/features/api/1_manage/import/import_github_repo_spec.rb index 27f9bcc9675..a10e95a860c 100644 --- a/qa/qa/specs/features/api/1_manage/import/import_github_repo_spec.rb +++ b/qa/qa/specs/features/api/1_manage/import/import_github_repo_spec.rb @@ -9,10 +9,7 @@ module QA context 'when imported via api' do it 'imports project', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347670' do - imported_project.reload! # import the project - - expect { imported_project.project_import_status[:import_status] }.to eventually_eq('finished') - .within(max_duration: 240, sleep_interval: 1) + expect_project_import_finished_successfully aggregate_failures do verify_status_data @@ -30,15 +27,18 @@ module QA def verify_status_data stats = imported_project.project_import_status.dig(:stats, :imported) - expect(stats).to include( + expect(stats).to eq( issue: 1, + issue_event: 16, + pull_request: 1, + pull_request_review: 2, + pull_request_review_request: 1, + diff_note: 1, label: 9, milestone: 1, note: 3, - pull_request: 1, - pull_request_review: 1, - diff_note: 1, - release: 1 + release: 1, + protected_branch: 2 ) end @@ -154,7 +154,10 @@ module QA [ "*Created by: gitlab-qa-github*\n\n**Review:** Commented\n\nGood but needs some improvement", "*Created by: gitlab-qa-github*\n\n```suggestion:-0+0\nProject for GitHub import test to GitLab\r\n```", - "*Created by: gitlab-qa-github*\n\nSome test PR comment" + "*Created by: gitlab-qa-github*\n\nSome test PR comment", + "*Created by: gitlab-qa*\n\n**Review:** Approved", + "assigned to @#{user.username}", + "requested review from @#{user.username}" ] ) expect(events).to match_array( @@ -163,6 +166,19 @@ module QA { name: "add_milestone", label: "0.0.1" } ] ) + # TODO: reenable once https://gitlab.com/gitlab-org/gitlab/-/issues/386714 fixed + # currently this doesn't work as expected if reviewer is not matched by public email + # event for assigning approver is created with reviewer being user doing import but mr actually doesn't + # contain reviewers or the approved state + # + # reviews = merge_request.reviews.map do |review| + # { + # id: review.dig(:user, :id), + # username: review.dig(:user, :username), + # state: review[:state] + # } + # end + # expect(reviews).to eq([{ id: user.id, username: user.username, state: "approved" }]) end def verify_release_import @@ -183,7 +199,7 @@ module QA # @param [QA::Resource::Issuable] issuable # @return [Array] def fetch_events_and_comments(issuable) - comments = issuable.comments.map { |comment| comment[:body] } + comments = issuable.comments.pluck(:body) events = [ *issuable.label_events.map { |e| { name: "#{e[:action]}_label", label: e.dig(:label, :name) } }, *issuable.state_events.map { |e| { name: e[:state] } }, diff --git a/qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb b/qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb index a2d66ffe8d3..fb530967073 100644 --- a/qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb +++ b/qa/qa/specs/features/api/1_manage/integrations/webhook_events_spec.rb @@ -8,10 +8,11 @@ module QA end after(:context) do - Vendor::Smocker::SmockerApi.teardown! + Service::DockerRun::Smocker.teardown! end let(:session) { SecureRandom.hex(5) } + let(:tag_name) { SecureRandom.hex(5) } it 'sends a push event', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348945' do setup_webhook(push: true) do |webhook, smocker| @@ -71,7 +72,7 @@ module QA end it 'sends an issues and note event', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349723' do + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349723' do setup_webhook(issues: true, note: true) do |webhook, smocker| issue = Resource::Issue.fabricate_via_api! do |issue_init| issue_init.project = webhook.project @@ -98,10 +99,36 @@ module QA end end + it 'sends a tag event', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/383577' do + setup_webhook(tag_push: true) do |webhook, smocker| + project_push = Resource::Repository::ProjectPush.fabricate! do |project_push| + project_push.project = webhook.project + end + + Resource::Tag.fabricate_via_api! do |tag| + tag.project = project_push.project + tag.ref = project_push.branch_name + tag.name = tag_name + end + + wait_until do + smocker.history(session).size == 1 + end + + events = smocker.history(session).map(&:as_hook_event) + aggregate_failures do + expect(events.size).to be(1), "Should have 1 event: \n#{events.map(&:raw).join("\n")}" + expect(events[0].project_name).to eql(webhook.project.name) + expect(events[0].tag?).to be(true), "Not tag event: \n#{events[0].raw}" + end + end + end + private def setup_webhook(**event_args) - Vendor::Smocker::SmockerApi.init(wait: 10) do |smocker| + Service::DockerRun::Smocker.init(wait: 10) do |smocker| smocker.register(session: session) webhook = Resource::ProjectWebHook.fabricate_via_api! do |hook| diff --git a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_issue_spec.rb b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_issue_spec.rb index dd2e7f06995..052e3d0e32d 100644 --- a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_issue_spec.rb +++ b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_issue_spec.rb @@ -52,6 +52,32 @@ module QA end end + context 'with associated merge request' do + let!(:source_mr) do + Resource::MergeRequest.fabricate_via_api! do |mr| + mr.project = source_project + mr.api_client = source_admin_api_client + mr.description = "Closes #{source_issue.web_url}" + end + end + + let(:imported_related_mrs) do + imported_issue.related_merge_requests.pluck(:iid) + end + + it( + 'preserves related merge request', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/386305', + quarantine: { + type: :bug, + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/386308' + } + ) do + expect_project_import_finished_successfully + expect(imported_related_mrs).to eq([source_mr.iid]) + end + end + # we can't fabricate things in source instance via UI context "with designs", quarantine: { type: :broken, diff --git a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_large_project_spec.rb b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_large_project_spec.rb index 5fc170435e3..9ce028318c3 100644 --- a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_large_project_spec.rb +++ b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_large_project_spec.rb @@ -15,7 +15,8 @@ module QA let!(:gitlab_source_project) { ENV["QA_LARGE_IMPORT_REPO"] || "migration-test-project" } let!(:import_wait_duration) { { max_duration: (ENV["QA_LARGE_IMPORT_DURATION"] || 3600).to_i, sleep_interval: 30 } } - let!(:source_admin_user) { "no-op" } + # test uses production as source which doesn't have actual admin user + let!(:source_admin_user) { nil } let!(:source_admin_api_client) do Runtime::API::Client.new( source_gitlab_address, @@ -227,8 +228,8 @@ module QA comment_diff = verify_comments(type, actual, expected) { - "missing_#{type}s": (expected.keys - actual.keys).map { |it| expected[it]&.slice(:title, :url) }.compact, - "extra_#{type}s": (actual.keys - expected.keys).map { |it| actual[it]&.slice(:title, :url) }.compact, + "missing_#{type}s": (expected.keys - actual.keys).filter_map { |it| expected[it]&.slice(:title, :url) }, + "extra_#{type}s": (actual.keys - expected.keys).filter_map { |it| actual[it]&.slice(:title, :url) }, "#{type}_comments": comment_diff } end diff --git a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_project_spec.rb b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_project_spec.rb index 83691cdf143..9f6b1d38bd7 100644 --- a/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_project_spec.rb +++ b/qa/qa/specs/features/api/1_manage/migration/gitlab_migration_project_spec.rb @@ -6,11 +6,7 @@ module QA include_context 'with gitlab project migration' # this spec is used as a sanity test for gitlab migration because it can run outside of orchestrated setup - context 'with import within same instance', orchestrated: false, import: false, quarantine: { - type: :test_environment, - issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/383605", - only: { job: "review-qa" } - } do + context 'with import within same instance', orchestrated: false, import: false do let!(:source_project_with_readme) { true } let!(:source_gitlab_address) { Runtime::Scenario.gitlab_address } let!(:source_admin_api_client) { admin_api_client } diff --git a/qa/qa/specs/features/api/1_manage/project_access_token_spec.rb b/qa/qa/specs/features/api/1_manage/project_access_token_spec.rb index e210ba882bb..d693bbd43ff 100644 --- a/qa/qa/specs/features/api/1_manage/project_access_token_spec.rb +++ b/qa/qa/specs/features/api/1_manage/project_access_token_spec.rb @@ -5,14 +5,16 @@ module QA describe 'Project access token', product_group: :authentication_and_authorization do before(:all) do @project_access_token = QA::Resource::ProjectAccessToken.fabricate_via_api! do |pat| - pat.project = Resource::ReusableProject.fabricate_via_api! + pat.project = Resource::Project.fabricate_via_api! do |project| + project.initialize_with_readme = true + end end @user_api_client = Runtime::API::Client.new(:gitlab, personal_access_token: @project_access_token.token) end context 'for the same project' do - it 'can be used to create a file via the project API', :reliable, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347858' do + it 'can be used to create a file via the project API', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347858' do expect do Resource::File.fabricate_via_api! do |file| file.api_client = @user_api_client @@ -44,7 +46,7 @@ module QA @different_project = Resource::Project.fabricate! end - it 'cannot be used to create a file via the project API', :reliable, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347860' do + it 'cannot be used to create a file via the project API', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347860' do expect do Resource::File.fabricate_via_api! do |file| file.api_client = @user_api_client @@ -57,7 +59,7 @@ module QA end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError, /403 Forbidden/) end - it 'cannot be used to commit via the API', :reliable, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347861' do + it 'cannot be used to commit via the API', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347861' do expect do Resource::Repository::Commit.fabricate_via_api! do |commit| commit.api_client = @user_api_client diff --git a/qa/qa/specs/features/api/1_manage/user_inherited_access_spec.rb b/qa/qa/specs/features/api/1_manage/user_inherited_access_spec.rb index 3df6e988bfa..ad1abe6e5e9 100644 --- a/qa/qa/specs/features/api/1_manage/user_inherited_access_spec.rb +++ b/qa/qa/specs/features/api/1_manage/user_inherited_access_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'User', :requires_admin, product_group: :workspace do + describe 'User', :requires_admin, product_group: :organization do let(:admin_api_client) { Runtime::API::Client.as_admin } let!(:sub_group) do diff --git a/qa/qa/specs/features/api/1_manage/users_spec.rb b/qa/qa/specs/features/api/1_manage/users_spec.rb index ff036c18671..08e1b7a1e0c 100644 --- a/qa/qa/specs/features/api/1_manage/users_spec.rb +++ b/qa/qa/specs/features/api/1_manage/users_spec.rb @@ -4,7 +4,7 @@ require 'airborne' module QA RSpec.describe 'Manage' do - describe 'Users API', :reliable, product_group: :workspace do + describe 'Users API', :reliable, product_group: :organization do let(:api_client) { Runtime::API::Client.new(:gitlab) } let(:request) { Runtime::API::Request.new(api_client, '/users') } 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 a1060c1d890..fc00d851087 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 @@ -10,8 +10,11 @@ module QA let(:branch) { "push-options-test-#{SecureRandom.hex(8)}" } let(:title) { "MR push options test #{SecureRandom.hex(8)}" } let(:commit_message) { 'Add README.md' } - - let(:project) { Resource::ReusableProject.fabricate_via_api! } + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.initialize_with_readme = true + end + end def create_new_mr_via_push Resource::Repository::ProjectPush.fabricate! do |push| 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 index 0a82c5d6736..9fed6787ade 100644 --- 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 @@ -18,7 +18,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = "runner-for-#{project.name}" runner.tags = ["runner-for-#{project.name}"] diff --git a/qa/qa/specs/features/api/4_verify/file_variable_spec.rb b/qa/qa/specs/features/api/4_verify/file_variable_spec.rb index 6d375341c1b..bd0ec13b1f8 100644 --- a/qa/qa/specs/features/api/4_verify/file_variable_spec.rb +++ b/qa/qa/specs/features/api/4_verify/file_variable_spec.rb @@ -1,10 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring, quarantine: { - issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/383324', - type: :stale - } do + RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring do describe 'Pipeline with project file variables' do let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(number: 8)}" } @@ -15,7 +12,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] @@ -31,19 +28,26 @@ module QA { file_path: '.gitlab-ci.yml', content: <<~YAML + default: + tags: [#{executor}] + variables: EXTRA_ARGS: "-f $TEST_FILE" DOCKER_REMOTE_ARGS: --tlscacert="$DOCKER_CA_CERT" EXTRACTED_CRT_FILE: ${DOCKER_CA_CERT}.crt MY_FILE_VAR: $TEST_FILE - test: - tags: [#{executor}] + job_echo: script: - echo "run something $EXTRA_ARGS" - echo "docker run $DOCKER_REMOTE_ARGS" - echo "run --output=$EXTRACTED_CRT_FILE" - echo "Will read private key from $MY_FILE_VAR" + + job_cat: + script: + - cat "$MY_FILE_VAR" + - cat "$DOCKER_CA_CERT" YAML } ] @@ -53,8 +57,8 @@ module QA let(:add_file_variables) do { - 'TEST_FILE' => 'hello, this is test', - 'DOCKER_CA_CERT' => 'This is secret' + 'TEST_FILE' => "hello, this is test\n", + 'DOCKER_CA_CERT' => "This is secret\n" }.each do |file_name, content| add_file_variable_to_project(file_name, content) end @@ -71,18 +75,37 @@ module QA runner.remove_via_api! end - it 'shows in job log accordingly', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/370791' do + it( + 'does not expose file variable content with echo', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/370791' + ) do + job = Resource::Job.fabricate_via_api! do |job| + job.project = project + job.id = project.job_by_name('job_echo')[:id] + end + + aggregate_failures do + trace = job.trace + expect(trace).to include('run something -f', "#{project.name}.tmp/TEST_FILE") + expect(trace).to include('docker run --tlscacert=', "#{project.name}.tmp/DOCKER_CA_CERT") + expect(trace).to include('run --output=', "#{project.name}.tmp/DOCKER_CA_CERT.crt") + expect(trace).to include('Will read private key from', "#{project.name}.tmp/TEST_FILE") + end + end + + it( + 'can read file variable content with cat', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/386409' + ) do job = Resource::Job.fabricate_via_api! do |job| job.project = project - job.id = project.job_by_name('test')[:id] + job.id = project.job_by_name('job_cat')[:id] end aggregate_failures do trace = job.trace - expect(trace).to have_content('run something -f hello, this is test') - expect(trace).to have_content('docker run --tlscacert="This is secret"') - expect(trace).to have_content('run --output=This is secret.crt') - expect(trace).to have_content('Will read private key from hello, this is test') + expect(trace).to have_content('hello, this is test') + expect(trace).to have_content('This is secret') end end diff --git a/qa/qa/specs/features/api/4_verify/remove_runner_spec.rb b/qa/qa/specs/features/api/4_verify/remove_runner_spec.rb deleted file mode 100644 index 7aaaa7137ed..00000000000 --- a/qa/qa/specs/features/api/4_verify/remove_runner_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -module QA - RSpec.describe 'Verify', :runner, product_group: :runner do - describe 'Runner removal' do - include Support::API - - let(:api_client) { Runtime::API::Client.new(:gitlab) } - let(:executor) { "qa-runner-#{Time.now.to_i}" } - let(:runner_tags) { ["runner-registration-e2e-test-#{Faker::Alphanumeric.alphanumeric(number: 8)}"] } - let!(:runner) do - Resource::Runner.fabricate! do |runner| - runner.name = executor - runner.tags = runner_tags - end - end - - # Removing a runner via the UI is covered by `spec/features/runners_spec.rb`` - it 'removes the runner', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/354828' do - runners_list = runner.runners_list - expect(runners_list.size).to eq(1) - expect(runners_list.first[:description]).to eq(executor) - - request = Runtime::API::Request.new(api_client, "runners/#{runner.id}") - response = delete(request.url) - expect(response.code).to eq(Support::API::HTTP_STATUS_NO_CONTENT) - expect(response.body).to be_empty - - expect(runner).to be_not_found_by_tags - end - end - end -end diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_group_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_group_spec.rb index 8fe4dc192bd..b2ccacfd142 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_group_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_group_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Subgroup transfer', product_group: :workspace do + describe 'Subgroup transfer', product_group: :organization do let(:source_group) do Resource::Group.fabricate_via_api! do |group| group.path = "source-group-for-transfer_#{SecureRandom.hex(8)}" diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb index d684eabe644..ef05f4cfecf 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_project_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Project transfer between groups', :reliable, product_group: :workspace do + describe 'Project transfer between groups', :reliable, product_group: :organization do let(:source_group) do Resource::Group.fabricate_via_api! do |group| group.path = "source-group-#{SecureRandom.hex(8)}" diff --git a/qa/qa/specs/features/browser_ui/1_manage/integrations/pipeline_status_emails_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/integrations/pipeline_status_emails_spec.rb index 4495d83f336..da49573b960 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/integrations/pipeline_status_emails_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/integrations/pipeline_status_emails_spec.rb @@ -36,7 +36,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb index 3f461e9247f..50e86b4d555 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Manage', :reliable, product_group: :workspace do + RSpec.describe 'Manage', :reliable, product_group: :organization do describe 'Add project member' do it 'user adds project member', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347887' do Flow::Login.sign_in diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_badge_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_badge_spec.rb index b251b3075dd..0a643d1e33b 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_badge_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_badge_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Create project badge', :reliable, product_group: :workspace do + describe 'Create project badge', :reliable, product_group: :organization do let(:badge_name) { "project-badge-#{SecureRandom.hex(8)}" } let(:expected_badge_link_url) { "#{Runtime::Scenario.gitlab_address}/#{project.path_with_namespace}" } let(:expected_badge_image_url) { "#{Runtime::Scenario.gitlab_address}/#{project.path_with_namespace}/badges/main/pipeline.svg" } 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 686cc8fe11e..c9e90cce84c 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Manage', :smoke, product_group: :workspace do + RSpec.describe 'Manage', :smoke, product_group: :organization do describe 'Project' do shared_examples 'successful project creation' do it 'creates a new project' do diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/dashboard_images_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/dashboard_images_spec.rb index 2abbb6ca73c..e609dfb9197 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/dashboard_images_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/dashboard_images_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Manage', product_group: :workspace do + RSpec.describe 'Manage', product_group: :organization do shared_examples 'loads all images' do |admin| let(:api_client) { Runtime::API::Client.as_admin } diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/invite_group_to_project_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/invite_group_to_project_spec.rb index 164f86bffce..4479f2ebfab 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/invite_group_to_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/invite_group_to_project_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Invite group', :reliable, product_group: :workspace do + describe 'Invite group', :reliable, product_group: :organization do shared_examples 'invites group to project' do it 'verifies group is added and members can access project with correct access level' do Page::Project::Menu.perform(&:click_members) diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/project_owner_permissions_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/project_owner_permissions_spec.rb index 98a08dd0d9a..59774ed7c49 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/project_owner_permissions_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/project_owner_permissions_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Project owner permissions', :reliable, product_group: :workspace do + describe 'Project owner permissions', :reliable, product_group: :organization do let!(:owner) do Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) end 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 33ca5f6009c..95305b7a4aa 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 @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'Project activity', :reliable, product_group: :workspace do + describe 'Project activity', :reliable, product_group: :organization do it 'user creates an event in the activity page upon Git push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347879' do Flow::Login.sign_in diff --git a/qa/qa/specs/features/browser_ui/1_manage/user/follow_user_activity_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/user/follow_user_activity_spec.rb index b9b82baa6f1..94b383a746d 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/user/follow_user_activity_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/user/follow_user_activity_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'User', :requires_admin, product_group: :workspace do + describe 'User', :requires_admin, product_group: :organization do let(:admin_api_client) { Runtime::API::Client.as_admin } let(:followed_user_api_client) { Runtime::API::Client.new(:gitlab, user: followed_user) } diff --git a/qa/qa/specs/features/browser_ui/1_manage/user/parent_group_access_termination_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/user/parent_group_access_termination_spec.rb index 6bc695487ee..7caa6677787 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/user/parent_group_access_termination_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/user/parent_group_access_termination_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'User', :requires_admin, :reliable, product_group: :workspace do + describe 'User', :requires_admin, :reliable, product_group: :organization do let(:admin_api_client) { Runtime::API::Client.as_admin } let!(:user) do @@ -34,6 +34,7 @@ module QA Page::Group::Menu.perform(&:click_subgroup_members_item) Page::Group::Members.perform do |members_page| + members_page.search_member(user.username) members_page.remove_member(user.username) end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/user/user_inherited_access_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/user/user_inherited_access_spec.rb index b7585f00630..9bb08cb66bc 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/user/user_inherited_access_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/user/user_inherited_access_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Manage' do - describe 'User', :requires_admin, product_group: :workspace do + describe 'User', :requires_admin, product_group: :organization do let(:admin_api_client) { Runtime::API::Client.as_admin } let!(:sub_group) do diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_when_pipeline_succeeds_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_when_pipeline_succeeds_spec.rb index 257021b158a..1b82543a5d4 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_when_pipeline_succeeds_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_when_pipeline_succeeds_spec.rb @@ -14,7 +14,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = runner_name runner.tags = [runner_name] diff --git a/qa/qa/specs/features/browser_ui/3_create/pages/new_static_page_spec.rb b/qa/qa/specs/features/browser_ui/3_create/pages/new_static_page_spec.rb index 449bffe61e0..a214af19fca 100644 --- a/qa/qa/specs/features/browser_ui/3_create/pages/new_static_page_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/pages/new_static_page_spec.rb @@ -9,7 +9,8 @@ module QA issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/383215', type: :test_environment, only: { subdomain: 'staging-ref' } - } do + }, + feature_flag: { name: 'show_pages_in_deployments_menu' } do # TODO: Convert back to :smoke once proved to be stable. Related issue: https://gitlab.com/gitlab-org/gitlab/-/issues/300906 describe 'Pages', product_group: :editor do let!(:project) do @@ -29,14 +30,21 @@ module QA end before do + # Pages Menu Experiment currently progress https://gitlab.com/gitlab-org/gitlab/-/merge_requests/98044 + # Update spec along with Feature Flag Removal. + Runtime::Feature.disable(:show_pages_in_deployments_menu) Flow::Login.sign_in - Resource::Runner.fabricate_via_api! do |runner| + Resource::ProjectRunner.fabricate_via_api! do |runner| runner.project = project runner.executor = :docker end pipeline.visit! end + after do + Runtime::Feature.enable(:show_pages_in_deployments_menu) + end + it 'creates a Pages website', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347669' do Page::Project::Pipeline::Show.perform do |show| diff --git a/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_page_deletion_spec.rb b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_page_deletion_spec.rb index 626f9a7d593..fef6b8ad65f 100644 --- a/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_page_deletion_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/project_wiki/project_based_page_deletion_spec.rb @@ -1,23 +1,23 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', product_group: :editor do - describe 'Testing project wiki' - let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } + RSpec.describe 'Create' do + describe 'Testing project wiki', product_group: :editor do + let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } - before do - Flow::Login.sign_in - end + before do + Flow::Login.sign_in + end - it 'can delete a page', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347815' do - initial_wiki.visit! + it 'can delete a page', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347815' do + initial_wiki.visit! - Page::Project::Wiki::Show.perform(&:click_edit) - Page::Project::Wiki::Edit.perform(&:delete_page) + Page::Project::Wiki::Show.perform(&:click_edit) + Page::Project::Wiki::Edit.perform(&:delete_page) - Page::Project::Wiki::Show.perform do |wiki| - expect(wiki).to have_no_page + Page::Project::Wiki::Show.perform do |wiki| + expect(wiki).to have_no_page + end end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb index b4103bd0976..7d21c635347 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb @@ -54,11 +54,10 @@ module QA Page::Project::Show.perform(&:create_new_file!) Page::File::Form.perform do |form| + form.add_custom_name(template[:file_name]) form.select_template template[:file_name], template[:name] expect(form).to have_normalized_ws_text(content[0..100]) - - form.add_name("#{SecureRandom.hex(8)}/#{template[:file_name]}") form.commit_changes aggregate_failures "indications of file created" do diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb index 93f804f1e39..6cbbfb9e7e5 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb @@ -1,7 +1,12 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :project }, product_group: :editor do + RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :global }, + product_group: :editor, + quarantine: { + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/387033', + type: :stale + } do describe 'Web IDE file templates' do include Runtime::Fixtures @@ -11,11 +16,11 @@ module QA project.description = 'Add file templates via the Web IDE' project.initialize_with_readme = true end - Runtime::Feature.disable(:vscode_web_ide, project: @project) + Runtime::Feature.disable(:vscode_web_ide) end after(:all) do - Runtime::Feature.enable(:vscode_web_ide, project: @project) + Runtime::Feature.enable(:vscode_web_ide) end templates = [ diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/add_new_directory_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/add_new_directory_in_web_ide_spec.rb index a001dee891a..ded1b1c9d7c 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/add_new_directory_in_web_ide_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/add_new_directory_in_web_ide_spec.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :project }, product_group: :editor do + RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :global }, product_group: :editor, quarantine: { + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/387029', + type: :stale + } do describe 'Add a directory in Web IDE' do let(:project) do Resource::Project.fabricate_via_api! do |project| @@ -11,13 +14,13 @@ module QA end before do - Runtime::Feature.disable(:vscode_web_ide, project: project) + Runtime::Feature.disable(:vscode_web_ide) Flow::Login.sign_in project.visit! end after do - Runtime::Feature.enable(:vscode_web_ide, project: project) + Runtime::Feature.enable(:vscode_web_ide) end context 'when a directory with the same name already exists' do 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 cb0da601a88..45499ea1999 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 @@ -1,7 +1,10 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :project }, product_group: :editor do + RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :global }, product_group: :editor, quarantine: { + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/387723', + type: :stale + } do describe 'First file using Web IDE' do let(:project) do Resource::Project.fabricate_via_api! do |project| @@ -13,12 +16,12 @@ module QA let(:file_name) { 'the very first file.txt' } before do - Runtime::Feature.disable(:vscode_web_ide, project: project) + Runtime::Feature.disable(:vscode_web_ide) Flow::Login.sign_in end after do - Runtime::Feature.enable(:vscode_web_ide, project: project) + Runtime::Feature.enable(:vscode_web_ide) end it "creates the first file in an empty project via Web IDE", testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347803' do diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/link_to_line_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/link_to_line_in_web_ide_spec.rb index 2007fe4a667..3ea87d90c2d 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/link_to_line_in_web_ide_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/link_to_line_in_web_ide_spec.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :project }, product_group: :editor do + RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :global }, product_group: :editor, quarantine: { + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/387035', + type: :stale + } do describe 'Link to line in Web IDE' do let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) } let(:project) do @@ -11,12 +14,12 @@ module QA end before do - Runtime::Feature.disable(:vscode_web_ide, project: project) + Runtime::Feature.disable(:vscode_web_ide) Flow::Login.sign_in end after do - Runtime::Feature.enable(:vscode_web_ide, project: project) + Runtime::Feature.enable(:vscode_web_ide) project.remove_via_api! 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 dc9f68c5c73..7195dd5c970 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :project }, product_group: :editor do + RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :global }, product_group: :editor do describe 'Open a fork in Web IDE', skip: { issue: "https://gitlab.com/gitlab-org/gitlab/-/issues/351696", @@ -15,11 +15,11 @@ module QA end before do - Runtime::Feature.disable(:vscode_web_ide, project: parent_project) + Runtime::Feature.disable(:vscode_web_ide) end after do - Runtime::Feature.enable(:vscode_web_ide, project: parent_project) + Runtime::Feature.enable(:vscode_web_ide) end context 'when a user does not have permissions to commit to the project' do diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_web_ide_from_diff_tab_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_web_ide_from_diff_tab_spec.rb index 039d25477bf..02d2710656d 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_web_ide_from_diff_tab_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_web_ide_from_diff_tab_spec.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :project }, product_group: :editor do + RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :global }, product_group: :editor, quarantine: { + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/387031', + type: :stale + } do describe 'Open Web IDE from Diff Tab' do files = [ { @@ -44,13 +47,13 @@ module QA end before do - Runtime::Feature.disable(:vscode_web_ide, project: project) + Runtime::Feature.disable(:vscode_web_ide) Flow::Login.sign_in merge_request.visit! end after do - Runtime::Feature.enable(:vscode_web_ide, project: project) + Runtime::Feature.enable(:vscode_web_ide) end it 'opens and edits a multi-file merge request in Web IDE from Diff Tab', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347724' do diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb index fe0060e9bbc..4c21581781d 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/review_merge_request_spec.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :project }, product_group: :editor do + RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :global }, product_group: :editor, quarantine: { + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/387043', + type: :stale + } do describe 'Review a merge request in Web IDE' do let(:new_file) { 'awesome_new_file.txt' } let(:original_text) { 'Text' } @@ -23,13 +26,13 @@ module QA end before do - Runtime::Feature.disable(:vscode_web_ide, project: project) + Runtime::Feature.disable(:vscode_web_ide) Flow::Login.sign_in merge_request.visit! end after do - Runtime::Feature.enable(:vscode_web_ide, project: project) + Runtime::Feature.enable(:vscode_web_ide) end it 'opens and edits a merge request in Web IDE', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347786' do diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/server_hooks_custom_error_message_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/server_hooks_custom_error_message_spec.rb index 3cd14ecd799..8c171e6bc8c 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/server_hooks_custom_error_message_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/server_hooks_custom_error_message_spec.rb @@ -2,8 +2,12 @@ module QA RSpec.describe 'Create', :skip_live_env, except: { job: 'review-qa-*' }, - feature_flag: { name: 'vscode_web_ide', scope: :project }, - product_group: :editor do + feature_flag: { name: 'vscode_web_ide', scope: :global }, + product_group: :editor, + quarantine: { + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/387928', + type: :stale + } do describe 'Git Server Hooks' do let(:file_path) { File.absolute_path(File.join('qa', 'fixtures', 'web_ide', 'README.md')) } @@ -16,13 +20,13 @@ module QA end before do - Runtime::Feature.disable(:vscode_web_ide, project: project) + Runtime::Feature.disable(:vscode_web_ide) Flow::Login.sign_in project.visit! end after do - Runtime::Feature.enable(:vscode_web_ide, project: project) + Runtime::Feature.enable(:vscode_web_ide) end context 'Custom error messages' do diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/upload_new_file_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/upload_new_file_in_web_ide_spec.rb index c6e283f67e0..781623d10f6 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/upload_new_file_in_web_ide_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/upload_new_file_in_web_ide_spec.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :project }, product_group: :editor do + RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :global }, product_group: :editor, quarantine: { + issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/387032', + type: :stale + } do describe 'Upload a file in Web IDE' do let(:file_path) { File.absolute_path(File.join('qa', 'fixtures', 'web_ide', file_name)) } @@ -13,7 +16,7 @@ module QA end before do - Runtime::Feature.disable(:vscode_web_ide, project: project) + Runtime::Feature.disable(:vscode_web_ide) Flow::Login.sign_in project.visit! @@ -21,7 +24,7 @@ module QA end after do - Runtime::Feature.enable(:vscode_web_ide, project: project) + Runtime::Feature.enable(:vscode_web_ide) end context 'when a file with the same name already exists' do diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/web_terminal_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/web_terminal_spec.rb index 695b295bd86..599c34ed3db 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/web_terminal_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/web_terminal_spec.rb @@ -10,12 +10,12 @@ module QA issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/338179', type: :bug }, - feature_flag: { name: 'vscode_web_ide', scope: :project }, + feature_flag: { name: 'vscode_web_ide', scope: :global }, product_group: :editor ) do describe 'Web IDE web terminal' do before do - Runtime::Feature.disable(:vscode_web_ide, project: project) + Runtime::Feature.disable(:vscode_web_ide) project = Resource::Project.fabricate_via_api! do |project| project.name = 'web-terminal-project' end @@ -37,7 +37,7 @@ module QA ) end - @runner = Resource::Runner.fabricate_via_api! do |runner| + @runner = Resource::ProjectRunner.fabricate_via_api! do |runner| runner.project = project runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = %w[web-ide] @@ -58,7 +58,7 @@ module QA end after do - Runtime::Feature.enable(:vscode_web_ide, project: project) + Runtime::Feature.enable(:vscode_web_ide) @runner.remove_via_api! if @runner end diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide_new/add_new_directory_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide_new/add_new_directory_in_web_ide_spec.rb new file mode 100644 index 00000000000..7b40c8a62c1 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide_new/add_new_directory_in_web_ide_spec.rb @@ -0,0 +1,73 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create', feature_flag: { name: 'vscode_web_ide', scope: :global }, product_group: :editor do + describe 'Add a directory in Web IDE' do + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'add-directory-project' + project.initialize_with_readme = true + end + end + + before do + Runtime::Feature.enable(:vscode_web_ide) + Flow::Login.sign_in + project.visit! + end + + after do + Runtime::Feature.disable(:vscode_web_ide) + end + + context 'when a directory with the same name already exists' do + let(:directory_name) { 'first_directory' } + + before do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.add_files( + [ + { + file_path: 'first_directory/test_file.txt', + content: "Test file content" + } + ]) + end + project.visit! + end + + it 'throws an error', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/386760' do + Page::Project::Show.perform(&:open_web_ide!) + Page::Project::WebIDE::VSCode.perform do |ide| + ide.wait_for_ide_to_load + ide.create_new_folder(directory_name) + ide.within_vscode_editor do + expect(page).to have_content('A file or folder first_directory already exists at this location.') + end + end + end + end + + context 'when user adds a new empty directory' do + let(:directory_name) { 'new_empty_directory' } + + before do + Page::Project::Show.perform(&:open_web_ide!) + end + + it 'shows successfully but not able to be committed', +testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/386761' do + Page::Project::WebIDE::VSCode.perform do |ide| + ide.wait_for_ide_to_load + ide.create_new_folder(directory_name) + ide.commit_and_push(directory_name) + ide.within_vscode_editor do + expect(page).to have_content('No changes found. Not able to commit.') + end + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb index 5dda8b04805..2ae28d54242 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb @@ -14,7 +14,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb index 48d6ed8dc49..a8ec0a1c835 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb @@ -14,7 +14,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/raw_variables_defined_in_yaml_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/raw_variables_defined_in_yaml_spec.rb index a4849d47183..81ccd36c514 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/raw_variables_defined_in_yaml_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/raw_variables_defined_in_yaml_spec.rb @@ -2,10 +2,7 @@ module QA RSpec.describe 'Verify', :runner do - describe 'Pipeline with raw variables in YAML', product_group: :pipeline_authoring, feature_flag: { - name: 'ci_raw_variables_in_yaml_config', - scope: :project - } do + describe 'Pipeline with raw variables in YAML', product_group: :pipeline_authoring do let(:executor) { "qa-runner-#{Time.now.to_i}" } let(:pipeline_job_name) { 'rspec' } @@ -16,14 +13,14 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] end end - let(:commit_ci_file) do + let!(:commit_ci_file) do Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = project commit.commit_message = 'Add .gitlab-ci.yml' @@ -76,10 +73,7 @@ module QA let(:pipeline_id) { project.pipelines.first[:id] } let(:job_id) { project.job_by_name(pipeline_job_name)[:id] } - def before_do - # TODO: Switch to use `let!` and remove this line when removing FF - commit_ci_file - + before do Flow::Login.sign_in project.visit! Flow::Pipeline.visit_latest_pipeline(status: 'passed') @@ -92,55 +86,20 @@ module QA runner&.remove_via_api! end - context 'when FF is on', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/381487' do - before do - Runtime::Feature.enable(:ci_raw_variables_in_yaml_config, project: project) - sleep 60 - - before_do - end - - it 'expands variables according to expand: true/false', :aggregate_failures do - Page::Project::Job::Show.perform do |show| - expect(show.output).to have_content("VAR1 is JOBID-#{job_id}") - expect(show.output).to have_content("VAR2 is PIPELINEID-#{pipeline_id} and JOBID-#{job_id}") - expect(show.output).to have_content("VAR3 is PIPELINEID-$CI_PIPELINE_ID and $VAR1") - expect(show.output).to have_content("VAR4 is JOBID-$CI_JOB_ID") - expect(show.output).to have_content("VAR5 is PIPELINEID-#{pipeline_id} and JOBID-$CI_JOB_ID") - expect(show.output).to have_content("VAR6 is PIPELINEID-$CI_PIPELINE_ID and $VAR4") - expect(show.output).to have_content("VAR7 is overridden value 7 #{pipeline_id}") - expect(show.output).to have_content("VAR8 is value 8 $CI_PIPELINE_ID") - end - end - end - - # TODO: Remove this context when FF :ci_raw_variables_in_yaml_config is removed - # Also archive testcase and close related issue - context 'when FF is off', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/381486', - quarantine: { - issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/381806', - only: { pipeline: %w[staging staging-canary staging-ref] }, - type: :waiting_on - } do - before do - Runtime::Feature.disable(:ci_raw_variables_in_yaml_config, project: project) - sleep 60 - - before_do - end - - it 'expands all variables', :aggregate_failures do - Page::Project::Job::Show.perform do |show| - expect(show.output).to have_content("VAR1 is JOBID-#{job_id}") - expect(show.output).to have_content("VAR2 is PIPELINEID-#{pipeline_id} and JOBID-#{job_id}") - expect(show.output).to have_content("VAR3 is PIPELINEID-#{pipeline_id} and JOBID-#{job_id}") - expect(show.output).to have_content("VAR4 is JOBID-#{job_id}") - expect(show.output).to have_content("VAR5 is PIPELINEID-#{pipeline_id} and JOBID-#{job_id}") - expect(show.output).to have_content("VAR6 is PIPELINEID-#{pipeline_id} and JOBID-#{job_id}") - expect(show.output).to have_content("VAR7 is overridden value 7 #{pipeline_id}") - expect(show.output).to have_content("VAR8 is value 8 #{pipeline_id}") - end + it( + 'expands variables according to expand: true/false', + :aggregate_failures, + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/381487' + ) do + Page::Project::Job::Show.perform do |show| + expect(show.output).to have_content("VAR1 is JOBID-#{job_id}") + expect(show.output).to have_content("VAR2 is PIPELINEID-#{pipeline_id} and JOBID-#{job_id}") + expect(show.output).to have_content("VAR3 is PIPELINEID-$CI_PIPELINE_ID and $VAR1") + expect(show.output).to have_content("VAR4 is JOBID-$CI_JOB_ID") + expect(show.output).to have_content("VAR5 is PIPELINEID-#{pipeline_id} and JOBID-$CI_JOB_ID") + expect(show.output).to have_content("VAR6 is PIPELINEID-$CI_PIPELINE_ID and $VAR4") + expect(show.output).to have_content("VAR7 is overridden value 7 #{pipeline_id}") + expect(show.output).to have_content("VAR8 is value 8 $CI_PIPELINE_ID") 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 b6270c11ef6..0aedbd307bf 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,10 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Verify', :smoke, :runner, product_group: :pipeline_execution, quarantine: { - issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/356295', - type: :investigating - } do + RSpec.describe 'Verify', :runner, product_group: :pipeline_execution do describe 'Pipeline creation and processing' do let(:executor) { "qa-runner-#{Time.now.to_i}" } @@ -15,7 +12,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] 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 d773d0f36d0..5bbe09b3fb0 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 @@ -20,7 +20,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/locked_artifacts_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/locked_artifacts_spec.rb index ba1363d79c5..588d22275df 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/locked_artifacts_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/locked_artifacts_spec.rb @@ -15,7 +15,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb index 34f548a0e69..ddd91f97515 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/merge_mr_when_pipline_is_blocked_spec.rb @@ -12,7 +12,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/mr_event_rule_pipeline_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/mr_event_rule_pipeline_spec.rb index 448da6d9d87..5dff2db6f2b 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/mr_event_rule_pipeline_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/mr_event_rule_pipeline_spec.rb @@ -14,7 +14,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/parent_child_pipelines_independent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/parent_child_pipelines_independent_relationship_spec.rb index a7ca7b82d1e..fef90a7c8fc 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/parent_child_pipelines_independent_relationship_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/parent_child_pipelines_independent_relationship_spec.rb @@ -10,7 +10,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate_via_api! do |runner| + Resource::ProjectRunner.fabricate_via_api! do |runner| runner.project = project runner.name = project.name runner.tags = [project.name] 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 fca34fc1f8e..7d1339d2c2d 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 @@ -22,10 +22,10 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::GroupRunner.fabricate! do |runner| runner.name = executor runner.tags = [executor] - runner.token = group.reload!.runners_token + runner.group = group end end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_with_image_pull_policy_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_with_image_pull_policy_spec.rb index d30d5b43568..aaaa11ef867 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_with_image_pull_policy_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_with_image_pull_policy_spec.rb @@ -13,7 +13,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = runner_name runner.tags = [runner_name] diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_with_manual_jobs_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_with_manual_jobs_spec.rb index 4223caaafef..4294235a8b1 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_with_manual_jobs_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_with_manual_jobs_spec.rb @@ -13,7 +13,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] 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 c1d996df925..3361ab98bda 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 @@ -12,7 +12,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_matrix_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_matrix_spec.rb index 83283c5d8e3..bd656142989 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_matrix_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/trigger_matrix_spec.rb @@ -12,7 +12,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/update_ci_file_with_pipeline_editor_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/update_ci_file_with_pipeline_editor_spec.rb index 1f49c7a3663..a749da4608a 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/update_ci_file_with_pipeline_editor_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/update_ci_file_with_pipeline_editor_spec.rb @@ -12,7 +12,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate_via_api! do |runner| + Resource::ProjectRunner.fabricate_via_api! do |runner| runner.project = project runner.name = random_test_string runner.tags = [random_test_string] 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 24c49be13bb..e141bac5e3f 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 @@ -5,7 +5,7 @@ module QA describe 'Runner registration' do let(:executor) { "qa-runner-#{Time.now.to_i}" } let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.name = executor runner.tags = ['e2e-test'] end diff --git a/qa/qa/specs/features/browser_ui/4_verify/testing/endpoint_coverage_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/testing/endpoint_coverage_spec.rb index 0166c53ffd5..d4fee70fbf3 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/testing/endpoint_coverage_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/testing/endpoint_coverage_spec.rb @@ -18,7 +18,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate_via_api! do |runner| + Resource::ProjectRunner.fabricate_via_api! do |runner| runner.project = project runner.name = project.name runner.tags = [project.name] 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 2a4852a2b8b..b45ccfa5433 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 @@ -5,7 +5,7 @@ module QA describe 'Code coverage statistics' do let(:executor) { "qa-runner-#{Time.now.to_i}" } let(:runner) do - Resource::Runner.fabricate_via_api! do |runner| + Resource::ProjectRunner.fabricate_via_api! do |runner| runner.name = executor runner.tags = ['e2e-test'] end diff --git a/qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_omnibus_spec.rb b/qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_omnibus_spec.rb index c57a5c27dd2..800324afc58 100644 --- a/qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_omnibus_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_omnibus_spec.rb @@ -28,7 +28,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{project.name}"] runner.executor = :docker diff --git a/qa/qa/specs/features/browser_ui/5_package/dependency_proxy/dependency_proxy_spec.rb b/qa/qa/specs/features/browser_ui/5_package/dependency_proxy/dependency_proxy_spec.rb index 978867d5cf1..a0d283fd7ad 100644 --- a/qa/qa/specs/features/browser_ui/5_package/dependency_proxy/dependency_proxy_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/dependency_proxy/dependency_proxy_spec.rb @@ -14,7 +14,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{project.name}"] runner.executor = :docker diff --git a/qa/qa/specs/features/browser_ui/5_package/infrastructure_registry/terraform_module_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/infrastructure_registry/terraform_module_registry_spec.rb index a80e154a969..fe320f10416 100644 --- a/qa/qa/specs/features/browser_ui/5_package/infrastructure_registry/terraform_module_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/infrastructure_registry/terraform_module_registry_spec.rb @@ -16,12 +16,11 @@ module QA end let(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{imported_project.name}"] runner.executor = :docker runner.project = imported_project - runner.token = group.reload!.runners_token end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/composer_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/composer_registry_spec.rb index ab4fb21f19a..0dce0022b38 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/composer_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/composer_registry_spec.rb @@ -20,7 +20,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{project.name}"] runner.executor = :docker diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/conan_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/conan_repository_spec.rb index 687d9f710fb..39c2121331d 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/conan_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/conan_repository_spec.rb @@ -24,7 +24,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{project.name}"] runner.executor = :docker diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/generic_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/generic_repository_spec.rb index 820571593a6..d6fb52cfea9 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/generic_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/generic_repository_spec.rb @@ -20,7 +20,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{project.name}"] runner.executor = :docker diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_project_level_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_project_level_spec.rb index 46c165ed806..c69b672a2ec 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_project_level_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven/maven_project_level_spec.rb @@ -33,7 +33,7 @@ module QA end let(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{package_project.name}"] runner.executor = :docker @@ -173,11 +173,11 @@ module QA end let(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::GroupRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{imported_project.name}"] runner.executor = :docker - runner.token = group.reload!.runners_token + runner.group = group end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_instance_level_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_instance_level_spec.rb index e209fc55e35..92dee63e37a 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_instance_level_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_instance_level_spec.rb @@ -45,11 +45,11 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::GroupRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{project.group.name}"] runner.executor = :docker - runner.token = project.group.reload!.runners_token + runner.group = project.group end end diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_project_level_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_project_level_spec.rb index d1aaa05c85a..29cdd5b9362 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_project_level_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/npm/npm_project_level_spec.rb @@ -39,7 +39,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{project.name}"] runner.executor = :docker diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb index d44bc8fa2ad..0e1ac4d861d 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_group_level_spec.rb @@ -51,11 +51,11 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::GroupRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{project.group.name}"] runner.executor = :docker - runner.token = project.group.reload!.runners_token + runner.group = project.group end end @@ -137,7 +137,7 @@ module QA <PropertyGroup> <OutputType>Exe</OutputType> - <TargetFramework>net5.0</TargetFramework> + <TargetFramework>net7.0</TargetFramework> </PropertyGroup> </Project> diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_project_level_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_project_level_spec.rb index 442deb1eb4e..038decddd96 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_project_level_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget/nuget_project_level_spec.rb @@ -36,7 +36,7 @@ product_group: :package_registry do end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{project.name}"] runner.executor = :docker diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/pypi_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/pypi_repository_spec.rb index fddb7fb6ebc..12e9d3e995f 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/pypi_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/pypi_repository_spec.rb @@ -21,7 +21,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{project.name}"] runner.executor = :docker diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/rubygems_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/rubygems_registry_spec.rb index 284130fa92b..b80eb3a688e 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/rubygems_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/rubygems_registry_spec.rb @@ -21,7 +21,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{project.name}"] runner.executor = :docker 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 3f91d120fdd..a504b694308 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 @@ -15,7 +15,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate_via_api! do |resource| + Resource::ProjectRunner.fabricate_via_api! do |resource| resource.project = project resource.name = runner_name resource.tags = [runner_name] 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 d6446c9725d..1e7d0eab365 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 @@ -2,7 +2,6 @@ module QA RSpec.describe 'Configure', - quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/381454', type: :flaky }, only: { subdomain: %i[staging staging-canary] }, product_group: :configure do describe 'Auto DevOps with a Kubernetes Agent' do let!(:app_project) do diff --git a/qa/qa/specs/features/browser_ui/8_monitor/alert_management/alert_settings_create_new_alerts_spec.rb b/qa/qa/specs/features/browser_ui/8_monitor/alert_management/alert_settings_create_new_alerts_spec.rb new file mode 100644 index 00000000000..2b7dd8fb673 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/8_monitor/alert_management/alert_settings_create_new_alerts_spec.rb @@ -0,0 +1,83 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Monitor', product_group: :respond do + describe 'Alert settings' do + shared_examples 'sends test alert' do + it 'creates new alert' do + Page::Project::Menu.perform(&:go_to_monitor_alerts) + Page::Project::Monitor::Alerts::Index.perform do |index| + expect(index).to have_alert_with_title(alert_title) + end + end + end + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'project-for-alerts' + project.description = 'Project for alerts' + end + end + + let(:alert_title) { Faker::Lorem.word } + + before do + Flow::Login.sign_in + project.visit! + end + + context( + 'when using HTTP endpoint integration', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/382803' + ) do + let(:payload) do + { title: alert_title, description: alert_title } + end + + before do + Flow::AlertSettings.setup_http_endpoint(payload: payload) + end + + it_behaves_like 'sends test alert' + end + + context( + 'when using Prometheus integration', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/385792' + ) do + let(:payload) do + { + version: '4', + groupKey: nil, + status: 'firing', + receiver: '', + groupLabels: {}, + commonLabels: {}, + commonAnnotations: {}, + externalURL: '', + alerts: [ + { + startsAt: Time.now, + generatorURL: Faker::Internet.url, + endsAt: nil, + status: 'firing', + labels: { gitlab_environment_name: Faker::Lorem.word }, + annotations: + { + title: alert_title, + gitlab_y_label: 'status' + } + } + ] + } + end + + before do + Flow::AlertSettings.setup_prometheus(payload: payload) + end + + it_behaves_like 'sends test alert' + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/8_monitor/alert_management/create_alert_using_authorization_key_spec.rb b/qa/qa/specs/features/browser_ui/8_monitor/alert_management/create_alert_using_authorization_key_spec.rb new file mode 100644 index 00000000000..9d4aff59e48 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/8_monitor/alert_management/create_alert_using_authorization_key_spec.rb @@ -0,0 +1,98 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Monitor', product_group: :respond do + describe 'Alert settings' do + shared_examples 'sends test alert using authorization key' do |type| + it 'creates new alert', :aggregate_failures do + response = RestClient.post( + credentials[:url], + payload.to_json, + { 'Content-Type': 'application/json', Authorization: "Bearer #{credentials[:auth_key]}" } + ) + + # With HTTP type, a successful request returns 200 and a JSON with the alert's title + # With Prometheus type, a successful request returns 201 + if type == 'http' + expect(response.code).to eq 200 + expect(JSON.parse(response).first['title']).to eq alert_title + else + expect(response.code).to eq 201 + end + + Page::Project::Menu.perform(&:go_to_monitor_alerts) + Page::Project::Monitor::Alerts::Index.perform do |index| + expect(index).to have_alert_with_title(alert_title) + end + end + end + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'project-for-alerts' + project.description = 'Project for alerts' + end + end + + let(:alert_title) { Faker::Lorem.word } + + before do + Flow::Login.sign_in + project.visit! + end + + context( + 'when using HTTP endpoint integration', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/386734' + ) do + let(:payload) do + { title: alert_title, description: alert_title } + end + + let(:credentials) do + Flow::AlertSettings.setup_http_endpoint(send: false) + end + + it_behaves_like 'sends test alert using authorization key', 'http' + end + + context( + 'when using Prometheus integration', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/386735' + ) do + let(:payload) do + { + version: '4', + groupKey: nil, + status: 'firing', + receiver: '', + groupLabels: {}, + commonLabels: {}, + commonAnnotations: {}, + externalURL: '', + alerts: [ + { + startsAt: Time.now, + generatorURL: Faker::Internet.url, + endsAt: nil, + status: 'firing', + labels: { gitlab_environment_name: Faker::Lorem.word }, + annotations: + { + title: alert_title, + gitlab_y_label: 'status' + } + } + ] + } + end + + let(:credentials) do + Flow::AlertSettings.setup_prometheus(send: false) + end + + it_behaves_like 'sends test alert using authorization key' + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/8_monitor/incident_management/http_endpoint_integration_creates_alert_spec.rb b/qa/qa/specs/features/browser_ui/8_monitor/incident_management/http_endpoint_integration_creates_alert_spec.rb deleted file mode 100644 index 8ea728ca94c..00000000000 --- a/qa/qa/specs/features/browser_ui/8_monitor/incident_management/http_endpoint_integration_creates_alert_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -module QA - RSpec.describe 'Monitor', product_group: :respond do - describe 'Http endpoint integration' do - let(:project) do - Resource::Project.fabricate_via_api! do |project| - project.name = 'project-for-alerts' - project.description = 'Project for alerts' - end - end - - let(:random_word) { Faker::Lorem.word } - - let(:payload) do - { title: random_word, description: random_word } - end - - before do - Flow::Login.sign_in - project.visit! - Flow::AlertSettings.setup_http_endpoint_and_send_alert(payload: payload) - end - - it( - 'can send test alert that creates new alert', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/382803' - ) do - Page::Project::Menu.perform(&:go_to_monitor_alerts) - Page::Project::Monitor::Alerts::Index.perform do |alerts| - expect(alerts).to have_alert_with_title(random_word) - end - end - end - end -end diff --git a/qa/qa/specs/features/sanity/feature_flags_spec.rb b/qa/qa/specs/features/sanity/feature_flags_spec.rb index acb9528fe6a..36069558701 100644 --- a/qa/qa/specs/features/sanity/feature_flags_spec.rb +++ b/qa/qa/specs/features/sanity/feature_flags_spec.rb @@ -1,86 +1,88 @@ # frozen_string_literal: true module QA - RSpec.describe 'Feature flag handler sanity checks', :sanity_feature_flags do - context 'with an existing feature flag definition file' do - let(:definition) do - path = Pathname.new('../config/feature_flags') - .expand_path(Runtime::Path.qa_root) - .glob('**/*.yml') - .first - YAML.safe_load(File.read(path)) - end + RSpec.describe 'Framework sanity', :sanity_feature_flags do + describe 'Feature flag handler checks' do + context 'with an existing feature flag definition file' do + let(:definition) do + path = Pathname.new('../config/feature_flags') + .expand_path(Runtime::Path.qa_root) + .glob('**/*.yml') + .first + YAML.safe_load(File.read(path)) + end - it 'reads the correct default enabled state' do - # This test will fail if we ever remove all the feature flags, but that's very unlikely given how many there - # are and how much we rely on them. - expect(QA::Runtime::Feature.enabled?(definition['name'])).to be definition['default_enabled'] + it 'reads the correct default enabled state' do + # This test will fail if we ever remove all the feature flags, but that's very unlikely given how many there + # are and how much we rely on them. + expect(QA::Runtime::Feature.enabled?(definition['name'])).to be definition['default_enabled'] + end end - end - describe 'feature flag definition files' do - let(:file) do - path = Pathname.new("#{root}/config/feature_flags/development").expand_path(Runtime::Path.qa_root) - path.mkpath - Tempfile.new(%w[ff-test .yml], path) - end + describe 'feature flag definition files' do + let(:file) do + path = Pathname.new("#{root}/config/feature_flags/development").expand_path(Runtime::Path.qa_root) + path.mkpath + Tempfile.new(%w[ff-test .yml], path) + end - let(:flag) { Pathname.new(file.path).basename('.yml').to_s } - let(:root) { '..' } + let(:flag) { Pathname.new(file.path).basename('.yml').to_s } + let(:root) { '..' } - before do - definition = <<~YAML + before do + definition = <<~YAML name: #{flag} type: development default_enabled: #{flag_enabled} - YAML - File.write(file, definition) - end + YAML + File.write(file, definition) + end - after do - file.close! - end + after do + file.close! + end - shared_examples 'gets flag value' do - context 'with a default disabled feature flag' do - let(:flag_enabled) { 'false' } + shared_examples 'gets flag value' do + context 'with a default disabled feature flag' do + let(:flag_enabled) { 'false' } - it 'reads the flag as disabled' do - expect(QA::Runtime::Feature.enabled?(flag)).to be false - end + it 'reads the flag as disabled' do + expect(QA::Runtime::Feature.enabled?(flag)).to be false + end - it 'reads as enabled after the flag is enabled' do - QA::Runtime::Feature.enable(flag) + it 'reads as enabled after the flag is enabled' do + QA::Runtime::Feature.enable(flag) - expect { QA::Runtime::Feature.enabled?(flag) }.to eventually_be_truthy - .within(max_duration: 60, sleep_interval: 5) + expect { QA::Runtime::Feature.enabled?(flag) }.to eventually_be_truthy + .within(max_duration: 60, sleep_interval: 5) + end end - end - context 'with a default enabled feature flag' do - let(:flag_enabled) { 'true' } + context 'with a default enabled feature flag' do + let(:flag_enabled) { 'true' } - it 'reads the flag as enabled' do - expect(QA::Runtime::Feature.enabled?(flag)).to be true - end + it 'reads the flag as enabled' do + expect(QA::Runtime::Feature.enabled?(flag)).to be true + end - it 'reads as disabled after the flag is disabled' do - QA::Runtime::Feature.disable(flag) + it 'reads as disabled after the flag is disabled' do + QA::Runtime::Feature.disable(flag) - expect { QA::Runtime::Feature.enabled?(flag) }.to eventually_be_falsey - .within(max_duration: 60, sleep_interval: 5) + expect { QA::Runtime::Feature.enabled?(flag) }.to eventually_be_falsey + .within(max_duration: 60, sleep_interval: 5) + end end end - end - context 'with a CE feature flag' do - include_examples 'gets flag value' - end + context 'with a CE feature flag' do + include_examples 'gets flag value' + end - context 'with an EE feature flag' do - let(:root) { '../ee' } + context 'with an EE feature flag' do + let(:root) { '../ee' } - include_examples 'gets flag value' + include_examples 'gets flag value' + end end end end diff --git a/qa/qa/specs/features/sanity/framework_spec.rb b/qa/qa/specs/features/sanity/framework_spec.rb index fa34f525a85..5c80afe338e 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 - RSpec.describe 'Framework sanity checks', :orchestrated, :framework do + RSpec.describe 'Framework sanity', :orchestrated, :framework do describe 'Passing orchestrated example' do it 'succeeds' do Runtime::Browser.visit(:gitlab, Page::Main::Login) diff --git a/qa/qa/specs/features/sanity/interception_spec.rb b/qa/qa/specs/features/sanity/interception_spec.rb index f8930db3aa5..67be832055d 100644 --- a/qa/qa/specs/features/sanity/interception_spec.rb +++ b/qa/qa/specs/features/sanity/interception_spec.rb @@ -1,39 +1,41 @@ # frozen_string_literal: true module QA - RSpec.describe 'Browser request interception', :orchestrated, :framework do - before(:context) do - skip 'Only can test for chrome' unless QA::Runtime::Env.can_intercept? - end + RSpec.describe 'Framework sanity', :orchestrated, :framework do + describe 'Browser request interception' do + before(:context) do + skip 'Only can test for chrome' unless QA::Runtime::Env.can_intercept? + end - before do - Runtime::Browser.visit(:gitlab, Page::Main::Login) - end + before do + Runtime::Browser.visit(:gitlab, Page::Main::Login) + end - let(:page) { Capybara.current_session } - let(:logger) { class_double('QA::Runtime::Logger') } + let(:page) { Capybara.current_session } + let(:logger) { class_double('QA::Runtime::Logger') } - it 'intercepts failed graphql calls' do - page.execute_script <<~JS + it 'intercepts failed graphql calls' do + page.execute_script <<~JS fetch('/api/graphql', { method: 'POST', body: JSON.stringify({ query: 'query {}'}), headers: { 'Content-Type': 'application/json' } }) - JS + JS - Support::Waiter.wait_until do - !get_cached_error.nil? + Support::Waiter.wait_until do + !get_cached_error.nil? + end + expect(**get_cached_error).to include({ 'method' => 'POST', 'status' => 200, 'url' => '/api/graphql' }) end - expect(**get_cached_error).to include({ 'method' => 'POST', 'status' => 200, 'url' => '/api/graphql' }) - end - def get_cached_error - cache = page.execute_script <<~JS + def get_cached_error + cache = page.execute_script <<~JS return Interceptor.getCache() - JS + JS - cache['errors']&.first + cache['errors']&.first + end end end end diff --git a/qa/qa/specs/features/sanity/version_spec.rb b/qa/qa/specs/features/sanity/version_spec.rb index e93a8a6fea1..deefe830c36 100644 --- a/qa/qa/specs/features/sanity/version_spec.rb +++ b/qa/qa/specs/features/sanity/version_spec.rb @@ -7,31 +7,33 @@ 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, only: { pipeline: [:pre, :release] } do - let(:api_client) { Runtime::API::Client.new(:gitlab) } - let(:request) { Runtime::API::Request.new(api_client, '/version') } + RSpec.describe 'Framework sanity', :smoke, only: { pipeline: [:pre, :release] } do + describe 'Version check' do + let(:api_client) { Runtime::API::Client.new(:gitlab) } + let(:request) { Runtime::API::Request.new(api_client, '/version') } - it 'is the specified version' do - # The `DEPLOY_VERSION` variable will only be provided for deploys to the - # `pre` and `release` environments, which only receive packaged releases. - # - # For these releases, `deploy_version` will be a package string (e.g., - # `13.1.3-ee.0`), and the reported version will be something like - # `13.1.3-ee`, so we only compare the leading SemVer string. - # - # | Package | Version | - # | ---------------- | -------------- | - # | 13.3.5-ee.0 | 13.3.5-ee | - # | 13.3.0-rc42.ee.0 | 13.3.0-rc42-ee | - deploy = Runtime::Env.deploy_version&.gsub(/\A(\d+\.\d+\.\d+).*\z/, '\1') + it 'is the specified version' do + # The `DEPLOY_VERSION` variable will only be provided for deploys to the + # `pre` and `release` environments, which only receive packaged releases. + # + # For these releases, `deploy_version` will be a package string (e.g., + # `13.1.3-ee.0`), and the reported version will be something like + # `13.1.3-ee`, so we only compare the leading SemVer string. + # + # | Package | Version | + # | ---------------- | -------------- | + # | 13.3.5-ee.0 | 13.3.5-ee | + # | 13.3.0-rc42.ee.0 | 13.3.0-rc42-ee | + deploy = Runtime::Env.deploy_version&.gsub(/\A(\d+\.\d+\.\d+).*\z/, '\1') - skip('No deploy version provided') if deploy.nil? || deploy.empty? + skip('No deploy version provided') if deploy.nil? || deploy.empty? - get request.url + get request.url - expect_status(200) - expect(json_body).to have_key(:version) - expect(json_body[:version]).to start_with(deploy) + expect_status(200) + expect(json_body).to have_key(:version) + expect(json_body[:version]).to start_with(deploy) + end end end end diff --git a/qa/qa/specs/features/shared_contexts/advanced_search_shared_context.rb b/qa/qa/specs/features/shared_contexts/advanced_search_shared_context.rb new file mode 100644 index 00000000000..c6836d11803 --- /dev/null +++ b/qa/qa/specs/features/shared_contexts/advanced_search_shared_context.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module QA + RSpec.shared_context 'advanced search active' do + let!(:advanced_search_on) { check_advanced_search_status } + + before do + QA::EE::Resource::Settings::Elasticsearch.fabricate_via_api! unless advanced_search_on + end + + after do + Runtime::Search.disable_elasticsearch(api_client) if !advanced_search_on && !api_client.nil? + end + + # TODO: convert this method to use the API instead of the UI once the functionality exists + # https://gitlab.com/gitlab-org/gitlab/-/issues/382849 + def check_advanced_search_status + Flow::Login.sign_in + QA::Page::Main::Menu.perform do |menu| + menu.search_for('lorem ipsum') + end + page.has_text?('Advanced search is enabled') + end + end +end diff --git a/qa/qa/specs/features/shared_contexts/import/github_import_shared_context.rb b/qa/qa/specs/features/shared_contexts/import/github_import_shared_context.rb index 27d94b04cde..481a09f601b 100644 --- a/qa/qa/specs/features/shared_contexts/import/github_import_shared_context.rb +++ b/qa/qa/specs/features/shared_contexts/import/github_import_shared_context.rb @@ -35,8 +35,44 @@ module QA end end + let(:smocker_host) { ENV["QA_SMOCKER_HOST"] } + let(:smocker) do + Vendor::Smocker::SmockerApi.new( + host: smocker_host, + public_port: 443, + admin_port: 8081, + tls: true + ) + end + + let(:mocks_path) { File.join(Runtime::Path.fixtures_path, "mocks", "import") } + before do + set_mocks group.add_member(user, Resource::Members::AccessLevel::MAINTAINER) end + + def expect_project_import_finished_successfully + imported_project.reload! # import the project + + status = nil + Support::Retrier.retry_until(max_duration: 240, sleep_interval: 1, raise_on_failure: false) do + status = imported_project.project_import_status[:import_status] + %w[finished failed].include?(status) + end + + # finished status means success, all other statuses are considered to fail the test + expect(status).to eq('finished'), "Expected import to finish successfully, but status was: #{status}" + end + + # Setup github mocked responses if mock server host is present + # + # @return [void] + def set_mocks + return Runtime::Logger.warn("Mock host is not set, skipping github response setup") unless smocker_host + + smocker.reset + smocker.register(File.read(File.join(mocks_path, "github.yml"))) + end end end diff --git a/qa/qa/specs/features/shared_contexts/import/gitlab_group_migration_common.rb b/qa/qa/specs/features/shared_contexts/import/gitlab_group_migration_common.rb index e1d762f41cb..853f427db12 100644 --- a/qa/qa/specs/features/shared_contexts/import/gitlab_group_migration_common.rb +++ b/qa/qa/specs/features/shared_contexts/import/gitlab_group_migration_common.rb @@ -19,6 +19,9 @@ module QA is_new_session: false ) end + let!(:source_bulk_import_enabled) do + Runtime::ApplicationSettings.get_application_settings(api_client: source_admin_api_client)[:bulk_import_enabled] + end let!(:source_admin_user) do Resource::User.fabricate_via_api! do |usr| usr.api_client = source_admin_api_client @@ -36,6 +39,9 @@ module QA # target instance objects # let!(:admin_api_client) { Runtime::API::Client.as_admin } + let!(:target_bulk_import_enabled) do + Runtime::ApplicationSettings.get_application_settings(api_client: admin_api_client)[:bulk_import_enabled] + end let!(:admin_user) do Resource::User.fabricate_via_api! do |usr| usr.api_client = admin_api_client @@ -87,7 +93,8 @@ module QA end before do - Runtime::ApplicationSettings.set_application_settings(bulk_import_enabled: true) + enable_bulk_import(source_admin_api_client) if source_admin_user && !source_bulk_import_enabled + enable_bulk_import(admin_api_client) unless target_bulk_import_enabled target_sandbox.add_member(user, Resource::Members::AccessLevel::OWNER) end @@ -102,5 +109,9 @@ module QA # make sure cleanup runs last cleanup! end + + def enable_bulk_import(api_client) + Runtime::ApplicationSettings.set_application_settings(api_client: api_client, bulk_import_enabled: true) + end end end diff --git a/qa/qa/specs/features/shared_contexts/merge_train_spec_with_user_prep.rb b/qa/qa/specs/features/shared_contexts/merge_train_spec_with_user_prep.rb index 9d1a37cb0b8..8af5dc5463e 100644 --- a/qa/qa/specs/features/shared_contexts/merge_train_spec_with_user_prep.rb +++ b/qa/qa/specs/features/shared_contexts/merge_train_spec_with_user_prep.rb @@ -20,7 +20,7 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::ProjectRunner.fabricate! do |runner| runner.project = project runner.name = executor runner.tags = [executor] diff --git a/qa/qa/specs/features/shared_contexts/packages_registry_shared_context.rb b/qa/qa/specs/features/shared_contexts/packages_registry_shared_context.rb index 73a6c2bd99e..a611a801b11 100644 --- a/qa/qa/specs/features/shared_contexts/packages_registry_shared_context.rb +++ b/qa/qa/specs/features/shared_contexts/packages_registry_shared_context.rb @@ -28,11 +28,11 @@ module QA end let(:runner) do - Resource::Runner.fabricate! do |runner| + Resource::GroupRunner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" runner.tags = ["runner-for-#{package_project.group.name}"] runner.executor = :docker - runner.token = package_project.group.reload!.runners_token + runner.group = package_project.group end end diff --git a/qa/qa/specs/features/shared_contexts/variable_inheritance_shared_context.rb b/qa/qa/specs/features/shared_contexts/variable_inheritance_shared_context.rb index 45caeced35c..2219031e9c6 100644 --- a/qa/qa/specs/features/shared_contexts/variable_inheritance_shared_context.rb +++ b/qa/qa/specs/features/shared_contexts/variable_inheritance_shared_context.rb @@ -37,8 +37,8 @@ module QA end let!(:runner) do - Resource::Runner.fabricate! do |runner| - runner.token = group.reload!.runners_token + Resource::GroupRunner.fabricate! do |runner| + runner.group = group runner.name = random_string runner.tags = [random_string] end diff --git a/qa/qa/specs/helpers/context_selector.rb b/qa/qa/specs/helpers/context_selector.rb index caa5ace430f..dfb00cb807b 100644 --- a/qa/qa/specs/helpers/context_selector.rb +++ b/qa/qa/specs/helpers/context_selector.rb @@ -27,7 +27,7 @@ module QA uri = URI(Runtime::Scenario.gitlab_address) options.each do |option| - opts[:domain] = 'gitlab' if option == :production + opts[:domain] = production_domain if option == :production next unless option.is_a?(Hash) @@ -75,6 +75,10 @@ module QA def pipeline_from_project_name(project_name) project_name.to_s.start_with?('gitlab-qa') ? Runtime::Env.default_branch : project_name end + + def production_domain + GitlabEdition.jh? ? 'jihulab' : 'gitlab' + end end end end diff --git a/qa/qa/specs/spec_helper.rb b/qa/qa/specs/spec_helper.rb index 003e8aa74c1..0e6e3973de9 100644 --- a/qa/qa/specs/spec_helper.rb +++ b/qa/qa/specs/spec_helper.rb @@ -28,13 +28,6 @@ RSpec.configure do |config| config.add_formatter QA::Support::Formatters::FeatureFlagFormatter config.add_formatter QA::Support::Formatters::TestMetricsFormatter if QA::Runtime::Env.running_in_ci? - config.before(:suite) do |suite| - QA::Resource::ReusableCollection.register_resource_classes do |collection| - QA::Resource::ReusableProject.register(collection) - QA::Resource::ReusableGroup.register(collection) - end - end - config.prepend_before do |example| QA::Runtime::Logger.info("Starting test: #{Rainbow(example.full_description).bright}") QA::Runtime::Example.current = example @@ -85,24 +78,6 @@ RSpec.configure do |config| config.after(:suite) do |suite| # Write all test created resources to JSON file QA::Tools::TestResourceDataProcessor.write_to_file(suite.reporter.failed_examples.any?) - - # If requested, confirm that resources were used appropriately (e.g., not left with changes that interfere with - # further reuse) - QA::Resource::ReusableCollection.validate_resource_reuse if QA::Runtime::Env.validate_resource_reuse? - - # If any tests failed, leave the resources behind to help troubleshoot, otherwise remove them. - # Do not remove the shared resource on live environments - begin - next if suite.reporter.failed_examples.present? - next unless QA::Runtime::Scenario.attributes.include?(:gitlab_address) - next if QA::Runtime::Env.running_on_dot_com? - - QA::Resource::ReusableCollection.remove_all_via_api! - rescue QA::Resource::Errors::InternalServerError => e - # Temporarily prevent this error from failing jobs while the cause is investigated - # See https://gitlab.com/gitlab-org/gitlab/-/issues/354387 - QA::Runtime::Logger.debug(e.message) - end end config.append_after(:suite) do |