diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 13:37:47 +0000 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /qa | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) | |
download | gitlab-ce-aee0a117a889461ce8ced6fcf73207fe017f1d99.tar.gz |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'qa')
238 files changed, 2339 insertions, 1378 deletions
diff --git a/qa/Gemfile b/qa/Gemfile index 498d05b2254..576b58f9844 100644 --- a/qa/Gemfile +++ b/qa/Gemfile @@ -15,7 +15,7 @@ gem 'rest-client', '~> 2.1.0' gem 'rspec-retry', '~> 0.6.1', require: 'rspec/retry' gem 'rspec_junit_formatter', '~> 0.4.1' gem 'faker', '~> 2.19', '>= 2.19.0' -gem 'knapsack', '~> 1.17' +gem 'knapsack', '~> 4.0' gem 'parallel_tests', '~> 2.29' gem 'rotp', '~> 3.1.0' gem 'timecop', '~> 0.9.1' @@ -27,6 +27,7 @@ gem 'zeitwerk', '~> 2.4' gem 'influxdb-client', '~> 1.17' gem 'terminal-table', '~> 1.8', require: false gem 'slack-notifier', '~> 2.4', require: false +gem 'fog-google', '~> 1.17', require: false gem 'chemlab', '~> 0.9' gem 'chemlab-library-www-gitlab-com', '~> 0.1' diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock index 2b5b5e368cf..14f10d2b047 100644 --- a/qa/Gemfile.lock +++ b/qa/Gemfile.lock @@ -29,6 +29,7 @@ GEM uuid (>= 2.3, < 3) ast (2.4.2) binding_ninja (0.2.3) + builder (3.2.4) byebug (9.1.0) capybara (3.35.3) addressable @@ -56,12 +57,14 @@ GEM adamantium (~> 0.2.0) equalizer (~> 0.0.9) concurrent-ruby (1.1.9) + declarative (0.0.20) deprecation_toolkit (1.5.1) activesupport (>= 4.2) diff-lcs (1.3) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) equalizer (0.0.11) + excon (0.88.0) faker (2.19.0) i18n (>= 1.6, < 2) faraday (1.5.1) @@ -85,6 +88,30 @@ GEM ffi-compiler (1.0.1) ffi (>= 1.0.0) rake + fog-core (2.1.0) + builder + excon (~> 0.58) + formatador (~> 0.2) + mime-types + fog-google (1.17.0) + fog-core (<= 2.1.0) + fog-json (~> 1.2) + fog-xml (~> 0.1.0) + google-apis-compute_v1 (~> 0.14) + google-apis-dns_v1 (~> 0.12) + google-apis-iamcredentials_v1 (~> 0.6) + google-apis-monitoring_v3 (~> 0.12) + google-apis-pubsub_v1 (~> 0.7) + google-apis-sqladmin_v1beta4 (~> 0.13) + google-apis-storage_v1 (~> 0.6) + google-cloud-env (~> 1.2) + fog-json (1.2.0) + fog-core + multi_json (~> 1.10) + fog-xml (0.1.4) + fog-core + nokogiri (>= 1.5.11, < 2.0.0) + formatador (0.3.0) gitlab (4.16.1) httparty (~> 0.14, >= 0.14.0) terminal-table (~> 1.5, >= 1.5.1) @@ -94,6 +121,38 @@ GEM http (~> 5.0) nokogiri (~> 1.10) table_print (= 1.5.7) + google-apis-compute_v1 (0.21.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-core (0.4.1) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + webrick + google-apis-dns_v1 (0.16.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-iamcredentials_v1 (0.8.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-monitoring_v3 (0.18.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-pubsub_v1 (0.10.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-sqladmin_v1beta4 (0.21.0) + google-apis-core (>= 0.4, < 2.a) + google-apis-storage_v1 (0.9.0) + google-apis-core (>= 0.4, < 2.a) + google-cloud-env (1.5.0) + faraday (>= 0.17.3, < 2.0) + googleauth (1.1.0) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) http (5.0.4) addressable (~> 2.8) http-cookie (~> 1.0) @@ -106,11 +165,13 @@ GEM httparty (0.20.0) mime-types (~> 3.0) multi_xml (>= 0.5.2) + httpclient (2.8.3) i18n (1.8.11) concurrent-ruby (~> 1.0) ice_nine (0.11.2) influxdb-client (1.17.0) - knapsack (1.17.1) + jwt (2.3.0) + knapsack (4.0.0) rake launchy (2.4.3) addressable (~> 2.3) @@ -119,6 +180,7 @@ GEM rake (~> 13.0) macaddr (1.7.2) systemu (~> 2.6.5) + memoist (0.16.2) memoizable (0.4.2) thread_safe (~> 0.3, >= 0.3.1) method_source (0.9.0) @@ -128,6 +190,7 @@ GEM mini_mime (1.1.0) mini_portile2 (2.6.1) minitest (5.14.4) + multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) netrc (0.11.0) @@ -138,10 +201,11 @@ GEM faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) oj (3.13.8) + os (1.1.4) parallel (1.19.2) parallel_tests (2.29.0) parallel - parser (3.0.2.0) + parser (3.0.3.2) ast (~> 2.4.1) proc_to_ast (0.1.0) coderay @@ -161,12 +225,17 @@ GEM rack (>= 1.0, < 3) rake (13.0.6) regexp_parser (2.1.1) + representable (3.1.1) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) require_all (3.0.0) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) + retriable (3.1.2) rexml (3.2.5) rotp (3.1.0) rspec (3.10.0) @@ -203,6 +272,11 @@ GEM childprocess (>= 0.5, < 5.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2) + signet (0.16.0) + addressable (~> 2.8) + faraday (>= 0.17.3, < 2.0) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) slack-notifier (2.4.0) systemu (2.6.5) table_print (1.5.7) @@ -210,8 +284,10 @@ GEM unicode-display_width (~> 1.1, >= 1.1.1) thread_safe (0.3.6) timecop (0.9.1) + trailblazer-option (0.1.2) tzinfo (2.0.4) concurrent-ruby (~> 1.0) + uber (0.1.0) unf (0.1.4) unf_ext unf_ext (0.0.8) @@ -233,6 +309,7 @@ GEM nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0) + webrick (1.7.0) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.5.1) @@ -250,9 +327,10 @@ DEPENDENCIES chemlab-library-www-gitlab-com (~> 0.1) deprecation_toolkit (~> 1.5.1) faker (~> 2.19, >= 2.19.0) + fog-google (~> 1.17) gitlab-qa influxdb-client (~> 1.17) - knapsack (~> 1.17) + knapsack (~> 4.0) octokit (~> 4.21) parallel (~> 1.19) parallel_tests (~> 2.29) diff --git a/qa/README.md b/qa/README.md index c380a5b6770..2e3f6af5bc3 100644 --- a/qa/README.md +++ b/qa/README.md @@ -73,6 +73,16 @@ bundle exec bin/qa Test::Instance::All http://localhost:3000 Note: If you want to run tests requiring SSH against GDK, you will need to [modify your GDK setup](https://gitlab.com/gitlab-org/gitlab-qa/blob/master/docs/run_qa_against_gdk.md). +Note: When you log into your GDK instance of GitLab for the first time, the root password requires a change. +GitLab QA expects the default initial password to be used in tests; see all default values listed in +[Supported GitLab environment variables](https://gitlab.com/gitlab-org/gitlab-qa/-/blob/master/docs/what_tests_can_be_run.md#supported-gitlab-environment-variables). +If you have changed your root password, you must set the `GITLAB_INITIAL_ROOT_PASSWORD` environment +variable. + +``` +export GITLAB_INITIAL_ROOT_PASSWORD="<GDK root password>" +``` + #### Running EE tests When running EE tests you'll need to have a license available. GitLab engineers can [request a license](https://about.gitlab.com/handbook/developer-onboarding/#working-on-gitlab-ee). diff --git a/qa/Rakefile b/qa/Rakefile index 57360e98ca2..e865b972b4e 100644 --- a/qa/Rakefile +++ b/qa/Rakefile @@ -1,8 +1,7 @@ # frozen_string_literal: true # rubocop:disable Rails/RakeEnvironment -load 'tasks/webdrivers.rake' -load 'tasks/reliable_report.rake' +Dir['tasks/*.rake'].each { |file| load file } require_relative 'qa/tools/revoke_all_personal_access_tokens' require_relative 'qa/tools/delete_subgroups' diff --git a/qa/knapsack/gcs/.gitignore b/qa/knapsack/gcs/.gitignore new file mode 100644 index 00000000000..e7c1de7e0f2 --- /dev/null +++ b/qa/knapsack/gcs/.gitignore @@ -0,0 +1,3 @@ +** + +!.gitignore diff --git a/qa/lib/gitlab/page/group/settings/usage_quotas.rb b/qa/lib/gitlab/page/group/settings/usage_quotas.rb index 455a695f703..0408668a81c 100644 --- a/qa/lib/gitlab/page/group/settings/usage_quotas.rb +++ b/qa/lib/gitlab/page/group/settings/usage_quotas.rb @@ -9,16 +9,36 @@ module Gitlab link :storage_tab, id: 'storage-quota' link :buy_ci_minutes, text: 'Buy additional minutes' link :buy_storage, text: /Purchase more storage/ - strong :additional_minutes, text: 'Additional minutes' - div(:additional_minutes_usage) { additional_minutes_element.following_sibling.span } - div :purchase_successful_alert, text: /You have successfully purchased CI minutes/ + div :plan_ci_minutes + div :additional_ci_minutes + span :purchased_usage_total + div :ci_purchase_successful_alert, text: /You have successfully purchased CI minutes/ + div :storage_purchase_successful_alert, text: /You have successfully purchased a storage/ + h4 :storage_available_alert, text: /purchased storage is available/ - def plan_minutes_limits - plan_minutes_usage[%r{([^/ ]+)$}] + def plan_ci_limits + plan_ci_minutes_element.span.text[%r{([^/ ]+)$}] end - def additional_limits - additional_minutes_usage[%r{([^/ ]+)$}] + def additional_ci_limits + additional_ci_minutes_element.span.text[%r{([^/ ]+)$}] + end + + # Waits and Checks if storage available alert presents on the page + # + # @return [Boolean] True if the alert presents, false if not after 5 second wait + def purchased_storage_available? + storage_available_alert_element.wait_until(timeout: 5, &:present?) + rescue Watir::Wait::TimeoutError + false + end + + # Returns total purchased storage value once it's ready on page + # + # @return [Float] Total purchased storage value in GiB + def total_purchased_storage + storage_available_alert_element.wait_until(&:present?) + purchased_usage_total.to_f end end end diff --git a/qa/qa/flow/purchase.rb b/qa/qa/flow/purchase.rb new file mode 100644 index 00000000000..41d771b9b6d --- /dev/null +++ b/qa/qa/flow/purchase.rb @@ -0,0 +1,107 @@ +# frozen_string_literal: true + +module QA + module Flow + module Purchase + include QA::Support::Helpers::Plan + + module_function + + def upgrade_subscription(plan: PREMIUM) + Page::Group::Menu.perform(&:go_to_billing) + Gitlab::Page::Group::Settings::Billing.perform do |billing| + billing.send("upgrade_to_#{plan[:name].downcase}") + end + + Gitlab::Page::Subscriptions::New.perform do |new_subscription| + new_subscription.continue_to_billing + + fill_in_customer_info + fill_in_payment_info + + new_subscription.confirm_purchase + end + end + + def purchase_ci_minutes(quantity: 1) + Page::Group::Menu.perform(&:go_to_usage_quotas) + Gitlab::Page::Group::Settings::UsageQuotas.perform do |usage_quota| + usage_quota.pipeline_tab + usage_quota.buy_ci_minutes + end + + Gitlab::Page::Subscriptions::New.perform do |ci_minutes| + ci_minutes.quantity = quantity + ci_minutes.continue_to_billing + + fill_in_customer_info + fill_in_payment_info + + ci_minutes.confirm_purchase + end + end + + def purchase_storage(quantity: 1) + Page::Group::Menu.perform(&:go_to_usage_quotas) + Gitlab::Page::Group::Settings::UsageQuotas.perform do |usage_quota| + usage_quota.storage_tab + usage_quota.buy_storage + end + + Gitlab::Page::Subscriptions::New.perform do |storage| + storage.quantity = quantity + storage.continue_to_billing + + fill_in_customer_info + fill_in_payment_info + + storage.confirm_purchase + end + end + + def fill_in_customer_info + Gitlab::Page::Subscriptions::New.perform do |subscription| + subscription.country = user_billing_info[:country] + subscription.street_address_1 = user_billing_info[:address_1] + subscription.street_address_2 = user_billing_info[:address_2] + subscription.city = user_billing_info[:city] + subscription.state = user_billing_info[:state] + subscription.zip_code = user_billing_info[:zip] + subscription.continue_to_payment + end + end + + def fill_in_payment_info + Gitlab::Page::Subscriptions::New.perform do |subscription| + subscription.name_on_card = credit_card_info[:name] + subscription.card_number = credit_card_info[:number] + subscription.expiration_month = credit_card_info[:month] + subscription.expiration_year = credit_card_info[:year] + subscription.cvv = credit_card_info[:cvv] + subscription.review_your_order + end + end + + def credit_card_info + { + name: 'QA Test', + number: '4111111111111111', + month: '01', + year: '2025', + cvv: '232' + }.freeze + end + + def user_billing_info + { + country: 'United States of America', + address_1: 'Address 1', + address_2: 'Address 2', + city: 'San Francisco', + state: 'California', + zip: '94102' + }.freeze + end + end + end +end diff --git a/qa/qa/flow/settings.rb b/qa/qa/flow/settings.rb new file mode 100644 index 00000000000..775b7686c10 --- /dev/null +++ b/qa/qa/flow/settings.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module QA + module Flow + module Settings + module_function + + def disable_snowplow + Flow::Login.while_signed_in_as_admin do + QA::Page::Main::Menu.perform(&:go_to_admin_area) + QA::Page::Admin::Menu.perform(&:go_to_general_settings) + QA::Page::Admin::Settings::Component::Snowplow.perform(&:disable_snowplow_tracking) + end + end + + def enable_snowplow + Flow::Login.while_signed_in_as_admin do + QA::Page::Main::Menu.perform(&:go_to_admin_area) + QA::Page::Admin::Menu.perform(&:go_to_general_settings) + QA::Page::Admin::Settings::Component::Snowplow.perform(&:enable_snowplow_tracking) + end + end + end + end +end diff --git a/qa/qa/mobile/page/project/issue/show.rb b/qa/qa/mobile/page/project/issue/show.rb index 017ecebcb69..df96a318806 100644 --- a/qa/qa/mobile/page/project/issue/show.rb +++ b/qa/qa/mobile/page/project/issue/show.rb @@ -12,7 +12,7 @@ module QA super base.class_eval do - view 'app/assets/javascripts/issue_show/components/header_actions.vue' do + view 'app/assets/javascripts/issues/show/components/header_actions.vue' do element :issue_actions_dropdown element :mobile_close_issue_button element :mobile_reopen_issue_button diff --git a/qa/qa/page/admin/overview/users/index.rb b/qa/qa/page/admin/overview/users/index.rb index 8a2c2303ff7..2ad45e4a0fa 100644 --- a/qa/qa/page/admin/overview/users/index.rb +++ b/qa/qa/page/admin/overview/users/index.rb @@ -15,10 +15,6 @@ module QA element :user_row_content end - view 'app/views/admin/users/_user_detail.html.haml' do - element :username_link - end - def search_user(username) find_element(:user_search_field).set(username).send_keys(:return) end diff --git a/qa/qa/page/admin/settings/component/snowplow.rb b/qa/qa/page/admin/settings/component/snowplow.rb new file mode 100644 index 00000000000..e05679feac3 --- /dev/null +++ b/qa/qa/page/admin/settings/component/snowplow.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +module QA + module Page + module Admin + module Settings + module Component + class Snowplow < Page::Base + include QA::Page::Settings::Common + + view 'app/views/admin/application_settings/_snowplow.html.haml' do + element :snowplow_settings_content + element :snowplow_enabled_checkbox + element :save_changes_button + end + + def enable_snowplow_tracking + expand_content(:snowplow_settings_content) do + check_snowplow_enabled_checkbox + click_save_changes_button + end + end + + def disable_snowplow_tracking + expand_content(:snowplow_settings_content) do + uncheck_snowplow_enabled_checkbox + click_save_changes_button + end + end + + private + + def check_snowplow_enabled_checkbox + check_element(:snowplow_enabled_checkbox) + end + + def uncheck_snowplow_enabled_checkbox + uncheck_element(:snowplow_enabled_checkbox) + end + + def click_save_changes_button + click_element :save_changes_button + end + end + end + end + end + end +end diff --git a/qa/qa/page/admin/settings/component/usage_statistics.rb b/qa/qa/page/admin/settings/component/usage_statistics.rb new file mode 100644 index 00000000000..0275b7ae926 --- /dev/null +++ b/qa/qa/page/admin/settings/component/usage_statistics.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module QA + module Page + module Admin + module Settings + module Component + class UsageStatistics < Page::Base + view 'app/views/admin/application_settings/_usage.html.haml' do + element :enable_usage_data_checkbox + end + + def has_disabled_usage_data_checkbox? + has_element?(:enable_usage_data_checkbox, disabled: true) + end + end + end + end + end + end +end diff --git a/qa/qa/page/admin/settings/metrics_and_profiling.rb b/qa/qa/page/admin/settings/metrics_and_profiling.rb index 41fad942fc4..7224e51e110 100644 --- a/qa/qa/page/admin/settings/metrics_and_profiling.rb +++ b/qa/qa/page/admin/settings/metrics_and_profiling.rb @@ -9,6 +9,7 @@ module QA view 'app/views/admin/application_settings/metrics_and_profiling.html.haml' do element :performance_bar_settings_content + element :usage_statistics_settings_content end def expand_performance_bar(&block) @@ -16,6 +17,12 @@ module QA Component::PerformanceBar.perform(&block) end end + + def expand_usage_statistics(&block) + expand_content(:usage_statistics_settings_content) do + Component::UsageStatistics.perform(&block) + end + end end end end diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index 4708063b2eb..69f58dcb8a5 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -443,6 +443,29 @@ module QA # Some checkboxes and radio buttons are hidden by their labels and cannot be clicked directly click_by_js ? page.execute_script("arguments[0].click();", box) : box.click end + + def feature_flag_controlled_element(feature_flag, element_when_flag_enabled, element_when_flag_disabled) + # Feature flags can change the UI elements shown, but we need admin access to get feature flag values, which + # prevents us running the tests on production. Instead we detect the UI element that should be shown when the + # feature flag is enabled and otherwise use the element that should be displayed when the feature flag is + # disabled. + + # Check both options once quickly so that the test doesn't wait unnecessarily if the UI has loaded + # We wait for requests first and wait one second for the element because it can take a moment for a Vue app to + # load and render the UI + wait_for_requests + + return element_when_flag_enabled if has_element?(element_when_flag_enabled, wait: 1) + return element_when_flag_disabled if has_element?(element_when_flag_disabled, wait: 1) + + # Check both options again, this time waiting for the default duration + return element_when_flag_enabled if has_element?(element_when_flag_enabled) + return element_when_flag_disabled if has_element?(element_when_flag_disabled) + + raise ElementNotFound, + "Could not find the expected element as #{element_when_flag_enabled} or #{element_when_flag_disabled}." \ + "The relevant feature flag is #{feature_flag}" + end end end end diff --git a/qa/qa/page/component/blob_content.rb b/qa/qa/page/component/blob_content.rb new file mode 100644 index 00000000000..4d36a6dcefe --- /dev/null +++ b/qa/qa/page/component/blob_content.rb @@ -0,0 +1,86 @@ +# frozen_string_literal: true + +module QA + module Page + module Component + module BlobContent + extend QA::Page::PageConcern + + def self.included(base) + super + + base.view 'app/assets/javascripts/blob/components/blob_header_filepath.vue' do + element :file_title_content + end + + base.view 'app/assets/javascripts/blob/components/blob_content.vue' do + element :blob_viewer_file_content + end + + base.view 'app/assets/javascripts/blob/components/blob_header_default_actions.vue' do + element :default_actions_container + element :copy_contents_button + end + + base.view 'app/views/projects/blob/_header_content.html.haml' do + element :file_name_content + end + + base.view 'app/views/shared/_file_highlight.html.haml' do + element :file_content + end + end + + def has_file?(name) + has_file_name?(name) + end + + def has_no_file?(name) + has_no_file_name?(name) + end + + def has_file_name?(file_name, file_number = nil) + within_file_by_number(file_name_element, file_number) { has_text?(file_name) } + end + + def has_no_file_name?(file_name) + within_element(file_name_element) do + has_no_text?(file_name) + end + end + + def has_file_content?(file_content, file_number = nil) + within_file_by_number(file_content_element, file_number) { has_text?(file_content) } + end + + def has_no_file_content?(file_content) + within_element(file_content_element) do + has_no_text?(file_content) + end + end + + def click_copy_file_contents(file_number = nil) + within_file_by_number(:default_actions_container, file_number) { click_element(:copy_contents_button) } + end + + private + + def file_content_element + feature_flag_controlled_element(:refactor_blob_viewer, :blob_viewer_file_content, :file_content) + end + + def file_name_element + feature_flag_controlled_element(:refactor_blob_viewer, :file_title_content, :file_name_content) + end + + def within_file_by_number(element, file_number) + if file_number + within_element_by_index(element, file_number - 1) { yield } + else + within_element(element) { yield } + end + end + end + end + end +end diff --git a/qa/qa/page/component/issuable/common.rb b/qa/qa/page/component/issuable/common.rb index bbab1746d7a..0d056afd7f0 100644 --- a/qa/qa/page/component/issuable/common.rb +++ b/qa/qa/page/component/issuable/common.rb @@ -10,20 +10,20 @@ module QA def self.included(base) super - base.view 'app/assets/javascripts/issue_show/components/title.vue' do + base.view 'app/assets/javascripts/issues/show/components/title.vue' do element :edit_button element :title, required: true end - base.view 'app/assets/javascripts/issue_show/components/fields/title.vue' do + base.view 'app/assets/javascripts/issues/show/components/fields/title.vue' do element :title_input end - base.view 'app/assets/javascripts/issue_show/components/fields/description.vue' do + base.view 'app/assets/javascripts/issues/show/components/fields/description.vue' do element :description_textarea end - base.view 'app/assets/javascripts/issue_show/components/edit_actions.vue' do + base.view 'app/assets/javascripts/issues/show/components/edit_actions.vue' do element :save_button element :delete_button end diff --git a/qa/qa/page/component/issuable/sidebar.rb b/qa/qa/page/component/issuable/sidebar.rb index 77962570aed..4a81230499c 100644 --- a/qa/qa/page/component/issuable/sidebar.rb +++ b/qa/qa/page/component/issuable/sidebar.rb @@ -18,7 +18,7 @@ module QA element :more_assignees_link end - base.view 'app/assets/javascripts/sidebar/components/labels/sidebar_labels.vue' do + base.view 'app/assets/javascripts/vue_shared/components/sidebar/labels_select_widget/labels_select_root.vue' do element :labels_block end @@ -124,15 +124,6 @@ module QA click_element(:more_assignees_link) end - # When the labels_widget feature flag is enabled, wait until the labels widget appears - def wait_for_labels_widget_feature_flag - Support::Retrier.retry_until(max_duration: 60, reload_page: page, retry_on_exception: true, sleep_interval: 5) do - within_element(:labels_block) do - find_element(:edit_link) - end - end - end - private def wait_assignees_block_finish_loading diff --git a/qa/qa/page/component/snippet.rb b/qa/qa/page/component/snippet.rb index ad264bd6d56..34e884f2a08 100644 --- a/qa/qa/page/component/snippet.rb +++ b/qa/qa/page/component/snippet.rb @@ -26,7 +26,7 @@ module QA end base.view 'app/assets/javascripts/blob/components/blob_content.vue' do - element :file_content + element :blob_viewer_file_content end base.view 'app/assets/javascripts/snippets/components/snippet_header.vue' do @@ -130,11 +130,11 @@ module QA def has_file_content?(file_content, file_number = nil) if file_number - within_element_by_index(:file_content, file_number - 1) do + within_element_by_index(:blob_viewer_file_content, file_number - 1) do has_text?(file_content) end else - within_element(:file_content) do + within_element(:blob_viewer_file_content) do has_text?(file_content) end end @@ -142,11 +142,11 @@ module QA def has_no_file_content?(file_content, file_number = nil) if file_number - within_element_by_index(:file_content, file_number - 1) do + within_element_by_index(:blob_viewer_file_content, file_number - 1) do has_no_text?(file_content) end else - within_element(:file_content) do + within_element(:blob_viewer_file_content) do has_no_text?(file_content) end end @@ -207,7 +207,7 @@ module QA end def has_syntax_highlighting?(language) - within_element(:file_content) do + within_element(:blob_viewer_file_content) do find('.line')['lang'].to_s == language end end diff --git a/qa/qa/page/component/wiki.rb b/qa/qa/page/component/wiki.rb index c3db1d6c885..ffd31f8d7b7 100644 --- a/qa/qa/page/component/wiki.rb +++ b/qa/qa/page/component/wiki.rb @@ -11,10 +11,13 @@ module QA base.view 'app/views/shared/wikis/show.html.haml' do element :wiki_page_title - element :wiki_page_content element :edit_page_button end + base.view 'app/views/shared/wikis/_wiki_content.html.haml' do + element :wiki_page_content + end + base.view 'app/views/shared/wikis/_main_links.html.haml' do element :new_page_button element :page_history_button diff --git a/qa/qa/page/component/wiki_page_form.rb b/qa/qa/page/component/wiki_page_form.rb index fd536ff1dd3..bc73fe0c3ab 100644 --- a/qa/qa/page/component/wiki_page_form.rb +++ b/qa/qa/page/component/wiki_page_form.rb @@ -15,6 +15,7 @@ module QA element :wiki_message_textbox element :wiki_submit_button element :try_new_editor_container + element :editing_mode_button end base.view 'app/assets/javascripts/pages/shared/wikis/components/delete_wiki_modal.vue' do @@ -36,6 +37,10 @@ module QA def click_submit click_element(:wiki_submit_button) + + wait_until(reload: false) do + has_no_element?(:wiki_title_textbox) + end end def delete_page @@ -43,11 +48,19 @@ module QA Page::Modal::DeleteWiki.perform(&:confirm_deletion) end - def use_new_editor - within_element(:try_new_editor_container) do - click_button('Use the new editor') + def use_new_editor(toggle) + # Update once the feature is released, see https://gitlab.com/gitlab-org/gitlab/-/issues/345398 + if toggle + click_element(:editing_mode_button, mode: 'Edit rich text') + else + within_element(:try_new_editor_container) do + click_button('Use the new editor') + end + end + + wait_until(reload: false) do + has_element?(:content_editor_container) end - has_element?(:content_editor_container) end end end diff --git a/qa/qa/page/dashboard/snippet/show.rb b/qa/qa/page/dashboard/snippet/show.rb index 576e287d40d..a314f523108 100644 --- a/qa/qa/page/dashboard/snippet/show.rb +++ b/qa/qa/page/dashboard/snippet/show.rb @@ -6,6 +6,7 @@ module QA module Snippet class Show < Page::Base include Page::Component::Snippet + include Page::Component::BlobContent view 'app/assets/javascripts/snippets/components/snippet_title.vue' do element :snippet_title_content, required: true diff --git a/qa/qa/page/file/shared/commit_message.rb b/qa/qa/page/file/shared/commit_message.rb index 4c25e8a480b..a3658fa11af 100644 --- a/qa/qa/page/file/shared/commit_message.rb +++ b/qa/qa/page/file/shared/commit_message.rb @@ -10,6 +10,10 @@ module QA def self.included(base) super + base.view 'app/assets/javascripts/repository/components/delete_blob_modal.vue' do + element :commit_message_field + end + base.view 'app/views/shared/_commit_message_container.html.haml' do element :commit_message_field end diff --git a/qa/qa/page/file/show.rb b/qa/qa/page/file/show.rb index cefbbbcdba0..730c5a88515 100644 --- a/qa/qa/page/file/show.rb +++ b/qa/qa/page/file/show.rb @@ -8,24 +8,21 @@ module QA include Project::SubMenus::Settings include Project::SubMenus::Common include Layout::Flash + include Page::Component::BlobContent + + view 'app/assets/javascripts/repository/components/blob_button_group.vue' do + element :lock_button + end view 'app/helpers/blob_helper.rb' do element :edit_button, "_('Edit')" # rubocop:disable QA/ElementWithPattern element :delete_button, '_("Delete")' # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/blob/_header_content.html.haml' do - element :file_name_content - end - view 'app/views/projects/blob/_remove.html.haml' do element :delete_file_button, "button_tag 'Delete file'" # rubocop:disable QA/ElementWithPattern end - view 'app/views/shared/_file_highlight.html.haml' do - element :file_content - end - def click_edit click_on 'Edit' end @@ -37,26 +34,6 @@ module QA def click_delete_file click_on 'Delete file' end - - def has_file?(name) - has_element?(:file_name_content, text: name) - end - - def has_no_file?(name) - has_no_element?(:file_name_content, text: name) - end - - def has_file_content?(file_content, file_number = nil) - if file_number - within_element_by_index(:file_content, file_number - 1) do - has_text?(file_content) - end - else - within_element(:file_content) do - has_text?(file_content) - end - end - end end end end diff --git a/qa/qa/page/main/terms.rb b/qa/qa/page/main/terms.rb index a0de267fb31..024510c33cf 100644 --- a/qa/qa/page/main/terms.rb +++ b/qa/qa/page/main/terms.rb @@ -8,7 +8,7 @@ module QA element :user_avatar, required: true end - view 'app/views/users/terms/index.html.haml' do + view 'app/assets/javascripts/terms/components/app.vue' do element :terms_content, required: true element :accept_terms_button diff --git a/qa/qa/page/project/infrastructure/kubernetes/add_existing.rb b/qa/qa/page/project/infrastructure/kubernetes/add_existing.rb index 689c2a31c4f..2fc65cf0afe 100644 --- a/qa/qa/page/project/infrastructure/kubernetes/add_existing.rb +++ b/qa/qa/page/project/infrastructure/kubernetes/add_existing.rb @@ -20,7 +20,7 @@ module QA end def set_api_url(api_url) - fill_in 'cluster_platform_kubernetes_attributes_api_url', with: QA::Runtime::Env.cluster_api_url || api_url + fill_in 'cluster_platform_kubernetes_attributes_api_url', with: api_url end def set_ca_certificate(ca_certificate) diff --git a/qa/qa/page/project/issue/index.rb b/qa/qa/page/project/issue/index.rb index fc46f7a2936..0d495fc661e 100644 --- a/qa/qa/page/project/issue/index.rb +++ b/qa/qa/page/project/issue/index.rb @@ -5,12 +5,12 @@ module QA module Project module Issue class Index < Page::Base - view 'app/assets/javascripts/issues_list/components/issuable.vue' do - element :issue_container - element :issue_link + view 'app/assets/javascripts/vue_shared/issuable/list/components/issuable_list_root.vue' do + element :issuable_container + element :issuable_search_container end - view 'app/assets/javascripts/vue_shared/components/issue/issue_assignees.vue' do + view 'app/assets/javascripts/issuable/components/issue_assignees.vue' do element :assignee_link element :avatar_counter_content end @@ -25,8 +25,8 @@ module QA element :import_issues_dropdown end - view 'app/views/shared/issuable/_nav.html.haml' do - element :closed_issues_link + view 'app/assets/javascripts/vue_shared/issuable/list/components/issuable_tabs.vue' do + element :closed_issuables_tab, ':data-qa-selector="`${tab.name}_issuables_tab`"' # rubocop:disable QA/ElementWithPattern end def avatar_counter @@ -37,8 +37,8 @@ module QA click_link(title) end - def click_closed_issues_link - click_element :closed_issues_link + def click_closed_issues_tab + click_element(:closed_issuables_tab) end def click_export_as_csv_button @@ -73,11 +73,17 @@ module QA end def has_issue?(issue) - has_element? :issue_container, issue_title: issue.title + has_element? :issuable_container, issuable_title: issue.title end def has_no_issue?(issue) - has_no_element? :issue_container, issue_title: issue.title + has_no_element? :issuable_container, issuable_title: issue.title + end + + def wait_for_vue_issues_list_ff + Support::Retrier.retry_until(max_duration: 60, reload_page: page, retry_on_exception: true, sleep_interval: 5) do + find_element(:closed_issuables_tab) + end end end end diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb index 3b033830420..b37210f4d3f 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -11,11 +11,11 @@ module QA include Page::Component::Issuable::Sidebar prepend Mobile::Page::Project::Issue::Show if Runtime::Env.mobile_layout? - view 'app/assets/javascripts/vue_shared/components/issue/related_issuable_item.vue' do + view 'app/assets/javascripts/issuable/components/related_issuable_item.vue' do element :remove_related_issue_button end - view 'app/assets/javascripts/issue_show/components/header_actions.vue' do + view 'app/assets/javascripts/issues/show/components/header_actions.vue' do element :close_issue_button element :reopen_issue_button end diff --git a/qa/qa/page/project/packages/index.rb b/qa/qa/page/project/packages/index.rb index 7794677b9b5..86a86c05c12 100644 --- a/qa/qa/page/project/packages/index.rb +++ b/qa/qa/page/project/packages/index.rb @@ -5,7 +5,7 @@ module QA module Project module Packages class Index < QA::Page::Base - view 'app/assets/javascripts/packages/shared/components/package_list_row.vue' do + view 'app/assets/javascripts/packages_and_registries/package_registry/components/list/package_list_row.vue' do element :package_row element :package_link end @@ -15,7 +15,7 @@ module QA end def has_package?(name) - has_element?(:package_link, text: name) + has_element?(:package_link, text: name, wait: 20) end def has_no_package?(name) diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index d45eeac46f6..83a49ae6361 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -77,7 +77,10 @@ module QA end def click_job(job_name) - click_element(:job_link, Project::Job::Show, text: job_name) + # Retry due to transient bug https://gitlab.com/gitlab-org/gitlab/-/issues/347126 + QA::Support::Retrier.retry_on_exception do + click_element(:job_link, Project::Job::Show, text: job_name) + end end def child_pipelines diff --git a/qa/qa/page/project/pipeline_editor/show.rb b/qa/qa/page/project/pipeline_editor/show.rb index 38c87c8daa1..e430884ea08 100644 --- a/qa/qa/page/project/pipeline_editor/show.rb +++ b/qa/qa/page/project/pipeline_editor/show.rb @@ -6,37 +6,59 @@ module QA module PipelineEditor class Show < QA::Page::Base view 'app/assets/javascripts/pipeline_editor/components/file_nav/branch_switcher.vue' do - element :branch_selector_button - element :menu_branch_button + element :branch_selector_button, require: true + element :branch_menu_item_button + element :branch_menu_container end view 'app/assets/javascripts/pipeline_editor/components/commit/commit_form.vue' do - element :target_branch_field + element :target_branch_field, require: true end - def has_branch_selector_button? - has_element? :branch_selector_button + view 'app/assets/javascripts/pipeline_editor/components/drawer/pipeline_editor_drawer.vue' do + element :toggle_sidebar_collapse_button + element :drawer_content end - def click_branch_selector_button - wait_until(reload: false) do - has_element?(:branch_selector_button) - end - click_element(:branch_selector_button, skip_finished_loading_check: true) + view 'app/assets/javascripts/vue_shared/components/source_editor.vue' do + element :source_editor_container, require: true end - def select_branch_from_dropdown(branch_to_switch_to) - wait_until(reload: false) do - has_element?(:menu_branch_button) - end - click_element(:menu_branch_button, text: branch_to_switch_to, skip_finished_loading_check: true) + def initialize + super + + wait_for_requests + close_toggle_sidebar + end + + def open_branch_selector_dropdown + click_element(:branch_selector_button) + end + + def select_branch_from_dropdown(branch_name) + wait_for_animated_element(:branch_menu_container) + click_element(:branch_menu_item_button, text: branch_name) + + wait_for_requests end def target_branch_name - wait_until(reload: false) do - has_element?(:target_branch_field) - end - find_element(:target_branch_field, skip_finished_loading_check: true).value + find_element(:target_branch_field).value + end + + def editing_content + find_element(:source_editor_container).text + end + + private + + # If the page thinks user has never opened pipeline editor before + # It will expand pipeline editor sidebar by default + # Collapse the sidebar if it is expanded + def close_toggle_sidebar + return unless has_element?(:drawer_content) + + click_element(:toggle_sidebar_collapse_button) end end end diff --git a/qa/qa/page/project/settings/advanced.rb b/qa/qa/page/project/settings/advanced.rb index 0ba856e8a6e..da1f16f4cfc 100644 --- a/qa/qa/page/project/settings/advanced.rb +++ b/qa/qa/page/project/settings/advanced.rb @@ -5,7 +5,6 @@ module QA module Project module Settings class Advanced < Page::Base - include Component::Select2 include Component::ConfirmModal view 'app/views/projects/edit.html.haml' do @@ -13,8 +12,10 @@ module QA element :change_path_button end - view 'app/views/projects/_transfer.html.haml' do - element :transfer_button + view "app/assets/javascripts/vue_shared/components/namespace_select/namespace_select.vue" do + element :namespaces_list + element :namespaces_list_groups + element :namespaces_list_item end view 'app/views/projects/settings/_archive.html.haml' do @@ -42,16 +43,22 @@ module QA click_element :change_path_button end + def select_namespace(item) + click_element :namespaces_list + + within_element(:namespaces_list) do + find_element(:namespaces_list_item, text: item).click + end + end + def transfer_project!(project_name, namespace) QA::Runtime::Logger.info "Transferring project: #{project_name} to namespace: #{namespace}" click_element_coordinates(:archive_project_content) - expand_select_list - # Workaround for a failure to search when there are no spaces around the / # https://gitlab.com/gitlab-org/gitlab/-/issues/218965 - search_and_select(namespace.gsub(%r{([^\s])/([^\s])}, '\1 / \2')) + select_namespace(namespace.gsub(%r{([^\s])/([^\s])}, '\1 / \2')) click_element(:transfer_button) fill_confirmation_text(project_name) diff --git a/qa/qa/page/project/settings/services/jira.rb b/qa/qa/page/project/settings/services/jira.rb index 0a56aaa758e..827508e488c 100644 --- a/qa/qa/page/project/settings/services/jira.rb +++ b/qa/qa/page/project/settings/services/jira.rb @@ -23,6 +23,11 @@ module QA element :save_changes_button end + view 'app/assets/javascripts/integrations/edit/components/jira_issues_fields.vue' do + element :service_jira_issues_enabled_checkbox + element :service_jira_project_key_field + end + def setup_service_with(url:) QA::Runtime::Logger.info "Setting up JIRA" @@ -34,12 +39,22 @@ module QA use_custom_transitions set_transition_ids('11,21,31,41') + yield self if block_given? + click_save_changes_button wait_until(reload: false) do has_element?(:save_changes_button, wait: 1) ? !find_element(:save_changes_button).disabled? : true end end + def enable_jira_issues + check_element(:service_jira_issues_enabled_checkbox, true) + end + + def set_jira_project_key(key) + fill_element(:service_jira_project_key_field, key) + end + private def set_jira_server_url(url) diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 65a1f726a8a..8074b6f833b 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -45,10 +45,6 @@ module QA element :tree_holder, '.tree-holder' # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/buttons/_dropdown.html.haml' do - element :create_new_dropdown - end - view 'app/views/projects/buttons/_fork.html.haml' do element :fork_label, "%span= s_('ProjectOverview|Fork')" # rubocop:disable QA/ElementWithPattern element :fork_link, "link_to new_project_fork_path(@project)" # rubocop:disable QA/ElementWithPattern diff --git a/qa/qa/page/project/snippet/index.rb b/qa/qa/page/project/snippet/index.rb index fc677f96769..704698dc9d8 100644 --- a/qa/qa/page/project/snippet/index.rb +++ b/qa/qa/page/project/snippet/index.rb @@ -6,6 +6,7 @@ module QA module Snippet class Index < Page::Base include Page::Component::Snippet + include Page::Component::BlobContent view 'app/views/shared/snippets/_snippet.html.haml' do element :snippet_link diff --git a/qa/qa/page/project/snippet/show.rb b/qa/qa/page/project/snippet/show.rb index f66fa2cbe51..89723baf424 100644 --- a/qa/qa/page/project/snippet/show.rb +++ b/qa/qa/page/project/snippet/show.rb @@ -6,6 +6,7 @@ module QA module Snippet class Show < Page::Base include Page::Component::Snippet + include Page::Component::BlobContent view 'app/views/projects/notes/_actions.html.haml' do element :edit_comment_button diff --git a/qa/qa/page/project/sub_menus/issues.rb b/qa/qa/page/project/sub_menus/issues.rb index 1df93d1118b..48cdf9791f8 100644 --- a/qa/qa/page/project/sub_menus/issues.rb +++ b/qa/qa/page/project/sub_menus/issues.rb @@ -51,6 +51,14 @@ module QA end end + def go_to_jira_issues + hover_issues do + within_submenu do + click_element(:sidebar_menu_item_link, menu_item: 'Jira issues') + end + end + end + private def hover_issues diff --git a/qa/qa/resource/api_fabricator.rb b/qa/qa/resource/api_fabricator.rb index b94fa543b48..6315ef0bd22 100644 --- a/qa/qa/resource/api_fabricator.rb +++ b/qa/qa/resource/api_fabricator.rb @@ -7,14 +7,7 @@ module QA module Resource module ApiFabricator include Capybara::DSL - - ResourceFabricationFailedError = Class.new(RuntimeError) - ResourceNotDeletedError = Class.new(RuntimeError) - ResourceNotFoundError = Class.new(RuntimeError) - ResourceQueryError = Class.new(RuntimeError) - ResourceUpdateFailedError = Class.new(RuntimeError) - ResourceURLMissingError = Class.new(RuntimeError) - InternalServerError = Class.new(RuntimeError) + include Errors attr_reader :api_resource, :api_response attr_writer :api_client diff --git a/qa/qa/resource/base.rb b/qa/qa/resource/base.rb index 26a2a668cc1..640d2a8f06e 100644 --- a/qa/qa/resource/base.rb +++ b/qa/qa/resource/base.rb @@ -80,11 +80,25 @@ module QA Support::FabricationTracker.start_fabrication result = yield.tap do fabrication_time = Time.now - start + resource_identifier = begin + if resource.respond_to?(:username) && resource.username + "with username '#{resource.username}'" + elsif resource.respond_to?(:full_path) && resource.full_path + "with full_path '#{resource.full_path}'" + elsif resource.respond_to?(:name) && resource.name + "with name '#{resource.name}'" + elsif resource.respond_to?(:id) && resource.id + "with id '#{resource.id}'" + end + rescue QA::Resource::Base::NoValueError + nil + end Support::FabricationTracker.save_fabrication(:"#{method}_fabrication", fabrication_time) Runtime::Logger.debug do msg = ["==#{'=' * parents.size}>"] msg << "Built a #{name}" + msg << resource_identifier if resource_identifier msg << "as a dependency of #{parents.last}" if parents.any? msg << "via #{method}" msg << "in #{fabrication_time} seconds" diff --git a/qa/qa/resource/errors.rb b/qa/qa/resource/errors.rb new file mode 100644 index 00000000000..a6933a6c9a7 --- /dev/null +++ b/qa/qa/resource/errors.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module QA + module Resource + module Errors + ResourceFabricationFailedError = Class.new(RuntimeError) + ResourceNotDeletedError = Class.new(RuntimeError) + ResourceNotFoundError = Class.new(RuntimeError) + ResourceQueryError = Class.new(RuntimeError) + ResourceUpdateFailedError = Class.new(RuntimeError) + ResourceURLMissingError = Class.new(RuntimeError) + InternalServerError = Class.new(RuntimeError) + end + end +end diff --git a/qa/qa/resource/events/base.rb b/qa/qa/resource/events/base.rb index d96f5a30f05..f01fa871726 100644 --- a/qa/qa/resource/events/base.rb +++ b/qa/qa/resource/events/base.rb @@ -4,7 +4,7 @@ module QA module Resource module Events MAX_WAIT = 60 - RAISE_ON_FAILURE = true + RAISE_ON_FAILURE = false EventNotFoundError = Class.new(RuntimeError) diff --git a/qa/qa/resource/events/project.rb b/qa/qa/resource/events/project.rb index 2560e6b9e3b..410edd417c1 100644 --- a/qa/qa/resource/events/project.rb +++ b/qa/qa/resource/events/project.rb @@ -25,6 +25,10 @@ module QA wait_for_event do events(action: 'pushed').any? { |event| event.dig(:push_data, :commit_title) == commit_message } end + rescue EventNotFoundError + QA::Runtime::Logger.debug("Push events: #{events(action: 'pushed')}") + + raise end def wait_for_push_new_branch(branch_name = self.default_branch) diff --git a/qa/qa/resource/file.rb b/qa/qa/resource/file.rb index 9b05c0cb456..253b63e4260 100644 --- a/qa/qa/resource/file.rb +++ b/qa/qa/resource/file.rb @@ -7,7 +7,8 @@ module QA :author_name, :content, :commit_message, - :name + :name, + :start_branch attr_writer :branch attribute :project do @@ -27,6 +28,7 @@ module QA @name = 'QA Test - File name' @content = 'QA Test - File content' @commit_message = 'QA Test - Commit message' + @start_branch = project.default_branch end def branch @@ -57,6 +59,7 @@ module QA def api_post_body { branch: branch, + start_branch: start_branch, author_email: @author_email || Runtime::User.default_email, author_name: @author_name || Runtime::User.username, content: content, diff --git a/qa/qa/resource/group.rb b/qa/qa/resource/group.rb index ce85273c3b2..a325d96ccc2 100644 --- a/qa/qa/resource/group.rb +++ b/qa/qa/resource/group.rb @@ -68,7 +68,8 @@ module QA path: path, name: path, visibility: 'public', - require_two_factor_authentication: @require_two_factor_authentication + require_two_factor_authentication: @require_two_factor_authentication, + avatar: avatar } end diff --git a/qa/qa/resource/group_base.rb b/qa/qa/resource/group_base.rb index 932d39675a3..19bb5ea00d7 100644 --- a/qa/qa/resource/group_base.rb +++ b/qa/qa/resource/group_base.rb @@ -7,7 +7,7 @@ module QA class GroupBase < Base include Members - attr_accessor :path + attr_accessor :path, :avatar attributes :id, :runners_token, diff --git a/qa/qa/resource/group_deploy_token.rb b/qa/qa/resource/group_deploy_token.rb index 410a7e6253f..c1d6be6547a 100644 --- a/qa/qa/resource/group_deploy_token.rb +++ b/qa/qa/resource/group_deploy_token.rb @@ -4,18 +4,11 @@ module QA module Resource class GroupDeployToken < Base attr_accessor :name, :expires_at + attr_writer :scopes - attribute :username do - Page::Group::Settings::Repository.perform do |repository_page| - repository_page.expand_deploy_tokens(&:token_username) - end - end - - attribute :password do - Page::Group::Settings::Repository.perform do |repository_page| - repository_page.expand_deploy_tokens(&:token_password) - end - end + attribute :id + attribute :token + attribute :username attribute :group do Group.fabricate! do |resource| @@ -24,11 +17,33 @@ module QA end end - attribute :project do - Project.fabricate! do |resource| - resource.name = 'project-to-deploy' - resource.description = 'project for adding deploy token test' - end + def fabricate_via_api! + super + end + + def api_get_path + "/groups/#{group.id}/deploy_tokens" + end + + def api_post_path + api_get_path + end + + def api_post_body + { + name: @name, + scopes: @scopes + } + end + + def api_delete_path + "/groups/#{group.id}/deploy_tokens/#{id}" + end + + def resource_web_url(resource) + super + rescue ResourceURLMissingError + # this particular resource does not expose a web_url property end def fabricate! diff --git a/qa/qa/resource/merge_request.rb b/qa/qa/resource/merge_request.rb index 1fea6feb910..ba63e0823f0 100644 --- a/qa/qa/resource/merge_request.rb +++ b/qa/qa/resource/merge_request.rb @@ -168,6 +168,41 @@ module QA ) end + # Object comparison + # + # @param [QA::Resource::MergeRequest] other + # @return [Boolean] + def ==(other) + other.is_a?(MergeRequest) && comparable_mr == other.comparable_mr + end + + # Override inspect for a better rspec failure diff output + # + # @return [String] + def inspect + JSON.pretty_generate(comparable_mr) + end + + protected + + # Return subset of fields for comparing merge requests + # + # @return [Hash] + def comparable_mr + reload! if api_response.nil? + + api_resource.except( + :id, + :web_url, + :project_id, + :source_project_id, + :target_project_id, + # these can differ depending on user fetching mr + :subscribed, + :first_contribution + ).merge({ references: api_resource[:references].except(:full) }) + end + private def transform_api_resource(api_resource) diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb index 864f3a14c3d..d3c1e91f358 100644 --- a/qa/qa/resource/project.rb +++ b/qa/qa/resource/project.rb @@ -217,10 +217,6 @@ module QA "#{api_get_path}/wikis" end - def api_push_rules_path - "#{api_get_path}/push_rule" - end - def api_post_body post_body = { name: name, @@ -242,8 +238,7 @@ module QA end def change_repository_storage(new_storage) - put_body = { repository_storage: new_storage } - response = put(request_url(api_put_path), put_body) + response = put(request_url(api_put_path), repository_storage: new_storage) unless response.code == HTTP_STATUS_OK raise( @@ -322,11 +317,19 @@ module QA auto_paginated_response(request_url(api_repository_branches_path, per_page: '100'), attempts: attempts) end + def create_repository_branch(branch_name, ref = default_branch) + api_post_to(api_repository_branches_path, branch: branch_name, ref: ref) + end + def repository_tags response = get(request_url(api_repository_tags_path)) parse_body(response) end + def create_repository_tag(tag_name, ref = default_branch) + api_post_to(api_repository_tags_path, tag_name: tag_name, ref: ref) + end + def repository_tree response = get(request_url(api_repository_tree_path)) parse_body(response) @@ -365,13 +368,8 @@ module QA parse_body(response) end - def push_rules - response = get(request_url(api_push_rules_path)) - parse_body(response) - end - - def add_push_rules(rules) - api_post_to(api_push_rules_path, rules) + def create_wiki_page(title:, content:) + api_post_to(api_wikis_path, title: title, content: content) end # Object comparison @@ -434,3 +432,5 @@ module QA end end end + +QA::Resource::Project.prepend_mod_with('Resource::Project', namespace: QA) diff --git a/qa/qa/resource/deploy_token.rb b/qa/qa/resource/project_deploy_token.rb index f5d3b87fc2b..b31a7c25157 100644 --- a/qa/qa/resource/deploy_token.rb +++ b/qa/qa/resource/project_deploy_token.rb @@ -2,25 +2,13 @@ module QA module Resource - class DeployToken < Base + class ProjectDeployToken < Base attr_accessor :name, :expires_at attr_writer :scopes - attribute :username do - Page::Project::Settings::Repository.perform do |repository_page| - repository_page.expand_deploy_tokens do |token| - token.token_username - end - end - end - - attribute :password do - Page::Project::Settings::Repository.perform do |repository_page| - repository_page.expand_deploy_tokens do |token| - token.token_password - end - end - end + attribute :id + attribute :token + attribute :username attribute :project do Project.fabricate! do |resource| @@ -29,6 +17,35 @@ module QA end end + def fabricate_via_api! + super + end + + def api_get_path + "/projects/#{project.id}/deploy_tokens" + end + + def api_post_path + api_get_path + end + + def api_post_body + { + name: @name, + scopes: @scopes + } + end + + def api_delete_path + "/projects/#{project.id}/deploy_tokens/#{id}" + end + + def resource_web_url(resource) + super + rescue ResourceURLMissingError + # this particular resource does not expose a web_url property + end + def fabricate! project.visit! diff --git a/qa/qa/resource/project_milestone.rb b/qa/qa/resource/project_milestone.rb index c9218e03e35..360e80e014c 100644 --- a/qa/qa/resource/project_milestone.rb +++ b/qa/qa/resource/project_milestone.rb @@ -20,6 +20,10 @@ module QA @description = "My awesome project milestone." end + def api_delete_path + "/projects/#{project.id}/milestones/#{id}" + end + def api_get_path "/projects/#{project.id}/milestones/#{id}" end diff --git a/qa/qa/resource/reusable.rb b/qa/qa/resource/reusable.rb new file mode 100644 index 00000000000..24b0a1f6bce --- /dev/null +++ b/qa/qa/resource/reusable.rb @@ -0,0 +1,63 @@ +# frozen_string_literal: true + +module QA + module Resource + # + # This module includes methods that allow resource classes to be reused safely. It should be prepended to a new + # reusable version of an existing resource class. See Resource::Project and ReusableResource::Project for an example + # + module Reusable + attr_accessor :reuse, + :reuse_as + + ResourceReuseError = Class.new(RuntimeError) + + def self.prepended(base) + base.extend(ClassMethods) + end + + # Gets an existing resource if it exists and the parameters of the new specification of the resource are valid. + # Creates a new instance of the resource if it does not exist. + # + # @return [String] The URL of the resource. + def fabricate_via_api! + validate_reuse_preconditions + + resource_web_url(api_get) + rescue Errors::ResourceNotFoundError + super + ensure + self.class.resources[reuse_as] = self + end + + # Including classes must confirm that the resource can be reused as defined. For example, a project can't be + # fabricated with a unique name. + # + # @return [nil] + def validate_reuse_preconditions + return super if defined?(super) + + raise NotImplementedError + end + + module ClassMethods + # Removes all created resources of this type. + # + # @return [Hash<Symbol, QA::Resource>] the resources that were to be removed. + def remove_all_via_api! + resources.each do |reuse_as, resource| + QA::Runtime::Logger.debug("#{self.name} - removing #{reuse_as}") + resource.method(:remove_via_api!).super_method.call + end + end + + # The resources created by this resource class. + # + # @return [Hash<Symbol, QA::Resource>] the resources created by this resource class. + def resources + @resources ||= {} + end + end + end + end +end diff --git a/qa/qa/resource/reusable_project.rb b/qa/qa/resource/reusable_project.rb new file mode 100644 index 00000000000..6b33bb9d65d --- /dev/null +++ b/qa/qa/resource/reusable_project.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +module QA + module Resource + class ReusableProject < Project + prepend Reusable + + def initialize + super + + @add_name_uuid = false + @name = "reusable_project" + @reuse_as = :default_project + @initialize_with_readme = true + end + + # Confirms that the project can be reused + # + # @return [nil] returns nil unless an error is raised + def validate_reuse_preconditions + unless reused_name_unique? + raise ResourceReuseError, + "Reusable projects must have the same name. The project reused as #{reuse_as} has the name '#{name}' but it should be '#{self.class.resources[reuse_as].name}'" + end + end + + # Checks if the project is being reused with the same name. + # + # @return [Boolean] true if the project's name is different from another project with the same reuse symbol (reuse_as) + def reused_name_unique? + return true unless self.class.resources.key?(reuse_as) + + self.class.resources[reuse_as].name == name + end + + # Overrides QA::Resource::Project#remove_via_api! to log a debug message stating that removal will happen after + # the suite completes rather than now. + # + # @return [nil] + def remove_via_api! + QA::Runtime::Logger.debug("#{self.class.name} - deferring removal until after suite") + end + end + end +end diff --git a/qa/qa/resource/runner.rb b/qa/qa/resource/runner.rb index 3c448816100..e69702a8ffa 100644 --- a/qa/qa/resource/runner.rb +++ b/qa/qa/resource/runner.rb @@ -19,7 +19,7 @@ module QA end def image - @image || 'gitlab/gitlab-runner:alpine' + @image || 'registry.gitlab.com/gitlab-org/gitlab-runner:alpine' end def executor diff --git a/qa/qa/resource/sandbox.rb b/qa/qa/resource/sandbox.rb index 385e0fa4f7e..555bfb1abc9 100644 --- a/qa/qa/resource/sandbox.rb +++ b/qa/qa/resource/sandbox.rb @@ -69,7 +69,8 @@ module QA { path: path, name: path, - visibility: 'public' + visibility: 'public', + avatar: avatar } end diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 163710a1510..b73199f1fdd 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -93,10 +93,6 @@ module QA ENV['CI'] || ENV['CI_SERVER'] end - def cluster_api_url - ENV['CLUSTER_API_URL'] - end - def qa_cookies ENV['QA_COOKIES'] && ENV['QA_COOKIES'].split(';') end @@ -285,6 +281,8 @@ module QA end def knapsack? + return false unless ENV['CI_NODE_TOTAL'].to_i > 1 + !!(ENV['KNAPSACK_GENERATE_REPORT'] || ENV['KNAPSACK_REPORT_PATH'] || ENV['KNAPSACK_TEST_FILE_PATTERN']) end diff --git a/qa/qa/scenario/test/integration/kubernetes.rb b/qa/qa/scenario/test/integration/kubernetes.rb deleted file mode 100644 index d82d0c09a90..00000000000 --- a/qa/qa/scenario/test/integration/kubernetes.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module QA - module Scenario - module Test - module Integration - class Kubernetes < Test::Instance::All - tags :kubernetes - end - end - end - end -end diff --git a/qa/qa/scenario/test/integration/service_ping_disabled.rb b/qa/qa/scenario/test/integration/service_ping_disabled.rb new file mode 100644 index 00000000000..7b646ce17ae --- /dev/null +++ b/qa/qa/scenario/test/integration/service_ping_disabled.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module QA + module Scenario + module Test + module Integration + ## + # Run test suite against any GitLab instance where Service Ping is disabled from gitlab.yml + # + class ServicePingDisabled < Test::Instance::All + tags :service_ping_disabled + end + end + end + end +end diff --git a/qa/qa/scenario/test/integration/ssh_tunnel.rb b/qa/qa/scenario/test/integration/ssh_tunnel.rb deleted file mode 100644 index 926dce1807e..00000000000 --- a/qa/qa/scenario/test/integration/ssh_tunnel.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module QA - module Scenario - module Test - module Integration - class SSHTunnel < Test::Instance::All - tags :ssh_tunnel - end - end - end - end -end diff --git a/qa/qa/service/kubernetes_cluster.rb b/qa/qa/service/kubernetes_cluster.rb index ec53b9d8163..dafce4acc33 100644 --- a/qa/qa/service/kubernetes_cluster.rb +++ b/qa/qa/service/kubernetes_cluster.rb @@ -77,7 +77,7 @@ module QA install_ingress # need to wait since the ingress-nginx service has an initial delay set of 10 seconds - sleep 10 + sleep 12 ingress_ip = `kubectl get svc --all-namespaces --no-headers=true -l app.kubernetes.io/name=ingress-nginx -o custom-columns=:'status.loadBalancer.ingress[0].ip' | grep -v 'none'` QA::Runtime::Logger.debug "Has ingress address set to: #{ingress_ip}" ingress_ip diff --git a/qa/qa/service/praefect_manager.rb b/qa/qa/service/praefect_manager.rb index dbb49f18881..dd4cce5d0b0 100644 --- a/qa/qa/service/praefect_manager.rb +++ b/qa/qa/service/praefect_manager.rb @@ -58,6 +58,7 @@ module QA def start_praefect start_node(@praefect) + wait_for_praefect end def stop_praefect @@ -176,6 +177,7 @@ module QA start_node(@primary_node) start_node(@secondary_node) start_node(@tertiary_node) + start_node(@praefect) wait_for_health_check_all_nodes wait_for_reliable_connection @@ -198,13 +200,13 @@ module QA retry_on_exception: true ) - # Praefect can fail to start if unable to dial one of the gitaly nodes - # See https://gitlab.com/gitlab-org/gitaly/-/issues/2847 - # We tail the logs to allow us to confirm if that is the problem if tests fail + QA::Runtime::Logger.info('Wait until Praefect starts and is listening') + wait_until_shell_command_matches( + "docker exec #{@praefect} bash -c 'cat /var/log/gitlab/praefect/current'", + /listening at tcp address/ + ) - shell "docker exec #{@praefect} bash -c 'tail /var/log/gitlab/praefect/current'" do |line| - QA::Runtime::Logger.debug(line.chomp) - end + wait_for_gitaly_check end def wait_for_sql_ping @@ -244,7 +246,7 @@ module QA def wait_for_storage_nodes wait_for_no_praefect_storage_error - Support::Waiter.repeat_until(max_attempts: 3) do + Support::Waiter.repeat_until(max_attempts: 3, max_duration: 120, sleep_interval: 1) do nodes_confirmed = { @primary_node => false, @secondary_node => false, @@ -304,7 +306,7 @@ module QA end def wait_until_node_is_removed_from_healthy_storages(node) - Support::Waiter.wait_until(max_duration: 60, sleep_interval: 3, raise_on_failure: false) do + Support::Waiter.wait_until(max_duration: 120, sleep_interval: 1, raise_on_failure: true) do result = [] shell sql_to_docker_exec_cmd("SELECT count(*) FROM healthy_storages WHERE storage = '#{node}';") do |line| result << line @@ -315,7 +317,7 @@ module QA end def wait_until_node_is_marked_as_healthy_storage(node) - Support::Waiter.wait_until(max_duration: 60, sleep_interval: 3, raise_on_failure: false) do + Support::Waiter.wait_until(max_duration: 120, sleep_interval: 1, raise_on_failure: true) do result = [] shell sql_to_docker_exec_cmd("SELECT count(*) FROM healthy_storages WHERE storage = '#{node}';") do |line| result << line @@ -327,17 +329,10 @@ module QA end def wait_for_gitaly_check - Support::Waiter.repeat_until(max_attempts: 3) do - storage_ok = false - check_finished = false - - wait_until_shell_command("docker exec #{@gitlab} bash -c 'gitlab-rake gitlab:gitaly:check'") do |line| + Support::Waiter.wait_until(max_duration: 120, sleep_interval: 1, raise_on_failure: true) do + wait_until_shell_command("docker exec #{@gitlab} bash -c 'gitlab-rake gitlab:git:fsck'") do |line| QA::Runtime::Logger.debug(line.chomp) - - storage_ok = true if line =~ /Gitaly: ... #{@virtual_storage} ... OK/ - check_finished = true if line =~ /Checking Gitaly ... Finished/ - - storage_ok && check_finished + line.include?('Done') end end end @@ -347,7 +342,7 @@ module QA # has no pre-read data, consider it to have had zero reads. def wait_for_read_count_change(pre_read_data) diff_found = false - Support::Waiter.wait_until(sleep_interval: 5) do + Support::Waiter.wait_until(sleep_interval: 1, max_duration: 60) do query_read_distribution.each_with_index do |data, index| diff_found = true if data[:value] > value_for_node(pre_read_data, data[:node]) end @@ -361,10 +356,8 @@ module QA def wait_for_reliable_connection QA::Runtime::Logger.info('Wait until GitLab and Praefect can communicate reliably') - wait_for_praefect wait_for_sql_ping wait_for_storage_nodes - wait_for_gitaly_check end def wait_for_replication(project_id) @@ -400,20 +393,15 @@ module QA def list_untracked_repositories untracked_repositories = [] shell "docker exec #{@praefect} bash -c 'gitlab-ctl praefect list-untracked-repositories'" do |line| - # Results look like this depending on whether untracked items found or not - # Running list-untracked-repositories - # Done. - - # Running list-untracked-repositories + # Results look like this + # The following repositories were found on disk, but missing from the tracking database: # {"relative_path":"@hashed/aa/bb.git","storage":"gitaly1","virtual_storage":"default"} # {"relative_path":"@hashed/bb/cc.git","storage":"gitaly3","virtual_storage":"default"} - # Done. QA::Runtime::Logger.debug(line.chomp) - next if line.start_with?('Running list-untracked-repositories') - next if line.start_with?('Done.') - untracked_repositories.append(JSON.parse(line)) + rescue JSON::ParserError + # Ignore lines that can't be parsed as JSON end QA::Runtime::Logger.debug("list_untracked_repositories --- #{untracked_repositories}") diff --git a/qa/qa/specs/features/api/1_manage/bulk_import_group_spec.rb b/qa/qa/specs/features/api/1_manage/bulk_import_group_spec.rb index 158881ed94c..799a5f7eaf2 100644 --- a/qa/qa/specs/features/api/1_manage/bulk_import_group_spec.rb +++ b/qa/qa/specs/features/api/1_manage/bulk_import_group_spec.rb @@ -4,7 +4,7 @@ module QA # run only base UI validation on staging because test requires top level group creation which is problematic # on staging environment RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do - describe 'Bulk group import' do + describe 'Gitlab migration' do let(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } } let(:admin_api_client) { Runtime::API::Client.as_admin } let(:user) do @@ -26,6 +26,7 @@ module QA Resource::Sandbox.fabricate_via_api! do |group| group.api_client = api_client group.path = "source-group-for-import-#{SecureRandom.hex(4)}" + group.avatar = File.new('qa/fixtures/designs/tanuki.jpg', 'r') end end @@ -37,11 +38,19 @@ module QA end end + let(:import_failures) do + imported_group.import_details.sum([]) { |details| details[:failures] } + end + before do sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER) end - after do + after do |example| + # Checking for failures in the test currently makes test very flaky due to catching unrelated failures + # Just log in case of failure until cause of network errors is found + # See: https://gitlab.com/gitlab-org/gitlab/-/issues/346500 + Runtime::Logger.warn(import_failures) if example.exception && !import_failures.empty? user.remove_via_api! end @@ -73,11 +82,13 @@ module QA label.group = subgroup label.title = "subgroup-#{SecureRandom.hex(4)}" end + + imported_group # trigger import end it( 'successfully imports groups and labels', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1873' + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347674' ) do expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration) @@ -108,11 +119,13 @@ module QA badge.link_url = "http://example.com/badge" badge.image_url = "http://shields.io/badge" end + + imported_group # trigger import end it( 'successfully imports group milestones and badges', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2245' + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347628' ) do expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration) @@ -139,6 +152,8 @@ module QA before do member.set_public_email source_group.add_member(member, Resource::Members::AccessLevel::DEVELOPER) + + imported_group # trigger import end after do @@ -147,14 +162,16 @@ module QA it( 'adds members for imported group', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2310' + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347609' ) do expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration) imported_member = imported_group.reload!.members.find { |usr| usr.username == member.username } - expect(imported_member).not_to be_nil - expect(imported_member.access_level).to eq(Resource::Members::AccessLevel::DEVELOPER) + aggregate_failures do + expect(imported_member).not_to be_nil + expect(imported_member.access_level).to eq(Resource::Members::AccessLevel::DEVELOPER) + end end end end diff --git a/qa/qa/specs/features/api/1_manage/bulk_import_project_spec.rb b/qa/qa/specs/features/api/1_manage/bulk_import_project_spec.rb deleted file mode 100644 index 14c94e99446..00000000000 --- a/qa/qa/specs/features/api/1_manage/bulk_import_project_spec.rb +++ /dev/null @@ -1,134 +0,0 @@ -# frozen_string_literal: true - -module QA - # run only base UI validation on staging because test requires top level group creation which is problematic - # on staging environment - RSpec.describe 'Manage', :requires_admin, except: { subdomain: :staging } do - describe 'Bulk project import' do - let(:import_wait_duration) { { max_duration: 300, sleep_interval: 2 } } - let(:admin_api_client) { Runtime::API::Client.as_admin } - let(:user) do - Resource::User.fabricate_via_api! do |usr| - usr.api_client = admin_api_client - usr.hard_delete_on_api_removal = true - end - end - - let(:api_client) { Runtime::API::Client.new(user: user) } - - let(:sandbox) do - Resource::Sandbox.fabricate_via_api! do |group| - group.api_client = admin_api_client - end - end - - let(:source_group) do - Resource::Sandbox.fabricate_via_api! do |group| - group.api_client = api_client - group.path = "source-group-for-import-#{SecureRandom.hex(4)}" - end - end - - let(:source_project) do - Resource::Project.fabricate_via_api! do |project| - project.api_client = api_client - project.group = source_group - project.initialize_with_readme = true - end - end - - let(:imported_group) do - Resource::BulkImportGroup.fabricate_via_api! do |group| - group.api_client = api_client - group.sandbox = sandbox - group.source_group_path = source_group.path - end - end - - let(:imported_projects) do - imported_group.reload!.projects - end - - let(:project_import_failures) do - imported_group.import_details - .find { |entity| entity[:destination_name] == source_project.name } - &.fetch(:failures) - end - - before do - Runtime::Feature.enable(:bulk_import_projects) - - sandbox.add_member(user, Resource::Members::AccessLevel::MAINTAINER) - - source_project.tap { |project| project.add_push_rules(member_check: true) } # fabricate source group and project - end - - after do - user.remove_via_api! - ensure - Runtime::Feature.disable(:bulk_import_projects) - end - - context 'with project' do - before do - imported_group # trigger import - end - - it( - 'successfully imports project', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2297' - ) do - expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration) - expect(imported_projects.count).to eq(1), "Expected to have 1 imported project" - - aggregate_failures do - expect(imported_projects.first).to eq(source_project) - expect(project_import_failures).to be_empty, "Expected no errors, was: #{project_import_failures}" - end - end - end - - context 'with project issues' do - let(:source_issue) do - Resource::Issue.fabricate_via_api! do |issue| - issue.api_client = api_client - issue.project = source_project - issue.labels = %w[label_one label_two] - end - end - - let(:imported_issues) do - imported_projects.first.issues - end - - let(:imported_issue) do - issue = imported_issues.first - Resource::Issue.init do |resource| - resource.api_client = api_client - resource.project = imported_projects.first - resource.iid = issue[:iid] - end - end - - before do - source_issue # fabricate source group, project, issue - imported_group # trigger import - end - - it( - 'successfully imports issue', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2325' - ) do - expect { imported_group.import_status }.to eventually_eq('finished').within(import_wait_duration) - expect(imported_projects.count).to eq(1), "Expected to have 1 imported project" - - aggregate_failures do - expect(imported_issues.count).to eq(1) - expect(imported_issue.reload!).to eq(source_issue) - expect(project_import_failures).to be_empty, "Expected no errors, was: #{project_import_failures}" - end - end - end - end - end -end diff --git a/qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb b/qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb index 744f39525b9..4bc95395f25 100644 --- a/qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb +++ b/qa/qa/specs/features/api/1_manage/import_github_repo_spec.rb @@ -30,7 +30,7 @@ module QA user.remove_via_api! end - it 'imports Github repo via api', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1878' do + it 'imports Github repo via api', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347670' do imported_project # import the project expect { imported_project.reload!.import_status }.to eventually_eq('finished').within(max_duration: 90) diff --git a/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb b/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb index 3a2f960d812..c46de0ac514 100644 --- a/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb +++ b/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb @@ -121,7 +121,7 @@ module QA it( 'imports large Github repo via api', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1880' + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347668' ) do start = Time.now 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 47c07875257..13a795ca976 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 @@ -4,17 +4,20 @@ module QA RSpec.describe 'Manage' do describe 'Project access token' do before(:all) do - @project_access_token = QA::Resource::ProjectAccessToken.fabricate_via_api! + @project_access_token = QA::Resource::ProjectAccessToken.fabricate_via_api! do |pat| + pat.project = Resource::ReusableProject.fabricate_via_api! + 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', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1823' 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 file.project = @project_access_token.project - file.branch = 'new_branch' + file.branch = "new_branch_#{SecureRandom.hex(8)}" file.commit_message = 'Add new file' file.name = "text-#{SecureRandom.hex(8)}.txt" file.content = 'New file' @@ -22,12 +25,12 @@ module QA end.not_to raise_error end - it 'can be used to commit via the API', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1822' do + it 'can be used to commit via the API', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347859' do expect do Resource::Repository::Commit.fabricate_via_api! do |commit| commit.api_client = @user_api_client commit.project = @project_access_token.project - commit.branch = 'new_branch' + commit.branch = "new_branch_#{SecureRandom.hex(8)}" commit.start_branch = @project_access_token.project.default_branch commit.commit_message = 'Add new file' commit.add_files([ @@ -43,12 +46,12 @@ module QA @different_project = Resource::Project.fabricate! end - it 'cannot be used to create a file via the project API', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1821' 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 file.project = @different_project - file.branch = 'new_branch' + file.branch = "new_branch_#{SecureRandom.hex(8)}" file.commit_message = 'Add new file' file.name = "text-#{SecureRandom.hex(8)}.txt" file.content = 'New file' @@ -56,12 +59,12 @@ module QA end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError, /403 Forbidden/) end - it 'cannot be used to commit via the API', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1820' 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 commit.project = @different_project - commit.branch = 'new_branch' + commit.branch = "new_branch_#{SecureRandom.hex(8)}" commit.start_branch = @different_project.default_branch commit.commit_message = 'Add new file' commit.add_files([ diff --git a/qa/qa/specs/features/api/1_manage/rate_limits_spec.rb b/qa/qa/specs/features/api/1_manage/rate_limits_spec.rb index 9eb1bd985ea..17ffb901e5a 100644 --- a/qa/qa/specs/features/api/1_manage/rate_limits_spec.rb +++ b/qa/qa/specs/features/api/1_manage/rate_limits_spec.rb @@ -8,7 +8,7 @@ module QA let(:api_client) { Runtime::API::Client.new(:gitlab, ip_limits: true) } let(:request) { Runtime::API::Request.new(api_client, '/users') } - it 'GET /users', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1567' do + it 'GET /users', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347881' do 5.times do get request.url expect_status(200) diff --git a/qa/qa/specs/features/api/1_manage/user_access_termination_spec.rb b/qa/qa/specs/features/api/1_manage/user_access_termination_spec.rb index a149c42877f..e47e5d22e5e 100644 --- a/qa/qa/specs/features/api/1_manage/user_access_termination_spec.rb +++ b/qa/qa/specs/features/api/1_manage/user_access_termination_spec.rb @@ -30,7 +30,7 @@ module QA @group.sandbox.remove_member(@user) end - it 'is not allowed to push code via the CLI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1712' do + it 'is not allowed to push code via the CLI', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347863' do expect do Resource::Repository::Push.fabricate! do |push| push.repository_http_uri = @project.repository_http_location.uri @@ -43,7 +43,7 @@ module QA end.to raise_error(QA::Support::Run::CommandError, /You are not allowed to push code to this project/) end - it 'is not allowed to create a file via the API', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1711' do + it 'is not allowed to create a file via the API', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347864' do expect do Resource::File.fabricate_via_api! do |file| file.api_client = @user_api_client @@ -56,7 +56,7 @@ module QA end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError, /403 Forbidden/) end - it 'is not allowed to commit via the API', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1710' do + it 'is not allowed to commit via the API', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347865' 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/users_spec.rb b/qa/qa/specs/features/api/1_manage/users_spec.rb index b705ce9e174..53587209bfb 100644 --- a/qa/qa/specs/features/api/1_manage/users_spec.rb +++ b/qa/qa/specs/features/api/1_manage/users_spec.rb @@ -8,13 +8,13 @@ module QA let(:api_client) { Runtime::API::Client.new(:gitlab) } let(:request) { Runtime::API::Request.new(api_client, '/users') } - it 'GET /users', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1552' do + it 'GET /users', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347882' do get request.url expect_status(200) end - it 'GET /users/:username with a valid username', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1544' do + it 'GET /users/:username with a valid username', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347886' do get request.url, { params: { username: Runtime::User.username } } expect_status(200) @@ -23,7 +23,7 @@ module QA ) end - it 'GET /users/:username with an invalid username', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1551' do + it 'GET /users/:username with an invalid username', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347883' do get request.url, { params: { username: SecureRandom.hex(10) } } expect_status(200) diff --git a/qa/qa/specs/features/api/2_plan/closes_issue_via_pushing_a_commit_spec.rb b/qa/qa/specs/features/api/2_plan/closes_issue_via_pushing_a_commit_spec.rb index dabd97d69d0..073669f033c 100644 --- a/qa/qa/specs/features/api/2_plan/closes_issue_via_pushing_a_commit_spec.rb +++ b/qa/qa/specs/features/api/2_plan/closes_issue_via_pushing_a_commit_spec.rb @@ -22,7 +22,7 @@ module QA push_commit('Initial commit') end - it 'closes via pushing a commit', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1579' do + it 'closes via pushing a commit', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347947' do push_commit("Closes ##{issue_id}", false) Support::Retrier.retry_until(max_duration: 10, sleep_interval: 1) do diff --git a/qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb index b85a0116f01..51927a30987 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/automatic_failover_and_recovery_spec.rb @@ -22,13 +22,11 @@ module QA end end - after(:context, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/238187', type: :stale }) do - # Leave the cluster in a suitable state for subsequent tests, - # if there was a problem during the tests here + after do praefect_manager.start_all_nodes end - it 'automatically fails over', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1267' do + it 'automatically fails over', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347830' do # Create a new project with a commit and wait for it to replicate # make sure that our project is published to the 'primary' node @@ -44,10 +42,7 @@ module QA push.file_content = "This should exist on all nodes" end - praefect_manager.start_secondary_node - praefect_manager.start_tertiary_node - praefect_manager.wait_for_health_check_all_nodes - + praefect_manager.start_all_nodes praefect_manager.wait_for_replication(project.id) # Stop the primary node to trigger failover, and then wait @@ -76,7 +71,7 @@ module QA end context 'when recovering from dataloss after failover' do - it 'automatically reconciles', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/238187', type: :stale }, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1266' do + it 'automatically reconciles', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347831' do # Start the old primary node again praefect_manager.start_primary_node praefect_manager.wait_for_primary_node_health_check diff --git a/qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb index 62437598f3b..25e860b4f6d 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb @@ -22,14 +22,14 @@ module QA praefect_manager.start_all_nodes end - it 'recovers from dataloss', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1265' do + it 'recovers from dataloss', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347832' do # Create a new project with a commit and wait for it to replicate praefect_manager.wait_for_replication(project.id) # Stop the primary node to trigger failover, and then wait # for Gitaly to be ready for writes again praefect_manager.stop_primary_node - praefect_manager.wait_for_gitaly_check + praefect_manager.wait_for_primary_node_health_check_failure # Push a commit to the new primary Resource::Repository::ProjectPush.fabricate! do |push| diff --git a/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb index a4251475e97..624ddbb68e1 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb @@ -24,7 +24,7 @@ module QA end end - context 'when moving from one Gitaly storage to another', :orchestrated, :repository_storage, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1270' do + context 'when moving from one Gitaly storage to another', :orchestrated, :repository_storage, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347827' do let(:source_storage) { { type: :gitaly, name: 'default' } } let(:destination_storage) { { type: :gitaly, name: QA::Runtime::Env.additional_repository_storage } } let(:project) do @@ -45,7 +45,7 @@ module QA # Note: This test doesn't have the :orchestrated tag because it runs in the Test::Integration::Praefect # scenario with other tests that aren't considered orchestrated. # It also runs on staging using nfs-file07 as non-cluster storage and nfs-file22 as cluster/praefect storage - context 'when moving from Gitaly to Gitaly Cluster', :requires_praefect, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1269', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/284645', type: :investigating } do + context 'when moving from Gitaly to Gitaly Cluster', :requires_praefect, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347828', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/284645', type: :investigating } do let(:source_storage) { { type: :gitaly, name: QA::Runtime::Env.non_cluster_repository_storage } } let(:destination_storage) { { type: :praefect, name: QA::Runtime::Env.praefect_repository_storage } } let(:project) do diff --git a/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb index dfc2de02bf0..150378016e1 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb @@ -25,7 +25,7 @@ module QA praefect_manager.start_all_nodes end - it 'reads from each node', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1264' do + it 'reads from each node', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347833' do pre_read_data = praefect_manager.query_read_distribution wait_for_reads_to_increase(project, number_of_reads_per_loop, pre_read_data) @@ -42,6 +42,7 @@ module QA context 'when a node is unhealthy' do before do + praefect_manager.start_all_nodes praefect_manager.stop_secondary_node praefect_manager.wait_for_secondary_node_health_check_failure end @@ -51,7 +52,7 @@ module QA praefect_manager.start_all_nodes end - it 'does not read from the unhealthy node', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1263' do + it 'does not read from the unhealthy node', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347834' do pre_read_data = praefect_manager.query_read_distribution read_from_project(project, number_of_reads_per_loop * 10) diff --git a/qa/qa/specs/features/api/3_create/gitaly/gitaly_mtls_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/gitaly_mtls_spec.rb index 237b8055d94..5000c273578 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/gitaly_mtls_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/gitaly_mtls_spec.rb @@ -8,7 +8,7 @@ module QA let(:first_added_commit_message) { 'commit over git' } let(:second_added_commit_message) { 'commit over api' } - it 'pushes to gitaly', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1843' do + it 'pushes to gitaly', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347677' do project = Resource::Project.fabricate! do |project| project.name = "mTLS" project.initialize_with_readme = true diff --git a/qa/qa/specs/features/api/3_create/gitaly/praefect_replication_queue_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/praefect_replication_queue_spec.rb index cd60f3fdf7c..e7e23124312 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/praefect_replication_queue_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/praefect_replication_queue_spec.rb @@ -4,7 +4,7 @@ require 'parallel' module QA RSpec.describe 'Create' do - context 'Gitaly Cluster replication queue', :orchestrated, :gitaly_cluster, :skip_live_env do + context 'Gitaly Cluster replication queue', :orchestrated, :gitaly_cluster, :skip_live_env, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/346453', type: :flaky } do let(:praefect_manager) { Service::PraefectManager.new } let(:project) do Resource::Project.fabricate! do |project| @@ -13,13 +13,18 @@ module QA end end + before do + praefect_manager.start_all_nodes + praefect_manager.start_praefect + end + after do + praefect_manager.start_all_nodes praefect_manager.start_praefect - praefect_manager.wait_for_reliable_connection praefect_manager.clear_replication_queue end - it 'allows replication of different repository after interruption', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1268' do + it 'allows replication of different repository after interruption', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347829' do # We want to fill the replication queue with 10 `in_progress` jobs, # while a lock has been acquired, which is when the problem occurred # as reported in https://gitlab.com/gitlab-org/gitaly/-/issues/2801 @@ -51,7 +56,6 @@ module QA praefect_manager.create_stalled_replication_queue praefect_manager.start_praefect - praefect_manager.wait_for_reliable_connection # Create a new project, push to it, and check that replication occurs project_push = Resource::Repository::ProjectPush.fabricate! do |push| diff --git a/qa/qa/specs/features/api/3_create/gitaly/praefect_repo_sync_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/praefect_repo_sync_spec.rb index 07ea7971396..cc49e408954 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/praefect_repo_sync_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/praefect_repo_sync_spec.rb @@ -2,25 +2,27 @@ module QA RSpec.describe 'Create' do - context 'Praefect repository commands', :orchestrated, :gitaly_cluster do + context 'Praefect repository commands', :orchestrated, :gitaly_cluster, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/347415', type: :investigating } do let(:praefect_manager) { Service::PraefectManager.new } let(:repo1) { { "relative_path" => "@hashed/repo1.git", "storage" => "gitaly1", "virtual_storage" => "default" } } let(:repo2) { { "relative_path" => "@hashed/path/to/repo2.git", "storage" => "gitaly3", "virtual_storage" => "default" } } before do + praefect_manager.start_all_nodes praefect_manager.add_repo_to_disk(praefect_manager.primary_node, repo1["relative_path"]) praefect_manager.add_repo_to_disk(praefect_manager.tertiary_node, repo2["relative_path"]) end after do + praefect_manager.start_all_nodes praefect_manager.remove_repo_from_disk(repo1["relative_path"]) praefect_manager.remove_repo_from_disk(repo2["relative_path"]) praefect_manager.remove_repository_from_praefect_database(repo1["relative_path"]) praefect_manager.remove_repository_from_praefect_database(repo2["relative_path"]) end - it 'allows admin to manage difference between praefect database and disk state', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2344' do + it 'allows admin to manage difference between praefect database and disk state', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347606' do # Some repos are on disk that praefect is not aware of untracked_repositories = praefect_manager.list_untracked_repositories expect(untracked_repositories).to include(repo1) 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 26ca6de29f7..ab9af872753 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 @@ -11,12 +11,7 @@ module QA let(:title) { "MR push options test #{SecureRandom.hex(8)}" } let(:commit_message) { 'Add README.md' } - let(:project) do - Resource::Project.fabricate_via_api! do |project| - project.name = 'merge-request-push-options' - project.initialize_with_readme = true - end - end + let(:project) { Resource::ReusableProject.fabricate_via_api! } def create_new_mr_via_push Resource::Repository::ProjectPush.fabricate! do |push| @@ -31,7 +26,7 @@ module QA end end - it 'sets labels', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1244' do + it 'sets labels', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347839' do create_new_mr_via_push merge_request = project.merge_request_with_title(title) @@ -45,7 +40,7 @@ module QA create_new_mr_via_push end - it 'removes them on subsequent push', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1243' do + it 'removes them on subsequent push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347840' do Resource::Repository::ProjectPush.fabricate! do |push| push.project = project push.file_content = "Unlabel test #{SecureRandom.hex(8)}" diff --git a/qa/qa/specs/features/api/3_create/merge_request/push_options_mwps_spec.rb b/qa/qa/specs/features/api/3_create/merge_request/push_options_mwps_spec.rb index 164507d8fca..83dcb163d56 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 @@ -25,11 +25,12 @@ module QA end end - after do + after do |example| runner.remove_via_api! + project.remove_via_api! unless example.exception end - it 'sets merge when pipeline succeeds', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1240' do + it 'sets merge when pipeline succeeds', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347843' do Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = project commit.commit_message = 'Add .gitlab-ci.yml' @@ -72,7 +73,7 @@ module QA expect(merge_request.merge_when_pipeline_succeeds).to be true end - it 'merges when pipeline succeeds', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1241' do + it 'merges when pipeline succeeds', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347842' do Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = project commit.commit_message = 'Add .gitlab-ci.yml' @@ -106,15 +107,22 @@ module QA expect(merge_request).not_to be_nil, "There was a problem creating the merge request" expect(merge_request[:merge_when_pipeline_succeeds]).to be true - merge_request = Support::Waiter.wait_until(sleep_interval: 5) do - mr = Resource::MergeRequest.fabricate_via_api! do |mr| - mr.project = project - mr.iid = merge_request[:iid] - end + mr = nil + begin + merge_request = Support::Retrier.retry_until(max_duration: 60, sleep_interval: 5, message: 'The merge request was not merged') do + mr = Resource::MergeRequest.fabricate_via_api! do |mr| + mr.project = project + mr.iid = merge_request[:iid] + end + + next unless mr.state == 'merged' - next unless mr.state == 'merged' + mr + end + rescue Support::Repeater::WaitExceededError + QA::Runtime::Logger.debug("MR: #{mr.api_response}") - mr + raise end expect(merge_request.state).to eq('merged') diff --git a/qa/qa/specs/features/api/3_create/merge_request/push_options_remove_source_branch_spec.rb b/qa/qa/specs/features/api/3_create/merge_request/push_options_remove_source_branch_spec.rb index 32c7196e9fb..708dd7aa8af 100644 --- a/qa/qa/specs/features/api/3_create/merge_request/push_options_remove_source_branch_spec.rb +++ b/qa/qa/specs/features/api/3_create/merge_request/push_options_remove_source_branch_spec.rb @@ -17,7 +17,7 @@ module QA end end - it 'removes the source branch', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1242' do + it 'removes the source branch', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347841' do Resource::Repository::ProjectPush.fabricate! do |push| push.project = project push.branch_name = branch diff --git a/qa/qa/specs/features/api/3_create/merge_request/push_options_target_branch_spec.rb b/qa/qa/specs/features/api/3_create/merge_request/push_options_target_branch_spec.rb index b0e616c2d1d..97d461c5113 100644 --- a/qa/qa/specs/features/api/3_create/merge_request/push_options_target_branch_spec.rb +++ b/qa/qa/specs/features/api/3_create/merge_request/push_options_target_branch_spec.rb @@ -16,7 +16,7 @@ module QA end end - it 'sets a target branch', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1646' do + it 'sets a target branch', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347726' do target_branch = "push-options-test-target-#{SecureRandom.hex(8)}" Resource::Repository::ProjectPush.fabricate! do |push| diff --git a/qa/qa/specs/features/api/3_create/merge_request/push_options_title_description_spec.rb b/qa/qa/specs/features/api/3_create/merge_request/push_options_title_description_spec.rb index c898646c0de..9d534e9ea6b 100644 --- a/qa/qa/specs/features/api/3_create/merge_request/push_options_title_description_spec.rb +++ b/qa/qa/specs/features/api/3_create/merge_request/push_options_title_description_spec.rb @@ -14,7 +14,7 @@ module QA end end - it 'sets title and description', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1239' do + it 'sets title and description', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347844' do description = "This is a test of MR push options" title = "MR push options test #{SecureRandom.hex(8)}" diff --git a/qa/qa/specs/features/api/3_create/repository/default_branch_name_setting_spec.rb b/qa/qa/specs/features/api/3_create/repository/default_branch_name_setting_spec.rb index b2a184c2374..cba563ef85a 100644 --- a/qa/qa/specs/features/api/3_create/repository/default_branch_name_setting_spec.rb +++ b/qa/qa/specs/features/api/3_create/repository/default_branch_name_setting_spec.rb @@ -11,7 +11,7 @@ module QA Runtime::ApplicationSettings.restore_application_settings(:default_branch_name) end - it 'sets the default branch name for a new project', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1247' do + it 'sets the default branch name for a new project', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347837' do project = Resource::Project.fabricate_via_api! do |project| project.name = "default-branch-name" project.initialize_with_readme = true @@ -30,7 +30,7 @@ module QA end end - it 'allows a project to be created via the CLI with a different default branch name', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1246' do + it 'allows a project to be created via the CLI with a different default branch name', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347838' do project_name = "default-branch-name-via-cli-#{SecureRandom.hex(8)}" group = Resource::Group.fabricate_via_api! diff --git a/qa/qa/specs/features/api/3_create/repository/files_spec.rb b/qa/qa/specs/features/api/3_create/repository/files_spec.rb index 4141b4343a0..48608094f5e 100644 --- a/qa/qa/specs/features/api/3_create/repository/files_spec.rb +++ b/qa/qa/specs/features/api/3_create/repository/files_spec.rb @@ -11,7 +11,7 @@ module QA let(:project_name) { "api-basics-#{SecureRandom.hex(8)}" } let(:sanitized_project_path) { CGI.escape("#{Runtime::User.username}/#{project_name}") } - it 'user creates a project with a file and deletes them afterwards', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1581' do + it 'user creates a project with a file and deletes them afterwards', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347745' do create_project_request = Runtime::API::Request.new(@api_client, '/projects') post create_project_request.url, path: project_name, name: project_name @@ -77,7 +77,7 @@ module QA SVG end - it 'sets no-cache headers as expected', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1580' do + it 'sets no-cache headers as expected', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347746' do create_project_request = Runtime::API::Request.new(@api_client, '/projects') post create_project_request.url, path: project_name, name: project_name diff --git a/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb b/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb index db75d4639ff..6f175272d91 100644 --- a/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb +++ b/qa/qa/specs/features/api/3_create/repository/project_archive_compare_spec.rb @@ -27,7 +27,7 @@ module QA end end - it 'download archives of each user project then check they are different', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1575' do + it 'download archives of each user project then check they are different', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347748' do archive_checksums = {} users.each do |user_key, user_info| diff --git a/qa/qa/specs/features/api/3_create/repository/push_postreceive_idempotent_spec.rb b/qa/qa/specs/features/api/3_create/repository/push_postreceive_idempotent_spec.rb index 34254d579cb..1a2a1679cca 100644 --- a/qa/qa/specs/features/api/3_create/repository/push_postreceive_idempotent_spec.rb +++ b/qa/qa/specs/features/api/3_create/repository/push_postreceive_idempotent_spec.rb @@ -17,11 +17,11 @@ module QA project&.remove_via_api! end - it 'pushes and creates a single push event three times', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1840' do + it 'pushes and creates a single push event three times', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347680' do verify_single_event_per_push(repeat: 3) end - it 'repeatedly pushes and creates a single push event several times', :transient, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1915' do + it 'repeatedly pushes and creates a single push event several times', :transient, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347642' do verify_single_event_per_push(repeat: Runtime::Env.transient_trials) do |i| QA::Runtime::Logger.info("Transient bug test action - Trial #{i}") end diff --git a/qa/qa/specs/features/api/3_create/snippet/snippet_repository_storage_move_spec.rb b/qa/qa/specs/features/api/3_create/snippet/snippet_repository_storage_move_spec.rb index 4b0dc9d431b..bfa408e1c92 100644 --- a/qa/qa/specs/features/api/3_create/snippet/snippet_repository_storage_move_spec.rb +++ b/qa/qa/specs/features/api/3_create/snippet/snippet_repository_storage_move_spec.rb @@ -21,7 +21,7 @@ module QA praefect_manager.gitlab = 'gitlab' end - it 'moves snippet repository from one Gitaly storage to another', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1912' do + it 'moves snippet repository from one Gitaly storage to another', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347645' do expect(snippet).to have_file('original_file') expect { snippet.change_repository_storage(destination_storage[:name]) }.not_to raise_error expect { praefect_manager.verify_storage_move(source_storage, destination_storage, repo_type: :snippet) }.not_to raise_error diff --git a/qa/qa/specs/features/api/4_verify/cancel_pipeline_when_block_user_spec.rb b/qa/qa/specs/features/api/4_verify/cancel_pipeline_when_block_user_spec.rb index 5d153e7736a..7c3fb9ebeba 100644 --- a/qa/qa/specs/features/api/4_verify/cancel_pipeline_when_block_user_spec.rb +++ b/qa/qa/specs/features/api/4_verify/cancel_pipeline_when_block_user_spec.rb @@ -34,7 +34,7 @@ module QA project.remove_via_api! end - it 'pipeline schedule is canceled', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1825' do + it 'pipeline schedule is canceled', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347999' do user.block! expect(pipeline_schedule[:active]).not_to be_truthy, "Expected schedule active state to be false - active state #{pipeline_schedule[:active]}" diff --git a/qa/qa/specs/features/api/5_package/container_registry_spec.rb b/qa/qa/specs/features/api/5_package/container_registry_spec.rb index 5847ffa1419..3a1a3ff7169 100644 --- a/qa/qa/specs/features/api/5_package/container_registry_spec.rb +++ b/qa/qa/specs/features/api/5_package/container_registry_spec.rb @@ -72,15 +72,17 @@ module QA registry&.remove_via_api! end - it 'pushes, pulls image to the registry and deletes image blob, manifest and tag', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1819' do - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.api_client = api_client - commit.commit_message = 'Add .gitlab-ci.yml' - commit.project = project - commit.add_files([{ - file_path: '.gitlab-ci.yml', - content: gitlab_ci_yaml - }]) + it 'pushes, pulls image to the registry and deletes image blob, manifest and tag', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348001' do + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.api_client = api_client + commit.commit_message = 'Add .gitlab-ci.yml' + commit.project = project + commit.add_files([{ + file_path: '.gitlab-ci.yml', + content: gitlab_ci_yaml + }]) + end end Support::Waiter.wait_until(max_duration: 10) { pipeline_is_triggered? } diff --git a/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb b/qa/qa/specs/features/browser_ui/14_non_devops/performance_bar_spec.rb index 9d84658da76..829d52b8e93 100644 --- a/qa/qa/specs/features/browser_ui/non_devops/performance_bar_spec.rb +++ b/qa/qa/specs/features/browser_ui/14_non_devops/performance_bar_spec.rb @@ -20,7 +20,7 @@ module QA end end - it 'shows results for the original request and AJAX requests', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1545' do + it 'shows results for the original request and AJAX requests', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348030' do # Issue pages always make AJAX requests Resource::Issue.fabricate_via_browser_ui! do |issue| issue.title = 'Performance bar test' diff --git a/qa/qa/specs/features/browser_ui/14_non_devops/service_ping_default_enabled_spec.rb b/qa/qa/specs/features/browser_ui/14_non_devops/service_ping_default_enabled_spec.rb new file mode 100644 index 00000000000..ecc59aa7cc8 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/14_non_devops/service_ping_default_enabled_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Service ping default enabled' do + context 'When using default enabled from gitlab.yml config', :requires_admin do + before do + Flow::Login.sign_in_as_admin + + Page::Main::Menu.perform(&:go_to_admin_area) + Page::Admin::Menu.perform(&:go_to_metrics_and_profiling_settings) + end + + it 'has service ping toggle enabled' do + Page::Admin::Settings::MetricsAndProfiling.perform do |setting| + setting.expand_usage_statistics do |page| + expect(page).not_to have_disabled_usage_data_checkbox + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/14_non_devops/service_ping_disabled_spec.rb b/qa/qa/specs/features/browser_ui/14_non_devops/service_ping_disabled_spec.rb new file mode 100644 index 00000000000..309369265c9 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/14_non_devops/service_ping_disabled_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Service ping disabled', :orchestrated, :service_ping_disabled, :requires_admin do + context 'when disabled from gitlab.yml config' do + before do + Flow::Login.sign_in_as_admin + + Page::Main::Menu.perform(&:go_to_admin_area) + Page::Admin::Menu.perform(&:go_to_metrics_and_profiling_settings) + end + + it 'has service ping toggle is disabled' do + Page::Admin::Settings::MetricsAndProfiling.perform do |settings| + settings.expand_usage_statistics do |usage_statistics| + expect(usage_statistics).to have_disabled_usage_data_checkbox + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb index 15d51c14d26..74125b092b8 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/bulk_import_group_spec.rb @@ -56,7 +56,7 @@ module QA it( 'imports group from UI', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1806', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347862', issue_1: 'https://gitlab.com/gitlab-org/gitlab/-/issues/331252', issue_2: 'https://gitlab.com/gitlab-org/gitlab/-/issues/333678', issue_3: 'https://gitlab.com/gitlab-org/gitlab/-/issues/332351', diff --git a/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb index eae8e1b7e12..4b2b49b8139 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/create_group_with_mattermost_team_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Configure', :orchestrated, :mattermost do describe 'Mattermost support' do - it 'user creates a group with a mattermost team', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1459' do + it 'user creates a group with a mattermost team', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347890' do Flow::Login.sign_in Page::Main::Menu.perform(&:go_to_groups) 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 2550fc86ef2..881bc5bc7c3 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/group/transfer_group_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/group/transfer_group_spec.rb @@ -28,7 +28,7 @@ module QA end it 'transfers a subgroup to another group', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1828' do + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347692' do Page::Group::Menu.perform(&:click_group_general_settings_item) Page::Group::Settings::General.perform do |general| general.transfer_group(target_group.path) 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 87ac136d802..ffd7a7dfb6c 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 @@ -44,7 +44,7 @@ module QA end it 'user transfers a project between groups', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1592' do + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347878' do # Retry is needed here as the target group is not avaliable for transfer right away. QA::Support::Retrier.retry_on_exception(reload_page: page) do Page::File::Show.perform(&:go_to_general_settings) diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/2fa_recovery_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_recovery_spec.rb index 4e15aa79623..5ba80489652 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/2fa_recovery_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_recovery_spec.rb @@ -33,7 +33,7 @@ module QA group.add_member(developer_user, Resource::Members::AccessLevel::DEVELOPER) end - it 'allows using 2FA recovery code once only', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1271' do + it 'allows using 2FA recovery code once only', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347937' do recovery_code = enable_2fa_for_user_and_fetch_recovery_code(developer_user) Flow::Login.sign_in(as: developer_user, skip_page_validation: true) diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb index b97da194795..f85c07001e2 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/2fa_ssh_recovery_spec.rb @@ -19,7 +19,7 @@ module QA enable_2fa_for_user(user) end - it 'allows 2FA code recovery via ssh', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1227' do + it 'allows 2FA code recovery via ssh', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347938' do recovery_code = Support::SSH.perform do |ssh| ssh.key = ssh_key ssh.uri = address.gsub(/(?<=:)(#{uri.port})/, ssh_port) diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb index 9625771164c..98b5ecc8f0d 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Manage', :smoke, :mobile do describe 'basic user login' do - it 'user logs in using basic credentials and logs out', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1578' do + it 'user logs in using basic credentials and logs out', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347880' do Flow::Login.sign_in Page::Main::Menu.perform do |menu| diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb index 78fbec594a3..ca0ce0d5775 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_in_with_2fa_spec.rb @@ -35,7 +35,7 @@ module QA group.add_member(developer_user, Resource::Members::AccessLevel::DEVELOPER) end - it 'allows enforcing 2FA via UI and logging in with 2FA', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1320' do + it 'allows enforcing 2FA via UI and logging in with 2FA', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347931' do enforce_two_factor_authentication_on_group(group) enable_two_factor_authentication_for_user(developer_user) diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb index b4b1632dfbf..7ecad1101c9 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Manage', :orchestrated, :ldap_no_tls, :ldap_tls do describe 'LDAP login' do - it 'user logs into GitLab using LDAP credentials', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1456' do + it 'user logs into GitLab using LDAP credentials', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347892' do Flow::Login.sign_in Page::Main::Menu.perform do |menu| diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb index f06ded7ba53..6bfb9c96fbd 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Manage', :orchestrated, :mattermost do describe 'Mattermost login' do - it 'user logs into Mattermost using GitLab OAuth', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1458' do + it 'user logs into Mattermost using GitLab OAuth', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347891' do Flow::Login.sign_in Support::Retrier.retry_on_exception do diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb index e3b73906fe5..d6cb65c2788 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb @@ -5,7 +5,7 @@ module QA describe 'Instance wide SAML SSO' do it( 'user logs in to gitlab with SAML SSO', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1453' + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347895' ) do Runtime::Browser.visit(:gitlab, Page::Main::Login) diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/maintain_log_in_mixed_env_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/maintain_log_in_mixed_env_spec.rb index 734529f319a..2c7656e20f1 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/maintain_log_in_mixed_env_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/maintain_log_in_mixed_env_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Manage', only: { subdomain: :staging }, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/344213', type: :stale } do describe 'basic user' do - it 'remains logged in when redirected from canary to non-canary node', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2251' do + it 'remains logged in when redirected from canary to non-canary node', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347626' do Runtime::Browser.visit(:gitlab, Page::Main::Login) Support::Retrier.retry_until(sleep_interval: 0.5) do diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb index 45d01d0f00a..16f8df5a90d 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/register_spec.rb @@ -14,7 +14,7 @@ module QA end RSpec.describe 'Manage', :skip_signup_disabled, :requires_admin do - describe 'while LDAP is enabled', :orchestrated, :ldap_no_tls, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1300' do + describe 'while LDAP is enabled', :orchestrated, :ldap_no_tls, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347934' do before do # When LDAP is enabled, a previous test might have created a token for the LDAP 'tanuki' user who is not an admin # So we need to set it to nil in order to create a new token for admin user so that we are able to set_application_settings @@ -39,7 +39,7 @@ module QA end end - describe 'standard', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1652' do + describe 'standard', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347867' do context 'when admin approval is not required' do before(:all) do set_require_admin_approval_after_user_signup_via_api(false) @@ -66,7 +66,7 @@ module QA end end - it 'allows recreating with same credentials', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1651' do + it 'allows recreating with same credentials', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347868' do expect(Page::Main::Menu.perform(&:signed_in?)).to be_falsy Flow::Login.sign_in(as: user, skip_page_validation: true) @@ -106,7 +106,7 @@ module QA end end - it 'allows user login after approval', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1639' do + it 'allows user login after approval', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347871' do expect(page).to have_text(signed_up_waiting_approval_text) Flow::Login.sign_in(as: @user, skip_page_validation: true) 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 3eb0a5457c0..6d09c8b1316 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 @@ -7,7 +7,7 @@ module QA Runtime::Feature.enable(:invite_members_group_modal) end - it 'user adds project member', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1543' do + it 'user adds project member', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347887' do Flow::Login.sign_in user = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) 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 34a7431e328..7f40818da03 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 @@ -22,7 +22,7 @@ module QA project end - context 'in group', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1620' do + context 'in group', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347876' do let(:project_name) { "project-in-group-#{SecureRandom.hex(8)}" } let(:project) do Resource::Project.fabricate_via_browser_ui! do |project| @@ -34,7 +34,7 @@ module QA it_behaves_like 'successful project creation' end - context 'in personal namespace', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1914' do + context 'in personal namespace', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347643' do let(:project_name) { "project-in-personal-namespace-#{SecureRandom.hex(8)}" } let(:project) do Resource::Project.fabricate_via_browser_ui! do |project| 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 e48a03b5661..2f9ceeb98eb 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 @@ -39,13 +39,13 @@ module QA end end - context 'when logged in as a new user', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1549' do + context 'when logged in as a new user', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347885' do it_behaves_like 'loads all images' do let(:new_user) { @new_user } end end - context 'when logged in as a new admin', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1550' do + context 'when logged in as a new admin', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347884' do it_behaves_like 'loads all images' do let(:new_user) { @new_admin } end diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb index c078c4bf12e..72867333d16 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb @@ -38,7 +38,7 @@ module QA user.remove_via_api! end - it 'imports a GitHub repo', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1607' do + it 'imports a GitHub repo', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347877' do Page::Project::Import::Github.perform do |import_page| import_page.add_personal_access_token(Runtime::Env.github_access_token) import_page.import!(github_repo, group.full_path, imported_project.name) diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/project_access_token_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/project_access_token_spec.rb index dcf72c1cafc..be8567ee0b6 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/project_access_token_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/project_access_token_spec.rb @@ -5,7 +5,7 @@ module QA describe 'Project access tokens' do let(:project_access_token) {QA::Resource::ProjectAccessToken.fabricate_via_browser_ui!} - it 'can be created and revoked via the UI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1832' do + it 'can be created and revoked via the UI', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347688' do expect(project_access_token.token).not_to be_nil project_access_token.revoke_via_ui! 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 e5faebd2a80..1be73d92a8c 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 @@ -3,7 +3,7 @@ module QA RSpec.describe 'Manage' do describe 'Project activity' do - it 'user creates an event in the activity page upon Git push', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1591' 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 project = Resource::Repository::ProjectPush.fabricate! do |push| 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 d0a57b95df4..43100929acd 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 @@ -61,7 +61,7 @@ module QA user_api_client.personal_access_token end - it 'can be followed and their activity seen', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1842' do + it 'can be followed and their activity seen', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347678' do Flow::Login.sign_in page.visit Runtime::Scenario.gitlab_address + "/#{user.username}" Page::User::Show.perform(&:click_follow_user_link) diff --git a/qa/qa/specs/features/browser_ui/1_manage/user/user_access_termination_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/user/user_access_termination_spec.rb index 1158e65c3f3..58dcd922255 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/user/user_access_termination_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/user/user_access_termination_spec.rb @@ -39,7 +39,7 @@ module QA end end - it 'is not allowed to edit the project files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1709' do + it 'is not allowed to edit the project files', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347866' do Flow::Login.sign_in(as: user) project.visit! diff --git a/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb index 27c16898c43..4350b8f0d3e 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/email/trigger_email_notification_spec.rb @@ -20,7 +20,7 @@ module QA Flow::Login.sign_in end - it 'is received by a user for project invitation', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1448' do + it 'is received by a user for project invitation', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347961' do project.visit! Page::Project::Menu.perform(&:click_members) diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb index 7c4e10dc2b3..c2b42de6701 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/check_mentions_for_xss_spec.rb @@ -33,7 +33,7 @@ module QA user&.remove_via_api! end - it 'mentions a user in a comment', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1559' do + it 'mentions a user in a comment', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347949' do Page::Project::Issue::Show.perform do |show| show.select_all_activities_filter show.comment("cc-ing you here @#{user.username}") diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb index 95272bae9c2..8e8112faa48 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/collapse_comments_in_discussions_spec.rb @@ -13,7 +13,7 @@ module QA issue.visit! end - it 'collapses and expands reply for comments in an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1189' do + it 'collapses and expands reply for comments in an issue', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347985' do Page::Project::Issue::Show.perform do |show| show.select_all_activities_filter show.start_discussion('My first discussion') diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb index b4df43cb235..3b02093054d 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/comment_issue_spec.rb @@ -9,7 +9,7 @@ module QA Resource::Issue.fabricate_via_api!.visit! end - it 'comments on an issue and edits the comment', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1200' do + it 'comments on an issue and edits the comment', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347978' do Page::Project::Issue::Show.perform do |show| first_version_of_comment = 'First version of the comment' second_version_of_comment = 'Second version of the comment' diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb index 81ae8b82ef6..eb4eb1d3e71 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb @@ -1,25 +1,32 @@ # frozen_string_literal: true module QA - RSpec.describe 'Plan', :smoke do + # TODO: Remove :requires_admin when the `Runtime::Feature.enable` method call is removed + RSpec.describe 'Plan', :smoke, :requires_admin do describe 'Issue creation' do - let(:closed_issue) { Resource::Issue.fabricate_via_api! } + let(:project) { Resource::Project.fabricate_via_api! } + let(:closed_issue) { Resource::Issue.fabricate_via_api! { |issue| issue.project = project } } before do + Runtime::Feature.enable(:vue_issues_list, group: project.group) + Flow::Login.sign_in end - it 'creates an issue', :mobile, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1185' do - issue = Resource::Issue.fabricate_via_browser_ui! + it 'creates an issue', :mobile, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347989' do + issue = Resource::Issue.fabricate_via_browser_ui! { |issue| issue.project = project } Page::Project::Menu.perform(&:click_issues) + # TODO: Remove this method when the `Runtime::Feature.enable` method call is removed + Page::Project::Issue::Index.perform(&:wait_for_vue_issues_list_ff) + Page::Project::Issue::Index.perform do |index| expect(index).to have_issue(issue) end end - it 'closes an issue', :mobile, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1222' do + it 'closes an issue', :mobile, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347967' do closed_issue.visit! Page::Project::Issue::Show.perform do |issue_page| @@ -29,10 +36,14 @@ module QA end Page::Project::Menu.perform(&:click_issues) + + # TODO: Remove this method when the `Runtime::Feature.enable` method call is removed + Page::Project::Issue::Index.perform(&:wait_for_vue_issues_list_ff) + Page::Project::Issue::Index.perform do |index| expect(index).not_to have_issue(closed_issue) - index.click_closed_issues_link + index.click_closed_issues_tab expect(index).to have_issue(closed_issue) end @@ -45,13 +56,13 @@ module QA end before do - Resource::Issue.fabricate_via_api!.visit! + Resource::Issue.fabricate_via_api! { |issue| issue.project = project }.visit! end # The following example is excluded from running in `review-qa-smoke` job # as it proved to be flaky when running against Review App # See https://gitlab.com/gitlab-com/www-gitlab-com/-/issues/11568#note_621999351 - it 'comments on an issue with an attachment', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1599', except: { job: 'review-qa-smoke' } do + it 'comments on an issue with an attachment', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347946', except: { job: 'review-qa-smoke' } do Page::Project::Issue::Show.perform do |show| show.comment('See attached image for scale', attachment: file_to_attach) diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb index 5ad590f4011..044cc118085 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb @@ -28,7 +28,7 @@ module QA end end - it 'creates an issue via custom template', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1612' do + it 'creates an issue via custom template', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347945' do Resource::Issue.fabricate_via_browser_ui! do |issue| issue.project = template_project issue.template = template_name diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/export_as_csv_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/export_as_csv_spec.rb index 3914dbf4cd2..e8c624e9554 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/export_as_csv_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/export_as_csv_spec.rb @@ -22,7 +22,7 @@ module QA Page::Project::Menu.perform(&:click_issues) end - it 'successfully exports issues list as CSV', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1210' do + it 'successfully exports issues list as CSV', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347968' do Page::Project::Issue::Index.perform do |index| index.click_export_as_csv_button diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb index f31a8e69f83..c9536699cc5 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb @@ -9,7 +9,7 @@ module QA Resource::Issue.fabricate_via_api!.visit! end - it 'filters comments and activities in an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1577' do + it 'filters comments and activities in an issue', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347948' do Page::Project::Issue::Show.perform do |show| my_own_comment = "My own comment" made_the_issue_confidential = "made the issue confidential" diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb index 8cef592029e..6bb338ae31f 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb @@ -13,7 +13,7 @@ module QA end.project.visit! end - it 'shows issue suggestions when creating a new issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1179' do + it 'shows issue suggestions when creating a new issue', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347995' do Page::Project::Show.perform(&:go_to_new_issue) Page::Project::Issue::New.perform do |new_page| new_page.fill_title("issue") diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/jira_issue_import_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/jira_issue_import_spec.rb index 57ef09ab347..b7fa57a3270 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/jira_issue_import_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/jira_issue_import_spec.rb @@ -14,7 +14,7 @@ module QA end end - it 'imports issues from Jira', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1321' do + it 'imports issues from Jira', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347966' do set_up_jira_integration import_jira_issues diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb index 2d7fe6864aa..7d6718073f9 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/mentions_spec.rb @@ -23,7 +23,7 @@ module QA end.visit! end - it 'mentions another user in an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1186' do + it 'mentions another user in an issue', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347988' do Page::Project::Issue::Show.perform do |show| at_username = "@#{user.username}" diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/real_time_assignee_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/real_time_assignee_spec.rb index 268ea975d32..45d466903de 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/real_time_assignee_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/real_time_assignee_spec.rb @@ -28,7 +28,7 @@ module QA Runtime::Feature.disable(:invite_members_group_modal, project: project) end - it 'update without refresh', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1644' do + it 'update without refresh', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347941' do issue = Resource::Issue.fabricate_via_api! do |issue| issue.project = project issue.assignee_ids = [user1.id] diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue_boards/focus_mode_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue_boards/focus_mode_spec.rb index 63e707a4d27..f116c690eec 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue_boards/focus_mode_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue_boards/focus_mode_spec.rb @@ -13,7 +13,7 @@ module QA Flow::Login.sign_in end - it 'focuses on issue board', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1178' do + it 'focuses on issue board', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347996' do project.visit! Page::Project::Menu.perform(&:go_to_boards) diff --git a/qa/qa/specs/features/browser_ui/2_plan/milestone/create_group_milestone_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/milestone/create_group_milestone_spec.rb index 9097dc07b04..22709e8fbc4 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/milestone/create_group_milestone_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/milestone/create_group_milestone_spec.rb @@ -14,7 +14,7 @@ module QA Flow::Login.sign_in end - it 'creates a group milestone', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1203' do + it 'creates a group milestone', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347975' do group_milestone = Resource::GroupMilestone.fabricate_via_browser_ui! do |milestone| milestone.title = title milestone.description = description diff --git a/qa/qa/specs/features/browser_ui/2_plan/milestone/create_project_milestone_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/milestone/create_project_milestone_spec.rb index a6aee3e2b06..8047f8aea4c 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/milestone/create_project_milestone_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/milestone/create_project_milestone_spec.rb @@ -14,7 +14,7 @@ module QA Flow::Login.sign_in end - it 'creates a project milestone', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1187' do + it 'creates a project milestone', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347987' do project_milestone = Resource::ProjectMilestone.fabricate_via_browser_ui! do |milestone| milestone.title = title milestone.description = description diff --git a/qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb index 2bb686c2694..85011415177 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/related_issues/related_issues_spec.rb @@ -25,7 +25,7 @@ module QA Flow::Login.sign_in end - it 'relates and unrelates one issue to/from another', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1180' do + it 'relates and unrelates one issue to/from another', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347994' do issue_1.visit! Page::Project::Issue::Show.perform do |show| diff --git a/qa/qa/specs/features/browser_ui/2_plan/transient/comment_on_discussion_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/transient/comment_on_discussion_spec.rb index 6d73848b8f8..a3fe1d655aa 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/transient/comment_on_discussion_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/transient/comment_on_discussion_spec.rb @@ -16,7 +16,7 @@ module QA Flow::Login.sign_in end - it 'comments with mention on a discussion in an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1816' do + it 'comments with mention on a discussion in an issue', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347940' do Runtime::Env.transient_trials.times do |i| QA::Runtime::Logger.info("Transient bug test action - Trial #{i}") diff --git a/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_content_spec.rb b/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_content_spec.rb index b26f2338f45..5f896c7bf10 100644 --- a/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_content_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/design_management/add_design_content_spec.rb @@ -12,7 +12,7 @@ module QA Flow::Login.sign_in end - it 'user adds a design and annotates it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1290' do + it 'user adds a design and annotates it', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347822' do issue.visit! Page::Project::Issue::Show.perform do |issue| diff --git a/qa/qa/specs/features/browser_ui/3_create/design_management/archive_design_content_spec.rb b/qa/qa/specs/features/browser_ui/3_create/design_management/archive_design_content_spec.rb index e7954cefffc..de7c95841d6 100644 --- a/qa/qa/specs/features/browser_ui/3_create/design_management/archive_design_content_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/design_management/archive_design_content_spec.rb @@ -23,7 +23,7 @@ module QA Flow::Login.sign_in end - it 'user archives a design', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1812' do + it 'user archives a design', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347713' do third_design.issue.visit! Page::Project::Issue::Show.perform do |issue| diff --git a/qa/qa/specs/features/browser_ui/3_create/design_management/modify_design_content_spec.rb b/qa/qa/specs/features/browser_ui/3_create/design_management/modify_design_content_spec.rb index 7192e68d1cd..726e86ccdb4 100644 --- a/qa/qa/specs/features/browser_ui/3_create/design_management/modify_design_content_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/design_management/modify_design_content_spec.rb @@ -13,7 +13,7 @@ module QA Flow::Login.sign_in end - it 'user adds a design and modifies it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1813' do + it 'user adds a design and modifies it', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347712' do design.issue.visit! Page::Project::Issue::Show.perform do |issue| diff --git a/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb b/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb index 245b33c6691..e5a6c57656e 100644 --- a/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/jenkins/jenkins_build_status_spec.rb @@ -25,7 +25,7 @@ module QA setup_jenkins end - it 'integrates and displays build status for MR pipeline in GitLab', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1410' do + it 'integrates and displays build status for MR pipeline in GitLab', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347788' do login_to_gitlab setup_project_integration_with_jenkins diff --git a/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb b/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb index b2efdb11e9a..088556a3981 100644 --- a/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/jira/jira_basic_integration_spec.rb @@ -36,7 +36,7 @@ module QA expect(page).not_to have_text("Requests to the local network are not allowed") end - it 'closes an issue via pushing a commit', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1362' do + it 'closes an issue via pushing a commit', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347794' do issue_key = Vendor::Jira::JiraAPI.perform do |jira_api| jira_api.create_issue(jira_project_key) end @@ -46,7 +46,7 @@ module QA expect_issue_done(issue_key) end - it 'closes an issue via a merge request', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1361' do + it 'closes an issue via a merge request', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347795' do issue_key = Vendor::Jira::JiraAPI.perform do |jira_api| jira_api.create_issue(jira_project_key) end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_a_merge_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_a_merge_spec.rb index 826c1a45ff4..413c530116c 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_a_merge_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_a_merge_spec.rb @@ -22,7 +22,7 @@ module QA Flow::Login.sign_in end - it 'creates a merge request', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1836' do + it 'creates a merge request', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347684' do feature_mr.visit! Page::MergeRequest::Show.perform do |merge_request| diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_commit_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_commit_spec.rb index b2e54680560..a1d8b495129 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_commit_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/cherry_pick/cherry_pick_commit_spec.rb @@ -29,7 +29,7 @@ module QA commit.visit! end - it 'creates a merge request', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1817' do + it 'creates a merge request', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347710' do Page::Project::Commit::Show.perform(&:cherry_pick_commit) Page::MergeRequest::New.perform(&:create_merge_request) diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb index 79cc91acc79..6a2fe705cf7 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_spec.rb @@ -19,7 +19,7 @@ module QA it( 'creates a basic merge request', :smoke, - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1590' + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347738' ) do Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request| merge_request.project = project @@ -36,7 +36,7 @@ module QA it( 'creates a merge request with a milestone and label', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1542' + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347762' ) do gitlab_account_username = "@#{Runtime::User.username}" diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_via_template_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_via_template_spec.rb index 01c75d95683..c4aacd8fb06 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_via_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_via_template_spec.rb @@ -29,7 +29,7 @@ module QA end end - it 'creates a merge request via custom template', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1680' do + it 'creates a merge request via custom template', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347722' do Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request| merge_request.project = template_project merge_request.title = merge_request_title diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb index f2d4fc6e677..d198d79c5fe 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb @@ -17,7 +17,7 @@ module QA merge_request.fork.remove_via_api! end - it 'can merge feature branch fork to mainline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1305' do + it 'can merge feature branch fork to mainline', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347818' do merge_request.visit! Page::MergeRequest::Show.perform do |merge_request| 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 3a5850c0047..9a771919c11 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 @@ -87,11 +87,11 @@ module QA end end - context 'when merging once', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1834' do + context 'when merging once', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347686' do it_behaves_like 'merge when pipeline succeeds' end - context 'when merging several times', :transient, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1917' do + context 'when merging several times', :transient, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347641' do it_behaves_like 'merge when pipeline succeeds', repeat: Runtime::Env.transient_trials end end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb index 81fb187df85..536abfa5303 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb @@ -9,7 +9,7 @@ module QA Flow::Login.sign_in end - it 'user rebases source branch of merge request', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1596' do + it 'user rebases source branch of merge request', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347735' do merge_request.project.visit! Page::Project::Menu.perform(&:go_to_general_settings) diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/revert_commit_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/revert_commit_spec.rb index a24ba9ac45a..a2b27e294e6 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/revert_commit_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/revert_commit_spec.rb @@ -27,7 +27,7 @@ module QA commit.visit! end - it 'creates a merge request', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1807' do + it 'creates a merge request', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347716' do Page::Project::Commit::Show.perform(&:revert_commit) Page::MergeRequest::New.perform(&:create_merge_request) diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/reverting_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/reverting_merge_request_spec.rb index 6a79a2d8078..90ca836f8b0 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/reverting_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/revert/reverting_merge_request_spec.rb @@ -19,7 +19,7 @@ module QA Flow::Login.sign_in end - it 'can be reverted', :can_use_large_setup, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1818', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/335987', type: :investigating } do + it 'can be reverted', :can_use_large_setup, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347709', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/335987', type: :investigating } do revertable_merge_request.visit! Page::MergeRequest::Show.perform do |merge_request| diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb index 9fcf6b3db71..fa129f39a4c 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb @@ -31,7 +31,7 @@ module QA merge_request.visit! end - it 'user squashes commits while merging', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1583' do + it 'user squashes commits while merging', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347744' do Page::MergeRequest::Show.perform do |merge_request_page| merge_request_page.retry_on_exception(reload: true) do expect(merge_request_page).to have_text('to be squashed') diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/suggestions/batch_suggestion_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/suggestions/batch_suggestion_spec.rb index 96c9c9b55b4..38adf2f5d55 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/suggestions/batch_suggestion_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/suggestions/batch_suggestion_spec.rb @@ -46,7 +46,7 @@ module QA merge_request.visit! end - it 'applies multiple suggestions', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1838' do + it 'applies multiple suggestions', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347682' do Page::MergeRequest::Show.perform do |merge_request| merge_request.click_diffs_tab 4.times { merge_request.add_suggestion_to_batch } diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/suggestions/custom_commit_suggestion_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/suggestions/custom_commit_suggestion_spec.rb index 719006e87eb..d73fb57a581 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/suggestions/custom_commit_suggestion_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/suggestions/custom_commit_suggestion_spec.rb @@ -43,7 +43,7 @@ module QA merge_request.visit! end - it 'applies a single suggestion with a custom message', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1815' do + it 'applies a single suggestion with a custom message', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347711' do Page::MergeRequest::Show.perform do |merge_request| merge_request.click_diffs_tab merge_request.apply_suggestion_with_message(commit_message) diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_diff_patch_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_diff_patch_spec.rb index fb30d47135e..18aa6bfe78a 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_diff_patch_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_diff_patch_spec.rb @@ -15,7 +15,7 @@ module QA merge_request.visit! end - it 'views the merge request email patches', :can_use_large_setup, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1585' do + it 'views the merge request email patches', :can_use_large_setup, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347742' do Page::MergeRequest::Show.perform(&:view_email_patches) expect(page.text).to start_with('From') @@ -23,7 +23,7 @@ module QA expect(page).to have_content("diff --git a/#{merge_request.file_name} b/#{merge_request.file_name}") end - it 'views the merge request plain diff', :can_use_large_setup, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1584' do + it 'views the merge request plain diff', :can_use_large_setup, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347743' do Page::MergeRequest::Show.perform(&:view_plain_diff) expect(page.text).to start_with('diff') diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb index c7942c5c2e4..0785b32b225 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/view_merge_request_merge_ref_diff_spec.rb @@ -32,7 +32,7 @@ module QA merge_request.visit! end - it 'views the merge-ref diff by default', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1902' do + it 'views the merge-ref diff by default', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347651' do Page::MergeRequest::Show.perform do |mr_page| mr_page.click_diffs_tab mr_page.click_target_version_dropdown @@ -57,7 +57,7 @@ module QA merge_request.visit! end - it 'views the merge-base diff by default', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1903' do + it 'views the merge-base diff by default', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347650' do Page::MergeRequest::Show.perform do |mr_page| mr_page.click_diffs_tab mr_page.click_target_version_dropdown diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb index 9448cd13f53..a98925eab98 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb @@ -61,7 +61,7 @@ module QA project.visit! end - it 'lists branches correctly after CRUD operations', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1588' do + it 'lists branches correctly after CRUD operations', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347740' do Page::Project::Menu.perform(&:go_to_repository_branches) expect(page).to have_content(master_branch) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb index 39fb18f2051..9e77fd228da 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/branch_with_unusual_name_spec.rb @@ -16,7 +16,7 @@ module QA end context 'when branch name contains slash, hash, double dash, and capital letter' do - it 'renders repository file tree correctly', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1809' do + it 'renders repository file tree correctly', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347715' do Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = project commit.branch = branch_name diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb index 1fa95eda3f0..d12fb05af77 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb @@ -28,7 +28,7 @@ module QA project.wait_for_push_new_branch end - it 'user performs a deep clone', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1546' do + it 'user performs a deep clone', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347761' do Git::Repository.perform do |repository| repository.uri = project.repository_http_location.uri repository.use_default_credentials @@ -39,7 +39,7 @@ module QA end end - it 'user performs a shallow clone', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1589' do + it 'user performs a shallow clone', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347739' do Git::Repository.perform do |repository| repository.uri = project.repository_http_location.uri repository.use_default_credentials diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb index 6d7e1b4f6df..f335cfdb367 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/file/create_file_via_web_spec.rb @@ -11,7 +11,7 @@ module QA Flow::Login.sign_in end - it 'user creates a file via the Web', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1633' do + it 'user creates a file via the Web', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347729' do Resource::File.fabricate_via_browser_ui! do |file| file.name = file_name file.content = file_content diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/file/delete_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/file/delete_file_via_web_spec.rb index 4667dccb9a1..02ecff22840 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/file/delete_file_via_web_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/file/delete_file_via_web_spec.rb @@ -12,7 +12,7 @@ module QA file.visit! end - it 'user deletes a file via the Web', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1631' do + it 'user deletes a file via the Web', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347731' do Page::File::Show.perform do |file| file.click_delete file.add_commit_message(commit_message_for_delete) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb index 47aebcbf349..25c095d9eda 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/file/edit_file_via_web_spec.rb @@ -13,7 +13,7 @@ module QA file.visit! end - it 'user edits a file via the Web', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1632' do + it 'user edits a file via the Web', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347730' do Page::File::Show.perform(&:click_edit) Page::File::Form.perform do |file| diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/file/file_with_unusual_name_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/file/file_with_unusual_name_spec.rb index 0a01afd97d8..6caa8e64d56 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/file/file_with_unusual_name_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/file/file_with_unusual_name_spec.rb @@ -16,7 +16,7 @@ module QA end context 'when file name starts with a dash and contains hash, semicolon, colon, and question mark' do - it 'renders repository file tree correctly', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1810' do + it 'renders repository file tree correctly', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347714' do Resource::File.fabricate_via_api! do |file| file.project = project file.commit_message = 'Add new file' diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb index a53bb197b09..bec95e41202 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/move_project_create_fork_spec.rb @@ -23,7 +23,7 @@ module QA parent_project.add_member(user) end - it 'creates a 2nd fork after moving the parent project', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1413' do + it 'creates a 2nd fork after moving the parent project', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347787' do Flow::Login.sign_in(as: user) fork_project.visit! diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb index 48bfe56e91e..34439042796 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_http_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do describe 'Push over HTTP using Git protocol version 2', :requires_git_protocol_v2 do - it 'user pushes to the repository', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1548' do + it 'user pushes to the repository', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347760' do Flow::Login.sign_in # Create a project to push to diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_ssh_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_ssh_spec.rb index 467d9b2487d..25d4da95dd9 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_ssh_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/protocol_v2_push_ssh_spec.rb @@ -27,7 +27,7 @@ module QA Page::Main::Menu.perform(&:sign_out_if_signed_in) end - it 'user pushes to the repository', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1606' do + it 'user pushes to the repository', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347734' do project = Resource::Project.fabricate_via_api! do |project| project.name = 'git-protocol-project' end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb index 6fdf7f424ee..042fee38188 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do describe 'Git push over HTTP', :smoke do - it 'user using a personal access token pushes code to the repository', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1573' do + it 'user using a personal access token pushes code to the repository', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347749' do Flow::Login.sign_in access_token = Resource::PersonalAccessToken.fabricate!.token diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb index d8972d4f37a..b8e425ae3b8 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_lfs_over_http_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do describe 'Push mirror a repository over HTTP' do - it 'configures and syncs LFS objects for a (push) mirrored repository', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1224' do + it 'configures and syncs LFS objects for a (push) mirrored repository', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347847' do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) @@ -30,7 +30,7 @@ module QA mirror_settings.authentication_method = 'Password' mirror_settings.password = Runtime::User.password mirror_settings.mirror_repository - mirror_settings.update target_project_uri + mirror_settings.update target_project_uri # rubocop:disable Rails/SaveBang end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb index ec63ed9cdf1..6d3d86d0663 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do describe 'Push mirror a repository over HTTP' do - it 'configures and syncs a (push) mirrored repository', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1587' do + it 'configures and syncs a (push) mirrored repository', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347741' do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) @@ -29,7 +29,7 @@ module QA mirror_settings.authentication_method = 'Password' mirror_settings.password = Runtime::User.password mirror_settings.mirror_repository - mirror_settings.update target_project_uri + mirror_settings.update target_project_uri # rubocop:disable Rails/SaveBang end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb index 727a9e27c63..812a7bae6c3 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb @@ -26,7 +26,7 @@ module QA set_file_size_limit(nil) end - it 'push successful when the file size is under the limit', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1556' do + it 'push successful when the file size is under the limit', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347758' do set_file_size_limit(5) retry_on_fail do @@ -36,7 +36,7 @@ module QA end end - it 'push fails when the file size is above the limit', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1554' do + it 'push fails when the file size is above the limit', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347759' do set_file_size_limit(2) retry_on_fail do diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb index 4c294f21859..a782a50b55d 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do describe 'Git push over HTTP' do - it 'user pushes code to the repository', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1576' do + it 'user pushes code to the repository', :smoke, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347747' do Flow::Login.sign_in Resource::Repository::ProjectPush.fabricate! do |push| @@ -18,7 +18,7 @@ module QA end end - it 'pushes to a project using a specific Praefect repository storage', :smoke, :requires_admin, :requires_praefect, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1389' do + it 'pushes to a project using a specific Praefect repository storage', :smoke, :requires_admin, :requires_praefect, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347789' do Flow::Login.sign_in_as_admin project = Resource::Project.fabricate_via_api! do |storage_project| diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_ssh_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_ssh_spec.rb index be0d48e5ab9..0323448878b 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_ssh_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_ssh_spec.rb @@ -26,7 +26,7 @@ module QA Flow::Login.sign_in end - it 'pushes code to the repository via SSH', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1283' do + it 'pushes code to the repository via SSH', :smoke, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347825' do Resource::Repository::ProjectPush.fabricate! do |push| push.project = project push.ssh_key = @key @@ -41,7 +41,7 @@ module QA end end - it 'pushes multiple branches and tags together', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1282' do + it 'pushes multiple branches and tags together', :smoke, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347826' do branches = [] tags = [] Git::Repository.perform do |repository| diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb index 318d905c149..f8129c9ccba 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb @@ -18,7 +18,7 @@ module QA end context 'when developers and maintainers are allowed to push to a protected branch' do - it 'user with push rights successfully pushes to the protected branch', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1563' do + it 'user with push rights successfully pushes to the protected branch', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347756' do create_protected_branch(allowed_to_push: { roles: Resource::ProtectedBranch::Roles::DEVS_AND_MAINTAINERS }) @@ -30,7 +30,7 @@ module QA end context 'when developers and maintainers are not allowed to push to a protected branch' do - it 'user without push rights fails to push to the protected branch', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1562' do + it 'user without push rights fails to push to the protected branch', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347757' do create_protected_branch(allowed_to_push: { roles: Resource::ProtectedBranch::Roles::NO_ONE }) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/ssh_key_support_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/ssh_key_support_spec.rb index 3f488a1610d..2e8c43d6981 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/ssh_key_support_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/ssh_key_support_spec.rb @@ -9,7 +9,7 @@ module QA Flow::Login.sign_in end - it 'user can add an SSH key', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1304' do + it 'user can add an SSH key', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347819' do key = Resource::SSHKey.fabricate_via_browser_ui! do |resource| resource.title = key_title end @@ -20,7 +20,7 @@ module QA # Note this context ensures that the example it contains is executed after the example above. Be aware of the order of execution if you add new examples in either context. context 'after adding an ssh key' do - it 'can delete an ssh key', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1303' do + it 'can delete an ssh key', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347820' do Page::Main::Menu.perform(&:click_edit_profile_link) Page::Profile::Menu.perform(&:click_ssh_keys) Page::Profile::SSHKeys.perform do |ssh_keys| diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb index d445f4d091b..bbf6c3ca37a 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/user_views_commit_diff_patch_spec.rb @@ -43,7 +43,7 @@ module QA find('pre').text end - it 'user views raw email patch', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1566' do + it 'user views raw email patch', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347755' do view_commit Page::Project::Commit::Show.perform(&:select_email_patches) @@ -53,7 +53,7 @@ module QA expect(page).to have_content('diff --git a/second b/second') end - it 'user views raw commit diff', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1568' do + it 'user views raw commit diff', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347754' do view_commit Page::Project::Commit::Show.perform(&:select_plain_diff) diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb index b41e90fa834..8f22a28628f 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_personal_snippet_spec.rb @@ -39,7 +39,7 @@ module QA ssh_key.remove_via_api! end - it 'clones, pushes, and pulls a snippet over HTTP, edits via UI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1363' do + it 'clones, pushes, and pulls a snippet over HTTP, edits via UI', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347793' do push = Resource::Repository::Push.fabricate! do |push| push.repository_http_uri = repository_uri_http push.file_name = new_file @@ -70,7 +70,7 @@ module QA snippet.remove_via_api! end - it 'clones, pushes, and pulls a snippet over SSH, deletes via UI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1364' do + it 'clones, pushes, and pulls a snippet over SSH, deletes via UI', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347792' do push = Resource::Repository::Push.fabricate! do |push| push.repository_ssh_uri = repository_uri_ssh push.ssh_key = ssh_key diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb index e8b2ffe1f14..9a5fe44c927 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/clone_push_pull_project_snippet_spec.rb @@ -40,7 +40,7 @@ module QA ssh_key.remove_via_api! end - it 'clones, pushes, and pulls a project snippet over HTTP, edits via UI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1359' do + it 'clones, pushes, and pulls a project snippet over HTTP, edits via UI', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347797' do Resource::Repository::Push.fabricate! do |push| push.repository_http_uri = repository_uri_http push.file_name = new_file @@ -71,7 +71,7 @@ module QA snippet.remove_via_api! end - it 'clones, pushes, and pulls a project snippet over SSH, deletes via UI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1360' do + it 'clones, pushes, and pulls a project snippet over SSH, deletes via UI', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347796' do Resource::Repository::Push.fabricate! do |push| push.repository_ssh_uri = repository_uri_ssh push.ssh_key = ssh_key diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb index 300fd6a1be2..dc66e0c5a9f 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_spec.rb @@ -21,7 +21,7 @@ module QA snippet.remove_via_api! end - it 'user creates a personal snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1357' do + it 'user creates a personal snippet', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347799' do snippet.visit! Page::Dashboard::Snippet::Show.perform do |snippet| diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb index a32ee472150..28bea89e3bd 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_personal_snippet_with_multiple_files_spec.rb @@ -26,7 +26,7 @@ module QA snippet.remove_via_api! end - it 'creates a personal snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1654' do + it 'creates a personal snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347723' do snippet.visit! Page::Dashboard::Snippet::Show.perform do |snippet| diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb index 1967273ca17..56cbe7d6bfa 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_spec.rb @@ -21,7 +21,7 @@ module QA snippet.remove_via_api! end - it 'user creates a project snippet', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1358' do + it 'user creates a project snippet', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347798' do snippet.visit! Page::Dashboard::Snippet::Show.perform do |snippet| diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb index ae71be26a38..3d69ef5dde6 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/create_project_snippet_with_multiple_files_spec.rb @@ -28,7 +28,7 @@ module QA snippet.remove_via_api! end - it 'creates a project snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1648' do + it 'creates a project snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347725' do snippet.visit! Page::Dashboard::Snippet::Show.perform do |snippet| diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb index 53e1e8e2e02..6777c113f36 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/share_snippet_spec.rb @@ -21,7 +21,7 @@ module QA end context 'when the snippet is public' do - it 'can be shared with not signed-in users', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1248' do + it 'can be shared with not signed-in users', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347836' do snippet.visit! sharing_link = Page::Dashboard::Snippet::Show.perform do |snippet| @@ -43,7 +43,7 @@ module QA end context 'when the snippet is changed to private' do - it 'does not display Embed/Share dropdown', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1249' do + it 'does not display Embed/Share dropdown', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347835' do snippet.visit! Page::Dashboard::Snippet::Show.perform do |snippet| 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 b92c8e881ab..9735aa7959a 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 @@ -35,7 +35,7 @@ module QA Page::Project::Show.perform(&:open_web_ide!) end - it 'throws an error', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1618' do + it 'throws an error', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347733' do Page::Project::WebIDE::Edit.perform do |ide| ide.add_directory(directory_name) end @@ -51,7 +51,7 @@ module QA Page::Project::Show.perform(&:open_web_ide!) end - it 'shows in the tree view but cannot be committed', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1619' do + it 'shows in the tree view but cannot be committed', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347732' do Page::Project::WebIDE::Edit.perform do |ide| ide.add_directory(directory_name) 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 2e37cc98555..948417458fc 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 @@ -16,7 +16,7 @@ module QA Flow::Login.sign_in end - it "creates the first file in an empty project via Web IDE", testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1353' do + it "creates the first file in an empty project via Web IDE", testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347803' do project.visit! Page::Project::Show.perform(&:create_first_new_file!) 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 158e841514c..9c1d327f02c 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 @@ -18,7 +18,7 @@ module QA project.remove_via_api! end - it 'can link to a specific line of code in Web IDE', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1844' do + it 'can link to a specific line of code in Web IDE', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347676' do project.visit! # Open Web IDE by using a keyboard shortcut 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 99a9bc5b2d0..758aae9f729 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 @@ -14,7 +14,7 @@ module QA let(:user) { Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) } context 'when no fork is present' do - it 'suggests to create a fork when a user clicks Web IDE in the main project', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1289' do + it 'suggests to create a fork when a user clicks Web IDE in the main project', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347823' do Flow::Login.sign_in(as: user) parent_project.visit! @@ -34,7 +34,7 @@ module QA end end - it 'opens the fork when a user clicks Web IDE in the main project', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1288' do + it 'opens the fork when a user clicks Web IDE in the main project', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347824' do Flow::Login.sign_in(as: user) fork_project.upstream.visit! Page::Project::Show.perform do |project_page| 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 061ab66b271..fc5754e2c7a 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 @@ -49,7 +49,7 @@ module QA merge_request.visit! end - it 'opens and edits a multi-file merge request in Web IDE from Diff Tab', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1649' do + 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 Page::MergeRequest::Show.perform do |show| show.click_diffs_tab show.edit_file_in_web_ide('file1') 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 7135e04e457..bd19d70ae5c 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 @@ -20,7 +20,7 @@ module QA merge_request.visit! end - it 'opens and edits a merge request in Web IDE', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1420' do + it 'opens and edits a merge request in Web IDE', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347786' do Page::MergeRequest::Show.perform do |show| show.click_open_in_web_ide end 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 705ee954bcb..3d9d5695d06 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 @@ -22,7 +22,7 @@ module QA context 'when a file with the same name already exists' do let(:file_name) { 'README.md' } - it 'throws an error', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1214' do + it 'throws an error', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347850' do Page::Project::WebIDE::Edit.perform do |ide| ide.upload_file(file_path) end @@ -34,7 +34,7 @@ module QA context 'when the file is a text file' do let(:file_name) { 'text_file.txt' } - it 'shows the Edit tab with the text', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1212' do + it 'shows the Edit tab with the text', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347852' do Page::Project::WebIDE::Edit.perform do |ide| ide.upload_file(file_path) @@ -52,7 +52,7 @@ module QA context 'when the file is binary' do let(:file_name) { 'logo_sample.svg' } - it 'shows a Download button', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1213' do + it 'shows a Download button', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347851' do Page::Project::WebIDE::Edit.perform do |ide| ide.upload_file(file_path) @@ -70,7 +70,7 @@ module QA context 'when the file is an image' do let(:file_name) { 'dk.png' } - it 'shows an image viewer', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1211' do + it 'shows an image viewer', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347853' do Page::Project::WebIDE::Edit.perform do |ide| ide.upload_file(file_path) 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 51791c01048..022731faade 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 @@ -56,7 +56,7 @@ module QA @runner.remove_via_api! if @runner end - it 'user starts the web terminal', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1593' do + it 'user starts the web terminal', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347737' do Page::Project::Show.perform(&:open_web_ide!) # Start the web terminal and check that there were no errors @@ -65,6 +65,7 @@ module QA # a) The terminal JS package has loaded, and # b) It's not stuck in a "Loading/Starting" state, and # c) There's no alert stating there was a problem + # d) There are no JS console errors # # The terminal itself is a third-party package so we assume it is # adequately tested elsewhere. @@ -78,6 +79,17 @@ module QA expect(edit).to have_finished_loading expect(edit).to have_terminal_screen end + + # It takes a few seconds for console errors to appear + sleep 3 + + errors = page.driver.browser.logs.get(:browser) + .select { |e| e.level == "SEVERE" } + .to_a + + if errors.present? + raise("Console error(s):\n#{errors.join("\n\n")}") + end end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/content_editor_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/content_editor_spec.rb index bd4b82d8ea0..a063acbe146 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/content_editor_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/content_editor_spec.rb @@ -1,12 +1,13 @@ # frozen_string_literal: true module QA - RSpec.describe 'Create' do + RSpec.describe 'Create', :requires_admin do # remove :requires_admin once the ff is enabled by default in https://gitlab.com/gitlab-org/gitlab/-/issues/345398 context 'Content Editor' do let(:initial_wiki) { Resource::Wiki::ProjectPage.fabricate_via_api! } let(:page_title) { 'Content Editor Page' } let(:heading_text) { 'My New Heading' } let(:image_file_name) { 'testfile.png' } + let!(:toggle) { Runtime::Feature.enabled?(:wiki_switch_between_content_editor_raw_markdown) } before do Flow::Login.sign_in @@ -16,14 +17,14 @@ module QA initial_wiki.project.remove_via_api! end - it 'creates a formatted Wiki page with an image uploaded', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1919' do + it 'creates a formatted Wiki page with an image uploaded', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347640' do initial_wiki.visit! Page::Project::Wiki::Show.perform(&:click_new_page) Page::Project::Wiki::Edit.perform do |edit| edit.set_title(page_title) - edit.use_new_editor + edit.use_new_editor(toggle) edit.add_heading('Heading 1', heading_text) edit.upload_image(File.absolute_path(File.join('qa', 'fixtures', 'designs', image_file_name))) end diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb index 40188fae06c..648ef513e12 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_creation_spec.rb @@ -15,7 +15,7 @@ module QA Flow::Login.sign_in end - it 'by adding a home page to the wiki', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1347' do + it 'by adding a home page to the wiki', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347809' do project.visit! Page::Project::Menu.perform(&:click_wiki) @@ -35,7 +35,7 @@ module QA end end - it 'by adding a second page to the wiki', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1348' do + it 'by adding a second page to the wiki', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347808' do wiki.visit! Page::Project::Wiki::Show.perform(&:click_new_page) @@ -54,7 +54,7 @@ module QA end end - it 'by adding a home page to the wiki using git push', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1350' do + it 'by adding a home page to the wiki using git push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347806' do empty_wiki = Resource::Wiki::ProjectPage.new do |empty_wiki| empty_wiki.project = project end @@ -73,7 +73,7 @@ module QA end end - it 'by adding a second page to the wiki using git push', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1349' do + it 'by adding a second page to the wiki using git push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347807' do Resource::Repository::WikiPush.fabricate! do |push| push.file_name = "#{new_wiki_title}.md" push.file_content = new_wiki_content diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb index 5b277d07fea..251728c149f 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_content_manipulation_spec.rb @@ -14,7 +14,7 @@ module QA Flow::Login.sign_in end - it 'by manipulating content on the page', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1346' do + it 'by manipulating content on the page', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347810' do wiki.visit! Page::Project::Wiki::Show.perform(&:click_edit) @@ -33,7 +33,7 @@ module QA end end - it 'by manipulating content on the page using git push', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1345' do + it 'by manipulating content on the page using git push', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347811' do Resource::Repository::WikiPush.fabricate! do |push| push.file_content = new_wiki_content push.commit_message = commit_message diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb index 9784ad2e9c1..2d24f69c883 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_directory_management_spec.rb @@ -10,7 +10,7 @@ module QA Flow::Login.sign_in end - it 'has changed the directory', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1293' do + it 'has changed the directory', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347821' do initial_wiki.visit! Page::Project::Wiki::Show.perform(&:click_edit) diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_list_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_list_spec.rb index c91fc8e10f7..703d425079d 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_list_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_list_spec.rb @@ -15,7 +15,7 @@ module QA end context 'Sidebar' do - it 'has all expected links that work', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1317' do + it 'has all expected links that work', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347814' do small_wiki.visit! small_number_of_pages.times do |index| @@ -35,7 +35,7 @@ module QA end context 'Page List' do - it 'has all expected links that work', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1318' do + it 'has all expected links that work', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347813' do large_wiki.visit! Page::Project::Wiki::Show.perform(&:click_view_all_pages) diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_page_deletion_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_page_deletion_spec.rb index 71ce042f0a3..78d6d51f260 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_page_deletion_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/project_based_page_deletion_spec.rb @@ -10,7 +10,7 @@ module QA end context 'Page deletion' do - it 'has removed the deleted page correctly', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1310' do + it 'has removed the deleted page correctly', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347815' do initial_wiki.visit! Page::Project::Wiki::Show.perform(&:click_edit) diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb index c8b308d53ef..fa8d0d1501c 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_remove_ci_variable_spec.rb @@ -16,7 +16,7 @@ module QA add_ci_variable end - it 'user adds a CI variable', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1597' do + it 'user adds a CI variable', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348027' do Page::Project::Settings::CiVariables.perform do |ci_variable| expect(ci_variable).to have_text('VARIABLE_KEY') expect(ci_variable).not_to have_text('some_CI_variable') @@ -27,7 +27,7 @@ module QA end end - it 'user removes a CI variable', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1598' do + it 'user removes a CI variable', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348026' do Page::Project::Settings::CiVariables.perform do |ci_variable| ci_variable.click_edit_ci_variable ci_variable.click_ci_variable_delete_button 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 4d21a98e072..7704111ea21 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 @@ -61,7 +61,7 @@ module QA runner.remove_via_api! end - it 'exposes variable on protected branch', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1714' do + it 'exposes variable on protected branch', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348005' do create_protected_branch [developer, maintainer].each do |user| @@ -74,7 +74,7 @@ module QA end end - it 'does not expose variable on unprotected branch', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1885' do + it 'does not expose variable on unprotected branch', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347664' do [developer, maintainer].each do |user| create_merge_request(Runtime::API::Client.new(:gitlab, user: user)) go_to_pipeline_job(user) 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 e6910ad8592..bd3135bafdc 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 @@ -23,7 +23,7 @@ module QA [runner, project].each(&:remove_via_api!) end - it 'users creates a pipeline which gets processed', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1601' do + it 'users creates a pipeline which gets processed', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348024' do Flow::Login.sign_in Resource::Repository::Commit.fabricate_via_api! do |commit| diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_local_config_file_paths_with_wildcard_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_local_config_file_paths_with_wildcard_spec.rb index 27b45d1a2a0..f2ebc191a8a 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_local_config_file_paths_with_wildcard_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/include_local_config_file_paths_with_wildcard_spec.rb @@ -20,7 +20,7 @@ module QA project.remove_via_api! end - it 'runs the pipeline with composed config', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1814' do + it 'runs the pipeline with composed config', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348002' do Page::Project::Pipeline::Show.perform do |pipeline| aggregate_failures 'pipeline has all expected jobs' do expect(pipeline).to have_job('build') 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 9d145a3becf..9521cd20fc5 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 @@ -39,7 +39,7 @@ module QA runner.remove_via_api! end - it 'runs the pipeline with composed config', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1223' do + it 'runs the pipeline with composed config', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348087' do Page::Project::Pipeline::Show.perform do |pipeline| aggregate_failures 'pipeline has all expected jobs' do expect(pipeline).to have_job('build') 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 7faf4114d02..9abb25c8dc1 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 @@ -30,7 +30,7 @@ module QA runner.remove_via_api! end - it 'can be browsed', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1808' do + it 'can be browsed', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348003' do Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = project commit.commit_message = 'Add .gitlab-ci.yml' 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 8dfd485bbf1..d201627218e 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 @@ -68,7 +68,7 @@ module QA runner.remove_via_api! end - it 'can still merge MR successfully', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1281' do + it 'can still merge MR successfully', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348080' do Page::MergeRequest::Show.perform do |show| # waiting for manual action status shows status badge 'blocked' on pipelines page show.has_pipeline_status?('waiting for manual action') 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 0ddfcf8cafb..65561bbba29 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 @@ -66,7 +66,7 @@ module QA project.remove_via_api! end - it 'only runs the job configured to run on merge requests', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1890' do + it 'only runs the job configured to run on merge requests', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347662' do Page::Project::Pipeline::Show.perform do |pipeline| aggregate_failures do expect(pipeline).to have_job(mr_only_job_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 9fd54251411..22bb5fed84c 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 @@ -42,7 +42,7 @@ module QA [upstream_project, downstream_project].each(&:remove_via_api!) end - it 'runs the pipeline with composed config', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1221' do + it 'runs the pipeline with composed config', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348088' do Page::Project::Pipeline::Show.perform do |parent_pipeline| Support::Waiter.wait_until { parent_pipeline.has_child_pipeline? } parent_pipeline.expand_child_pipeline diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_branch_switcher_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_branch_switcher_spec.rb index 1a2d450f7eb..8d2af3ea0df 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_branch_switcher_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/pipeline_editor_branch_switcher_spec.rb @@ -2,7 +2,9 @@ module QA RSpec.describe 'Verify' do - describe 'Pipeline editor', :requires_admin do + describe 'Pipeline editor' do + let(:random_test_string) { SecureRandom.hex(10) } + let(:project) do Resource::Project.fabricate_via_api! do |project| project.name = 'pipeline-editor-project' @@ -17,70 +19,71 @@ module QA [ { file_path: '.gitlab-ci.yml', - content: default_file_content + content: <<~YAML + stages: + - test + + initialize: + stage: test + script: + - echo "I am now on branch #{project.default_branch}" + YAML } ] ) end end - let!(:production_push) do - Resource::Repository::Push.fabricate! do |push| - push.repository_http_uri = project.repository_http_location.uri - push.branch_name = 'production' - push.file_name = '.gitlab-ci.yml' - push.file_content = production_file_content - end - end - - let(:default_file_content) do - <<~YAML - stages: - - test - - initialize: - stage: test - script: - - echo "initialized in #{project.default_branch}" - YAML - end + let!(:test_branch) do + Resource::Repository::ProjectPush.fabricate! do |resource| + resource.project = project + resource.branch_name = random_test_string + resource.file_name = '.gitlab-ci.yml' + resource.file_content = <<~YAML + stages: + - test - let(:production_file_content) do - <<~YAML - stages: - - test - - initialize: - stage: test - script: - - echo "initialized in production" - YAML + initialize: + stage: test + script: + - echo "I am now on branch #{random_test_string}" + YAML + end end before do Flow::Login.sign_in project.visit! - Page::Project::Menu.perform(&:go_to_pipeline_editor) + + # Project push sometimes takes a while to complete + # Making sure new branch is pushed successfully prior to interacting + Support::Retrier.retry_until(max_duration: 15, sleep_interval: 3, reload_page: false, message: 'Ensuring project has branch') do + project.has_branch?(random_test_string) + end end after do project.remove_via_api! - Page::Main::Menu.perform(&:sign_out) end - it 'can switch branches and target branch field updates accordingly', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1891' do + it 'can switch branches and target branch field updates accordingly', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347661' do + Page::Project::Menu.perform(&:go_to_pipeline_editor) Page::Project::PipelineEditor::Show.perform do |show| - expect(show).to have_branch_selector_button - - show.click_branch_selector_button - show.select_branch_from_dropdown(production_push.branch_name) + show.open_branch_selector_dropdown + show.select_branch_from_dropdown(random_test_string) - expect(show.target_branch_name).to eq(production_push.branch_name) + aggregate_failures do + expect(show.target_branch_name).to eq(random_test_string), 'Target branch field is not showing expected branch name.' + expect(show.editing_content).to have_content(random_test_string), 'Editor content does not include expected test string.' + end - show.click_branch_selector_button + show.open_branch_selector_dropdown show.select_branch_from_dropdown(project.default_branch) - expect(show.target_branch_name).to eq(project.default_branch) + aggregate_failures do + expect(show.target_branch_name).to eq(project.default_branch), 'Target branch field is not showing expected branch name.' + expect(show.editing_content).to have_content(project.default_branch), 'Editor content does not include expected test string.' + end end end end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb index f599d6b6251..7656aea885e 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/run_pipeline_via_web_only_spec.rb @@ -40,7 +40,7 @@ module QA Page::Project::Menu.perform(&:click_ci_cd_pipelines) end - it 'can trigger pipeline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1650' do + it 'can trigger pipeline', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348011' do Page::Project::Pipeline::Index.perform do |index| expect(index).not_to have_pipeline # should not auto trigger pipeline index.click_run_pipeline_button 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 f803cfdb714..ed46481d3be 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 @@ -30,7 +30,7 @@ module QA runner.remove_via_api! end - it 'can trigger bridge job', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1237' do + it 'can trigger bridge job', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348086' do Page::Project::Pipeline::Show.perform do |parent_pipeline| expect(parent_pipeline).not_to have_child_pipeline 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 0bfbd164331..94ac857f0fe 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 @@ -31,7 +31,7 @@ module QA project.remove_via_api! end - it 'creates 2 trigger jobs and passes corresponding matrix variables', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1824' do + it 'creates 2 trigger jobs and passes corresponding matrix variables', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348000' do Page::Project::Pipeline::Show.perform do |parent_pipeline| trigger_title1 = 'deploy: [ovh, monitoring]' trigger_title2 = 'deploy: [ovh, app]' 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 42aec99d6cf..8aa01888ae3 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 @@ -15,7 +15,7 @@ module QA runner.remove_via_api! end - it 'user registers a new specific runner', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1600' do + it 'user registers a new specific runner', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348025' do Flow::Login.sign_in runner.project.visit! 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 c85920d98ec..f44c56ca0f9 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 @@ -33,7 +33,7 @@ module QA runner.remove_via_api! end - it 'creates an MR with code coverage statistics', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1373' do + it 'creates an MR with code coverage statistics', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348068' do runner.project.visit! configure_code_coverage(simplecov) merge_request.visit! 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 51735d79fbd..e3c06242a9b 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 @@ -14,15 +14,15 @@ module QA end let(:project_deploy_token) do - Resource::DeployToken.fabricate_via_browser_ui! do |deploy_token| + Resource::ProjectDeployToken.fabricate_via_api! do |deploy_token| deploy_token.name = 'registry-deploy-token' deploy_token.project = project - deploy_token.scopes = [ - :read_repository, - :read_package_registry, - :write_package_registry, - :read_registry, - :write_registry + deploy_token.scopes = %w[ + read_repository + read_package_registry + write_package_registry + read_registry + write_registry ] end end @@ -48,37 +48,95 @@ module QA project.remove_via_api! end - where(:authentication_token_type, :token_name) do - :personal_access_token | 'Personal Access Token' - :project_deploy_token | 'Deploy Token' - :ci_job_token | 'Job Token' - end + context "when tls is disabled" do + where(:authentication_token_type, :token_name) do + :personal_access_token | 'Personal Access Token' + :project_deploy_token | 'Deploy Token' + :ci_job_token | 'Job Token' + end - with_them do - let(:auth_token) do - case authentication_token_type - when :personal_access_token - "\"#{personal_access_token}\"" - when :project_deploy_token - "\"#{project_deploy_token.password}\"" - when :ci_job_token - '$CI_JOB_TOKEN' + with_them do + let(:auth_token) do + case authentication_token_type + when :personal_access_token + "\"#{personal_access_token}\"" + when :project_deploy_token + "\"#{project_deploy_token.token}\"" + when :ci_job_token + '$CI_JOB_TOKEN' + end + end + + let(:auth_user) do + case authentication_token_type + when :personal_access_token + "$CI_REGISTRY_USER" + when :project_deploy_token + "\"#{project_deploy_token.username}\"" + when :ci_job_token + 'gitlab-ci-token' + end end - end - let(:auth_user) do - case authentication_token_type - when :personal_access_token - "$CI_REGISTRY_USER" - when :project_deploy_token - "\"#{project_deploy_token.username}\"" - when :ci_job_token - 'gitlab-ci-token' + where(:docker_client_version) do + %w[docker:18.09.9 docker:19.03.12 docker:20.10] + end + + with_them do + it "pushes image and deletes tag", :registry do + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([{ + file_path: '.gitlab-ci.yml', + content: + <<~YAML + build: + image: "#{docker_client_version}" + stage: build + services: + - name: "#{docker_client_version}-dind" + command: ["--insecure-registry=gitlab.test:5050"] + variables: + IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG + script: + - docker login -u #{auth_user} -p #{auth_token} gitlab.test:5050 + - docker build -t $IMAGE_TAG . + - docker push $IMAGE_TAG + tags: + - "runner-for-#{project.name}" + YAML + }]) + end + end + + Flow::Pipeline.visit_latest_pipeline + + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job('build') + end + + Page::Project::Job::Show.perform do |job| + expect(job).to be_successful(timeout: 800) + end + + Page::Project::Menu.perform(&:go_to_container_registry) + + Page::Project::Registry::Show.perform do |registry| + expect(registry).to have_registry_repository(project.path_with_namespace) + + registry.click_on_image(project.path_with_namespace) + expect(registry).to have_tag('master') + end + end end end + end - context "when tls is disabled" do - it "using a #{params[:token_name]}, pushes image and deletes tag", :registry do + context "when tls is enabled" do + it "pushes image and deletes tag", :registry_tls, testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347591' do + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = project commit.commit_message = 'Add .gitlab-ci.yml' @@ -91,11 +149,18 @@ module QA stage: build services: - name: docker:19.03.12-dind - command: ["--insecure-registry=gitlab.test:5050"] + command: + - /bin/sh + - -c + - | + apk add --no-cache openssl + true | openssl s_client -showcerts -connect gitlab.test:5050 > /usr/local/share/ca-certificates/gitlab.test.crt + update-ca-certificates + dockerd-entrypoint.sh || exit variables: IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG script: - - docker login -u #{auth_user} -p #{auth_token} gitlab.test:5050 + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD gitlab.test:5050 - docker build -t $IMAGE_TAG . - docker push $IMAGE_TAG tags: @@ -103,64 +168,6 @@ module QA YAML }]) end - - Flow::Pipeline.visit_latest_pipeline - - Page::Project::Pipeline::Show.perform do |pipeline| - pipeline.click_job('build') - end - - Page::Project::Job::Show.perform do |job| - expect(job).to be_successful(timeout: 800) - end - - Page::Project::Menu.perform(&:go_to_container_registry) - - Page::Project::Registry::Show.perform do |registry| - expect(registry).to have_registry_repository(project.path_with_namespace) - - registry.click_on_image(project.path_with_namespace) - expect(registry).to have_tag('master') - - registry.click_delete - expect(registry).not_to have_tag('master') - end - end - end - end - - context "when tls is enabled" do - it "pushes image and deletes tag", :registry_tls, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2378' do - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([{ - file_path: '.gitlab-ci.yml', - content: - <<~YAML - build: - image: docker:19.03.12 - stage: build - services: - - name: docker:19.03.12-dind - command: - - /bin/sh - - -c - - | - apk add --no-cache openssl - true | openssl s_client -showcerts -connect gitlab.test:5050 > /usr/local/share/ca-certificates/gitlab.test.crt - update-ca-certificates - dockerd-entrypoint.sh || exit - variables: - IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG - script: - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD gitlab.test:5050 - - docker build -t $IMAGE_TAG . - - docker push $IMAGE_TAG - tags: - - "runner-for-#{project.name}" - YAML - }]) end Flow::Pipeline.visit_latest_pipeline diff --git a/qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_spec.rb index 65519cdebec..1df68cc729d 100644 --- a/qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/container_registry/container_registry_spec.rb @@ -49,17 +49,19 @@ module QA registry_repository&.remove_via_api! end - it 'pushes project image to the container registry and deletes tag', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1833' do + it 'pushes project image to the container registry and deletes tag', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347687' do Flow::Login.sign_in project.visit! - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([{ - file_path: '.gitlab-ci.yml', - content: gitlab_ci_yaml - }]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([{ + file_path: '.gitlab-ci.yml', + content: gitlab_ci_yaml + }]) + end end Flow::Pipeline.visit_latest_pipeline diff --git a/qa/qa/specs/features/browser_ui/5_package/container_registry/online_garbage_collection_spec.rb b/qa/qa/specs/features/browser_ui/5_package/container_registry/online_garbage_collection_spec.rb index 82b7af8eba7..e8d936e67b1 100644 --- a/qa/qa/specs/features/browser_ui/5_package/container_registry/online_garbage_collection_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/container_registry/online_garbage_collection_spec.rb @@ -82,18 +82,20 @@ module QA setting.click_save_changes_button end - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = imported_project - commit.branch = 'online-gc-test-builder-poc' - commit.commit_message = 'Update .gitlab-ci.yml' - commit.update_files([{ - file_path: '.gitlab-ci.yml', - content: gitlab_ci_yaml - }]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = imported_project + commit.branch = 'online-gc-test-builder-poc' + commit.commit_message = 'Update .gitlab-ci.yml' + commit.update_files([{ + file_path: '.gitlab-ci.yml', + content: gitlab_ci_yaml + }]) + end end end - it 'runs the online garbage collector tool', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1889' do + it 'runs the online garbage collector tool', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347663' do imported_project.visit! Flow::Pipeline.visit_latest_pipeline 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 b941d5434df..5e0f1911811 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 @@ -46,32 +46,34 @@ module QA with_them do it "pulls an image using the dependency proxy" do - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([{ - file_path: '.gitlab-ci.yml', - content: - <<~YAML - dependency-proxy-pull-test: - image: "#{docker_client_version}" - services: - - name: "#{docker_client_version}-dind" - command: ["--insecure-registry=gitlab.test:80"] - before_script: - - apk add curl jq grep - - echo $CI_DEPENDENCY_PROXY_SERVER - - docker login -u "$CI_DEPENDENCY_PROXY_USER" -p "$CI_DEPENDENCY_PROXY_PASSWORD" gitlab.test:80 - script: - - docker pull #{dependency_proxy_url}/#{image_sha} - - TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq --raw-output .token) - - 'curl --head --header "Authorization: Bearer $TOKEN" "https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest" 2>&1' - - docker pull #{dependency_proxy_url}/#{image_sha} - - 'curl --head --header "Authorization: Bearer $TOKEN" "https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest" 2>&1' - tags: - - "runner-for-#{project.name}" - YAML - }]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([{ + file_path: '.gitlab-ci.yml', + content: + <<~YAML + dependency-proxy-pull-test: + image: "#{docker_client_version}" + services: + - name: "#{docker_client_version}-dind" + command: ["--insecure-registry=gitlab.test:80"] + before_script: + - apk add curl jq grep + - echo $CI_DEPENDENCY_PROXY_SERVER + - docker login -u "$CI_DEPENDENCY_PROXY_USER" -p "$CI_DEPENDENCY_PROXY_PASSWORD" gitlab.test:80 + script: + - docker pull #{dependency_proxy_url}/#{image_sha} + - TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq --raw-output .token) + - 'curl --head --header "Authorization: Bearer $TOKEN" "https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest" 2>&1' + - docker pull #{dependency_proxy_url}/#{image_sha} + - 'curl --head --header "Authorization: Bearer $TOKEN" "https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest" 2>&1' + tags: + - "runner-for-#{project.name}" + YAML + }]) + end end project.visit! 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 9ddf485870d..92e4d64fee4 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 @@ -70,19 +70,20 @@ module QA before do Flow::Login.sign_in - - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([{ - file_path: '.gitlab-ci.yml', - content: gitlab_ci_yaml - }, - { - file_path: 'composer.json', - content: composer_json_file - }] - ) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([{ + file_path: '.gitlab-ci.yml', + content: gitlab_ci_yaml + }, + { + file_path: 'composer.json', + content: composer_json_file + }] + ) + end end project.visit! @@ -102,7 +103,7 @@ module QA package.remove_via_api! end - it 'publishes a composer package and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1634' do + it 'publishes a composer package and deletes it', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348016' do Page::Project::Menu.perform(&:click_packages_link) Page::Project::Packages::Index.perform do |index| 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 126be22d760..15578cd5e6b 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 @@ -41,30 +41,32 @@ module QA package.remove_via_api! end - it 'publishes, installs, and deletes a Conan package', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1638' do + it 'publishes, installs, and deletes a Conan package', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348014' do Flow::Login.sign_in - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([{ - file_path: '.gitlab-ci.yml', - content: - <<~YAML - image: conanio/gcc7 - - test_package: - stage: deploy - script: - - "conan remote add gitlab #{gitlab_address_with_port}/api/v4/projects/#{project.id}/packages/conan" - - "conan new #{package.name}/0.1 -t" - - "conan create . mycompany/stable" - - "CONAN_LOGIN_USERNAME=ci_user CONAN_PASSWORD=${CI_JOB_TOKEN} conan upload #{package.name}/0.1@mycompany/stable --all --remote=gitlab" - - "conan install #{package.name}/0.1@mycompany/stable --remote=gitlab" - tags: - - "runner-for-#{project.name}" - YAML - }]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([{ + file_path: '.gitlab-ci.yml', + content: + <<~YAML + image: conanio/gcc7 + + test_package: + stage: deploy + script: + - "conan remote add gitlab #{gitlab_address_with_port}/api/v4/projects/#{project.id}/packages/conan" + - "conan new #{package.name}/0.1 -t" + - "conan create . mycompany/stable" + - "CONAN_LOGIN_USERNAME=ci_user CONAN_PASSWORD=${CI_JOB_TOKEN} conan upload #{package.name}/0.1@mycompany/stable --all --remote=gitlab" + - "conan install #{package.name}/0.1@mycompany/stable --remote=gitlab" + tags: + - "runner-for-#{project.name}" + YAML + }]) + end end project.visit! 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 86aca120eed..ded90607d67 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 @@ -57,18 +57,20 @@ module QA before do Flow::Login.sign_in - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([{ - file_path: '.gitlab-ci.yml', - content: gitlab_ci_yaml - }, - { - file_path: 'file.txt', - content: file_txt - }] - ) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([{ + file_path: '.gitlab-ci.yml', + content: gitlab_ci_yaml + }, + { + file_path: 'file.txt', + content: file_txt + }] + ) + end end project.visit! @@ -98,7 +100,7 @@ module QA package.remove_via_api! end - it 'uploads a generic package, downloads and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1628' do + it 'uploads a generic package, downloads and deletes it', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348017' do Page::Project::Menu.perform(&:click_packages_link) Page::Project::Packages::Index.perform do |index| diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/helm_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/helm_registry_spec.rb index 3f5e8b1a630..92d0f547764 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/helm_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/helm_registry_spec.rb @@ -88,16 +88,17 @@ module QA when :ci_job_token '${CI_JOB_TOKEN}' when :project_deploy_token - project_deploy_token.password + project_deploy_token.token end end it "pushes and pulls a helm chart" do - # pushing - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = package_project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([package_gitlab_ci_file, package_chart_yaml_file]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = package_project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([package_gitlab_ci_file, package_chart_yaml_file]) + end end package_project.visit! @@ -124,11 +125,12 @@ module QA expect(show).to have_package_info(package_name, package_version) end - # pulling - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = client_project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([client_gitlab_ci_file]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = client_project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([client_gitlab_ci_file]) + end end client_project.visit! diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb index 2aa93de0b9e..57e1aa6a087 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_gradle_repository_spec.rb @@ -97,7 +97,7 @@ module QA when :ci_job_token 'System.getenv("CI_JOB_TOKEN")' when :project_deploy_token - "\"#{project_deploy_token.password}\"" + "\"#{project_deploy_token.token}\"" end end @@ -139,11 +139,12 @@ module QA end it "pushes and pulls a maven package via gradle using #{params[:authentication_token_type]}" do - # pushing - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = package_project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([package_gitlab_ci_file, package_build_gradle_file]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = package_project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([package_gitlab_ci_file, package_build_gradle_file]) + end end package_project.visit! @@ -170,11 +171,12 @@ module QA expect(show).to have_package_info(package_name, package_version) end - # pulling - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = client_project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([client_gitlab_ci_file, client_build_gradle_file]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = client_project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([client_gitlab_ci_file, client_build_gradle_file]) + end end client_project.visit! diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_repository_spec.rb index f42093bffcd..e6591b6adb9 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/maven_repository_spec.rb @@ -142,7 +142,7 @@ module QA when :ci_job_token '${env.CI_JOB_TOKEN}' when :project_deploy_token - project_deploy_token.password + project_deploy_token.token end end @@ -171,15 +171,16 @@ module QA end it "pushes and pulls a maven package via maven using #{params[:authentication_token_type]}" do - # pushing - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = package_project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([ - package_gitlab_ci_file, - package_pom_file, - settings_xml - ]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = package_project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([ + package_gitlab_ci_file, + package_pom_file, + settings_xml + ]) + end end package_project.visit! @@ -206,15 +207,16 @@ module QA expect(show).to have_package_info(package_name, package_version) end - # pulling - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = client_project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([ - client_gitlab_ci_file, - client_pom_file, - settings_xml - ]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = client_project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([ + client_gitlab_ci_file, + client_pom_file, + settings_xml + ]) + end end client_project.visit! @@ -290,14 +292,16 @@ module QA end def push_duplicated_package - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = client_project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([ - package_gitlab_ci_file, - package_pom_file, - settings_xml - ]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = client_project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([ + package_gitlab_ci_file, + package_pom_file, + settings_xml + ]) + end 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 f2b1c1b01a0..c58cdec622d 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 @@ -16,13 +16,13 @@ module QA end let(:project_deploy_token) do - Resource::DeployToken.fabricate_via_browser_ui! do |deploy_token| + Resource::ProjectDeployToken.fabricate_via_api! do |deploy_token| deploy_token.name = 'npm-deploy-token' deploy_token.project = project - deploy_token.scopes = [ - :read_repository, - :read_package_registry, - :write_package_registry + deploy_token.scopes = %w[ + read_repository + read_package_registry + write_package_registry ] end end @@ -151,18 +151,20 @@ module QA when :ci_job_token '${CI_JOB_TOKEN}' when :project_deploy_token - "\"#{project_deploy_token.password}\"" + "\"#{project_deploy_token.token}\"" end end it "push and pull a npm package via CI using a #{params[:token_name]}" do - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([ - gitlab_ci_deploy_yaml, - package_json - ]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([ + gitlab_ci_deploy_yaml, + package_json + ]) + end end project.visit! @@ -176,12 +178,14 @@ module QA expect(job).to be_successful(timeout: 800) end - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = another_project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([ - gitlab_ci_install_yaml - ]) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = another_project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([ + gitlab_ci_install_yaml + ]) + end end another_project.visit! @@ -199,7 +203,7 @@ module QA Page::Project::Artifact::Show.perform do |artifacts| artifacts.go_to_directory('node_modules') artifacts.go_to_directory("@#{registry_scope}") - expect(artifacts).to have_content( "#{project.name}") + expect(artifacts).to have_content("#{project.name}") end project.visit! 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 832f8c7f72c..cec902e073a 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 @@ -16,13 +16,13 @@ module QA end let(:project_deploy_token) do - Resource::DeployToken.fabricate_via_browser_ui! do |deploy_token| + Resource::ProjectDeployToken.fabricate_via_api! do |deploy_token| deploy_token.name = 'npm-deploy-token' deploy_token.project = project - deploy_token.scopes = [ - :read_repository, - :read_package_registry, - :write_package_registry + deploy_token.scopes = %w[ + read_repository + read_package_registry + write_package_registry ] end end @@ -91,7 +91,7 @@ module QA file_path: 'package.json', content: <<~JSON { - "name": "@#{registry_scope}/mypackage", + "name": "#{package.name}", "version": "1.0.0", "description": "Example package for GitLab npm registry", "publishConfig": { @@ -129,11 +129,11 @@ module QA when :ci_job_token '${CI_JOB_TOKEN}' when :project_deploy_token - "\"#{project_deploy_token.password}\"" + "\"#{project_deploy_token.token}\"" end end - it "push and pull a npm package via CI using a #{params[:token_name]}", quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/344537', type: :investigating } do + it "push and pull a npm package via CI using a #{params[:token_name]}" do Resource::Repository::Commit.fabricate_via_api! do |commit| commit.project = project commit.commit_message = 'Add .gitlab-ci.yml' @@ -168,7 +168,7 @@ module QA Page::Project::Artifact::Show.perform do |artifacts| artifacts.go_to_directory('node_modules') artifacts.go_to_directory("@#{registry_scope}") - expect(artifacts).to have_content("mypackage") + expect(artifacts).to have_content('mypackage') end project.visit! diff --git a/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget_repository_spec.rb index 0b4825715c1..d63bf486f11 100644 --- a/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/package_registry/nuget_repository_spec.rb @@ -9,6 +9,7 @@ module QA Resource::Project.fabricate_via_api! do |project| project.name = 'nuget-package-project' project.template_name = 'dotnetcore' + project.visibility = :private end end @@ -21,9 +22,14 @@ module QA end let(:group_deploy_token) do - Resource::GroupDeployToken.fabricate_via_browser_ui! do |deploy_token| + Resource::GroupDeployToken.fabricate_via_api! do |deploy_token| deploy_token.name = 'nuget-group-deploy-token' deploy_token.group = project.group + deploy_token.scopes = %w[ + read_repository + read_package_registry + write_package_registry + ] end end @@ -70,7 +76,7 @@ module QA when :ci_job_token '${CI_JOB_TOKEN}' when :group_deploy_token - "\"#{group_deploy_token.password}\"" + "\"#{group_deploy_token.token}\"" end end @@ -88,35 +94,37 @@ module QA it "publishes a nuget package at the project level, installs and deletes it at the group level using a #{params[:token_name]}" do Flow::Login.sign_in - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.update_files( - [ - { - file_path: '.gitlab-ci.yml', - content: <<~YAML - image: mcr.microsoft.com/dotnet/sdk:5.0 - - stages: - - deploy - - deploy: - stage: deploy - script: - - dotnet restore -p:Configuration=Release - - dotnet build -c Release - - dotnet pack -c Release -p:PackageID=#{package.name} - - dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username #{auth_token_username} --password #{auth_token_password} --store-password-in-clear-text - - dotnet nuget push "bin/Release/*.nupkg" --source gitlab - rules: - - if: '$CI_COMMIT_BRANCH == "#{project.default_branch}"' - tags: - - "runner-for-#{project.group.name}" - YAML - } - ] - ) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.update_files( + [ + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + image: mcr.microsoft.com/dotnet/sdk:5.0 + + stages: + - deploy + + deploy: + stage: deploy + script: + - dotnet restore -p:Configuration=Release + - dotnet build -c Release + - dotnet pack -c Release -p:PackageID=#{package.name} + - dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username #{auth_token_username} --password #{auth_token_password} --store-password-in-clear-text + - dotnet nuget push "bin/Release/*.nupkg" --source gitlab + rules: + - if: '$CI_COMMIT_BRANCH == "#{project.default_branch}"' + tags: + - "runner-for-#{project.group.name}" + YAML + } + ] + ) + end end project.visit! @@ -132,50 +140,52 @@ module QA another_project.visit! - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = another_project - commit.commit_message = 'Add new csproj file' - commit.add_files( - [ - { - file_path: 'otherdotnet.csproj', - content: <<~EOF - <Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <OutputType>Exe</OutputType> - <TargetFramework>net5.0</TargetFramework> - </PropertyGroup> - - </Project> - EOF - } - ] - ) - commit.update_files( - [ - { - file_path: '.gitlab-ci.yml', - content: <<~YAML - image: mcr.microsoft.com/dotnet/sdk:5.0 - - stages: - - install - - install: - stage: install - script: - - dotnet nuget locals all --clear - - dotnet nuget add source "$CI_SERVER_URL/api/v4/groups/#{another_project.group.id}/-/packages/nuget/index.json" --name gitlab --username #{auth_token_username} --password #{auth_token_password} --store-password-in-clear-text - - "dotnet add otherdotnet.csproj package #{package.name} --version 1.0.0" - only: - - "#{another_project.default_branch}" - tags: - - "runner-for-#{project.group.name}" - YAML - } - ] - ) + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = another_project + commit.commit_message = 'Add new csproj file' + commit.add_files( + [ + { + file_path: 'otherdotnet.csproj', + content: <<~EOF + <Project Sdk="Microsoft.NET.Sdk"> + + <PropertyGroup> + <OutputType>Exe</OutputType> + <TargetFramework>net5.0</TargetFramework> + </PropertyGroup> + + </Project> + EOF + } + ] + ) + commit.update_files( + [ + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + image: mcr.microsoft.com/dotnet/sdk:5.0 + + stages: + - install + + install: + stage: install + script: + - dotnet nuget locals all --clear + - dotnet nuget add source "$CI_SERVER_URL/api/v4/groups/#{another_project.group.id}/-/packages/nuget/index.json" --name gitlab --username #{auth_token_username} --password #{auth_token_password} --store-password-in-clear-text + - "dotnet add otherdotnet.csproj package #{package.name} --version 1.0.0" + only: + - "#{another_project.default_branch}" + tags: + - "runner-for-#{project.group.name}" + YAML + } + ] + ) + end end Flow::Pipeline.visit_latest_pipeline 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 e727a89a584..2e7bd8fc5d7 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 @@ -34,58 +34,60 @@ module QA before do Flow::Login.sign_in - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = project - commit.commit_message = 'Add .gitlab-ci.yml' - commit.add_files([{ - file_path: '.gitlab-ci.yml', - content: - <<~YAML - image: python:latest - stages: - - run - - install - - run: - stage: run - script: - - pip install twine - - python setup.py sdist bdist_wheel - - "TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url #{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/*" - tags: + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files([{ + file_path: '.gitlab-ci.yml', + content: + <<~YAML + image: python:latest + stages: + - run + - install + + run: + stage: run + script: + - pip install twine + - python setup.py sdist bdist_wheel + - "TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url #{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/*" + tags: + - "runner-for-#{project.name}" + install: + stage: install + script: + - "pip install #{package.name} --no-deps --index-url #{uri.scheme}://#{personal_access_token}:#{personal_access_token}@#{gitlab_host_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/pypi/simple --trusted-host #{gitlab_host_with_port}" + tags: - "runner-for-#{project.name}" - install: - stage: install - script: - - "pip install #{package.name} --no-deps --index-url #{uri.scheme}://#{personal_access_token}:#{personal_access_token}@#{gitlab_host_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/pypi/simple --trusted-host #{gitlab_host_with_port}" - tags: - - "runner-for-#{project.name}" - - YAML - }, - { - file_path: 'setup.py', - content: - <<~EOF - import setuptools - - setuptools.setup( - name="#{package.name}", - version="0.0.1", - author="Example Author", - author_email="author@example.com", - description="A small example package", - packages=setuptools.find_packages(), - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: OS Independent", - ], - python_requires='>=3.6', - ) - EOF - - }]) + + YAML + }, + { + file_path: 'setup.py', + content: + <<~EOF + import setuptools + + setuptools.setup( + name="#{package.name}", + version="0.0.1", + author="Example Author", + author_email="author@example.com", + description="A small example package", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + python_requires='>=3.6', + ) + EOF + + }]) + end end project.visit! @@ -117,7 +119,7 @@ module QA end context 'when at the project level' do - it 'publishes and installs a pypi package and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1635' do + it 'publishes and installs a pypi package and deletes it', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348015' do Page::Project::Menu.perform(&:click_packages_link) Page::Project::Packages::Index.perform do |index| @@ -137,7 +139,7 @@ module QA end context 'Geo', :orchestrated, :geo do - it 'replicates a published pypi package to the Geo secondary site', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1219', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/325556', type: :investigating } do + it 'replicates a published pypi package to the Geo secondary site', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348090', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/325556', type: :investigating } do QA::Runtime::Logger.debug('Visiting the secondary Geo site') QA::Flow::Login.while_signed_in(address: :geo_secondary) do 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 ecf14a25b8d..062d2b49deb 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 @@ -43,94 +43,96 @@ module QA project.remove_via_api! end - it 'publishes and deletes a Ruby gem', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1906' do + it 'publishes and deletes a Ruby gem', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347649' do Flow::Login.sign_in - Resource::Repository::Commit.fabricate_via_api! do |commit| - commit.project = project - commit.commit_message = 'Add package files' - commit.add_files( - [ - { - file_path: '.gitlab-ci.yml', - content: - <<~YAML - image: ruby - - test_package: - stage: deploy - before_script: - - mkdir ~/.gem - - echo "---" > ~/.gem/credentials - - | - echo "#{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems: '${CI_JOB_TOKEN}'" >> ~/.gem/credentials - - chmod 0600 ~/.gem/credentials - script: - - gem build #{package.name} - - gem push #{package.name}-0.0.1.gem --host #{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems - tags: - - "runner-for-#{project.name}" - YAML - }, - { - file_path: 'lib/hello_gem.rb', - content: - <<~RUBY - class HelloWorld - def self.hi - puts "Hello world!" + Support::Retrier.retry_on_exception(max_attempts: 3, sleep_interval: 2) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add package files' + commit.add_files( + [ + { + file_path: '.gitlab-ci.yml', + content: + <<~YAML + image: ruby + + test_package: + stage: deploy + before_script: + - mkdir ~/.gem + - echo "---" > ~/.gem/credentials + - | + echo "#{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems: '${CI_JOB_TOKEN}'" >> ~/.gem/credentials + - chmod 0600 ~/.gem/credentials + script: + - gem build #{package.name} + - gem push #{package.name}-0.0.1.gem --host #{gitlab_address_with_port}/api/v4/projects/${CI_PROJECT_ID}/packages/rubygems + tags: + - "runner-for-#{project.name}" + YAML + }, + { + file_path: 'lib/hello_gem.rb', + content: + <<~RUBY + class HelloWorld + def self.hi + puts "Hello world!" + end end - end - RUBY - }, - { - file_path: "#{package.name}.gemspec", - content: - <<~RUBY - # frozen_string_literal: true - - Gem::Specification.new do |s| - s.name = '#{package.name}' - s.authors = ['Tanuki Steve', 'Hal 9000'] - s.author = 'Tanuki Steve' - s.version = '0.0.1' - s.date = '2011-09-29' - s.summary = 'this is a test package' - s.files = ['lib/hello_gem.rb'] - s.require_paths = ['lib'] - - s.description = 'A test package for GitLab.' - s.email = 'tanuki@not_real.com' - s.homepage = 'https://gitlab.com/ruby-co/my-package' - s.license = 'MIT' - - s.metadata = { - 'bug_tracker_uri' => 'https://gitlab.com/ruby-co/my-package/issues', - 'changelog_uri' => 'https://gitlab.com/ruby-co/my-package/CHANGELOG.md', - 'documentation_uri' => 'https://gitlab.com/ruby-co/my-package/docs', - 'mailing_list_uri' => 'https://gitlab.com/ruby-co/my-package/mailme', - 'source_code_uri' => 'https://gitlab.com/ruby-co/my-package' - } - - s.bindir = 'bin' - s.platform = Gem::Platform::RUBY - s.post_install_message = 'Installed, thank you!' - s.rdoc_options = ['--main'] - s.required_ruby_version = '>= 2.7.0' - s.required_rubygems_version = '>= 1.8.11' - s.requirements = 'A high powered server or calculator' - s.rubygems_version = '1.8.09' - - s.add_dependency 'dependency_1', '~> 1.2.3' - s.add_dependency 'dependency_2', '3.0.0' - s.add_dependency 'dependency_3', '>= 1.0.0' - s.add_dependency 'dependency_4' - end - - RUBY - } - ] - ) + RUBY + }, + { + file_path: "#{package.name}.gemspec", + content: + <<~RUBY + # frozen_string_literal: true + + Gem::Specification.new do |s| + s.name = '#{package.name}' + s.authors = ['Tanuki Steve', 'Hal 9000'] + s.author = 'Tanuki Steve' + s.version = '0.0.1' + s.date = '2011-09-29' + s.summary = 'this is a test package' + s.files = ['lib/hello_gem.rb'] + s.require_paths = ['lib'] + + s.description = 'A test package for GitLab.' + s.email = 'tanuki@not_real.com' + s.homepage = 'https://gitlab.com/ruby-co/my-package' + s.license = 'MIT' + + s.metadata = { + 'bug_tracker_uri' => 'https://gitlab.com/ruby-co/my-package/issues', + 'changelog_uri' => 'https://gitlab.com/ruby-co/my-package/CHANGELOG.md', + 'documentation_uri' => 'https://gitlab.com/ruby-co/my-package/docs', + 'mailing_list_uri' => 'https://gitlab.com/ruby-co/my-package/mailme', + 'source_code_uri' => 'https://gitlab.com/ruby-co/my-package' + } + + s.bindir = 'bin' + s.platform = Gem::Platform::RUBY + s.post_install_message = 'Installed, thank you!' + s.rdoc_options = ['--main'] + s.required_ruby_version = '>= 2.7.0' + s.required_rubygems_version = '>= 1.8.11' + s.requirements = 'A high powered server or calculator' + s.rubygems_version = '1.8.09' + + s.add_dependency 'dependency_1', '~> 1.2.3' + s.add_dependency 'dependency_2', '3.0.0' + s.add_dependency 'dependency_3', '>= 1.0.0' + s.add_dependency 'dependency_4' + end + + RUBY + } + ] + ) + end end project.visit! diff --git a/qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb b/qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb index 8878b719a21..260c812420c 100644 --- a/qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Release' do describe 'Deploy key creation' do - it 'user adds a deploy key', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1602' do + it 'user adds a deploy key', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348023' do Flow::Login.sign_in key = Runtime::Key::RSA.new diff --git a/qa/qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb b/qa/qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb index 81ccc585cf9..9811453605e 100644 --- a/qa/qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb @@ -3,20 +3,20 @@ module QA RSpec.describe 'Release' do describe 'Deploy token creation' do - it 'user adds a deploy token', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1582' do + it 'user adds a deploy token', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348028' do Flow::Login.sign_in deploy_token_name = 'deploy token name' one_week_from_now = Date.today + 7 - deploy_token = Resource::DeployToken.fabricate_via_browser_ui! do |resource| + deploy_token = Resource::ProjectDeployToken.fabricate_via_api! do |resource| resource.name = deploy_token_name resource.expires_at = one_week_from_now - resource.scopes = [:read_repository] + resource.scopes = %w[read_repository] end expect(deploy_token.username.length).to be > 0 - expect(deploy_token.password.length).to be > 0 + expect(deploy_token.token.length).to be > 0 end end end diff --git a/qa/qa/specs/features/browser_ui/6_release/pages/pages_pipeline_spec.rb b/qa/qa/specs/features/browser_ui/6_release/pages/pages_pipeline_spec.rb index 97f52ea7ec1..d1d2340e5f1 100644 --- a/qa/qa/specs/features/browser_ui/6_release/pages/pages_pipeline_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/pages/pages_pipeline_spec.rb @@ -31,7 +31,7 @@ module QA pipeline.visit! end - it 'runs a Pages-specific pipeline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1879' do + it 'runs a Pages-specific pipeline', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347669' do Page::Project::Pipeline::Show.perform do |show| expect(show).to have_job(:pages) show.click_job(:pages) diff --git a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb index 46640b1a540..e34f41b4c95 100644 --- a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_dependent_relationship_spec.rb @@ -25,7 +25,7 @@ module QA runner.remove_via_api! end - it 'parent pipelines passes if child passes', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1198' do + it 'parent pipelines passes if child passes', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348092' do add_ci_files(success_child_ci_file) Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') @@ -35,7 +35,7 @@ module QA end end - it 'parent pipeline fails if child fails', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1199' do + it 'parent pipeline fails if child fails', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348091' do add_ci_files(fail_child_ci_file) Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') diff --git a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb index dac89663f84..74a81ff429d 100644 --- a/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/pipeline/parent_child_pipelines_independent_relationship_spec.rb @@ -25,7 +25,7 @@ module QA runner.remove_via_api! end - it 'parent pipelines passes if child passes', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1191' do + it 'parent pipelines passes if child passes', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348093' do add_ci_files(success_child_ci_file) Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') @@ -35,7 +35,7 @@ module QA end end - it 'parent pipeline passes even if child fails', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1190' do + it 'parent pipeline passes even if child fails', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348094' do add_ci_files(fail_child_ci_file) Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') 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 e20b76f6bf8..70321dcafe4 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 @@ -22,7 +22,7 @@ module QA project.remove_via_api! end - it 'runs auto devops', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1422' do + it 'runs auto devops', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348061' do Flow::Login.sign_in Resource::KubernetesCluster::ProjectCluster.fabricate! do |k8s_cluster| diff --git a/qa/qa/specs/features/browser_ui/7_configure/kubernetes/kubernetes_integration_spec.rb b/qa/qa/specs/features/browser_ui/7_configure/kubernetes/kubernetes_integration_spec.rb index b928eae62e6..94f9e9ec1f6 100644 --- a/qa/qa/specs/features/browser_ui/7_configure/kubernetes/kubernetes_integration_spec.rb +++ b/qa/qa/specs/features/browser_ui/7_configure/kubernetes/kubernetes_integration_spec.rb @@ -20,7 +20,7 @@ module QA cluster.remove! end - it 'can create and associate a project cluster', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1419' do + it 'can create and associate a project cluster', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348062' do Resource::KubernetesCluster::ProjectCluster.fabricate_via_browser_ui! do |k8s_cluster| k8s_cluster.project = project k8s_cluster.cluster = cluster diff --git a/qa/qa/specs/features/browser_ui/8_monitor/all_monitor_core_features_spec.rb b/qa/qa/specs/features/browser_ui/8_monitor/all_monitor_core_features_spec.rb index 14bd6af815e..c13d2d2dddf 100644 --- a/qa/qa/specs/features/browser_ui/8_monitor/all_monitor_core_features_spec.rb +++ b/qa/qa/specs/features/browser_ui/8_monitor/all_monitor_core_features_spec.rb @@ -10,13 +10,13 @@ module QA @project.visit! end - it 'configures custom metrics', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1334' do + it 'configures custom metrics', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348082' do verify_add_custom_metric verify_edit_custom_metric verify_delete_custom_metric end - it 'duplicates to create dashboard to custom', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1335' do + it 'duplicates to create dashboard to custom', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348070' do Page::Project::Menu.perform(&:go_to_monitor_metrics) Page::Project::Monitor::Metrics::Show.perform do |on_dashboard| @@ -27,7 +27,7 @@ module QA end end - it 'verifies data on filtered deployed environment', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1332' do + it 'verifies data on filtered deployed environment', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348071' do Page::Project::Menu.perform(&:go_to_monitor_metrics) Page::Project::Monitor::Metrics::Show.perform do |on_dashboard| @@ -37,7 +37,7 @@ module QA end end - it 'filters using the quick range', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1333' do + it 'filters using the quick range', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348083' do Page::Project::Menu.perform(&:go_to_monitor_metrics) Page::Project::Monitor::Metrics::Show.perform do |on_dashboard| @@ -52,7 +52,7 @@ module QA end end - it 'observes cluster health graph', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1311' do + it 'observes cluster health graph', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/348074' do Page::Project::Menu.perform(&:go_to_infrastructure_kubernetes) Page::Project::Infrastructure::Kubernetes::Index.perform do |cluster_list| @@ -65,7 +65,7 @@ module QA end end - it 'uses templating variables for metrics dashboards', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/1926' do + it 'uses templating variables for metrics dashboards', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347636' do templating_dashboard_yml = Pathname .new(__dir__) .join('../../../../fixtures/metrics_dashboards/templating.yml') diff --git a/qa/qa/support/formatters/test_stats_formatter.rb b/qa/qa/support/formatters/test_stats_formatter.rb index b54b6a51d11..6f6291b5856 100644 --- a/qa/qa/support/formatters/test_stats_formatter.rb +++ b/qa/qa/support/formatters/test_stats_formatter.rb @@ -167,7 +167,7 @@ module QA # @param [String] location # @return [String, nil] def devops_stage(file_path) - file_path.match(%r{(\d{1,2}_\w+)/})&.captures&.first + file_path.match(%r{\d{1,2}_(\w+)/})&.captures&.first end end end diff --git a/qa/qa/tools/knapsack_report.rb b/qa/qa/tools/knapsack_report.rb new file mode 100644 index 00000000000..fb405e82e83 --- /dev/null +++ b/qa/qa/tools/knapsack_report.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +require "fog/google" + +module QA + module Tools + class KnapsackReport + PROJECT = "gitlab-qa-resources" + BUCKET = "knapsack-reports" + + class << self + def download + new.download_report + end + + def upload(glob) + new.upload_report(glob) + end + end + + def initialize + ENV["KNAPSACK_REPORT_PATH"] || raise("KNAPSACK_REPORT_PATH env var is required!") + ENV["QA_KNAPSACK_REPORT_GCS_CREDENTIALS"] || raise("QA_KNAPSACK_REPORT_GCS_CREDENTIALS env var is required!") + end + + # Download knapsack report from gcs bucket + # + # @return [void] + def download_report + logger.info("Downloading latest knapsack report '#{report_file}'") + file = client.get_object(BUCKET, report_file) + + logger.info("Saving latest knapsack report to '#{report_path}'") + File.write(report_path, file[:body]) + end + + # Merge and upload knapsack report to gcs bucket + # + # @param [String] glob + # @return [void] + def upload_report(glob) + reports = Dir[glob] + return logger.error("Pattern '#{glob}' did not match any files!") if reports.empty? + + report = reports + .map { |path| JSON.parse(File.read(path)) } + .reduce({}, :merge) + return logger.error("Knapsack generated empty report, skipping upload!") if report.empty? + + logger.info("Uploading latest knapsack report '#{report_file}'") + client.put_object(BUCKET, report_file, JSON.pretty_generate(report)) + end + + private + + # Logger instance + # + # @return [Logger] + def logger + @logger ||= Logger.new($stdout) + end + + # GCS client + # + # @return [Fog::Storage::GoogleJSON] + def client + @client ||= Fog::Storage::Google.new( + google_project: PROJECT, + google_json_key_location: ENV["QA_KNAPSACK_REPORT_GCS_CREDENTIALS"] + ) + end + + # Knapsack report path + # + # @return [String] + def report_path + @report_path ||= ENV["KNAPSACK_REPORT_PATH"] + end + + # Knapsack report name + # + # @return [String] + def report_file + @report_name ||= report_path.split("/").last + end + end + end +end diff --git a/qa/qa/tools/reliable_report.rb b/qa/qa/tools/reliable_report.rb index 9d2079171c1..40a452be36e 100644 --- a/qa/qa/tools/reliable_report.rb +++ b/qa/qa/tools/reliable_report.rb @@ -1,111 +1,223 @@ # frozen_string_literal: true +require_relative "../../qa" + require "influxdb-client" require "terminal-table" require "slack-notifier" +require "colorize" module QA module Tools class ReliableReport - def initialize(run_type, range = 30) - @results = 10 - @slack_channel = "#quality-reports" + include Support::API + + # Project for report creation: https://gitlab.com/gitlab-org/gitlab + PROJECT_ID = 278964 + + def initialize(range) @range = range - @run_type = run_type - @stable_title = "Top #{results} stable specs for past #{@range} days in '#{run_type}' runs" - @unstable_title = "Top #{results} unstable reliable specs for past #{@range} days in '#{run_type}' runs" + @influxdb_bucket = "e2e-test-stats" + @slack_channel = "#quality-reports" + @influxdb_url = ENV["QA_INFLUXDB_URL"] || raise("Missing QA_INFLUXDB_URL env variable") + @influxdb_token = ENV["QA_INFLUXDB_TOKEN"] || raise("Missing QA_INFLUXDB_TOKEN env variable") end - # Print top stable specs + # Run reliable reporter # + # @param [Integer] range amount of days for results range + # @param [String] report_in_issue_and_slack # @return [void] - def show_top_stable - puts terminal_table( - rows: top_stable.map { |k, v| [name_column(k, v[:file]), *table_params(v.values)] }, - title: stable_title - ) + def self.run(range: 14, report_in_issue_and_slack: "false") + reporter = new(range) + + reporter.print_report + reporter.report_in_issue_and_slack if report_in_issue_and_slack == "true" + rescue StandardError => e + puts "Report creation failed! Error: '#{e}'".colorize(:red) + reporter.notify_failure(e) + exit(1) end - # Post top stable spec report to slack - # Slice table in to multiple messages due to max char limitation + # Print top stable specs # # @return [void] - def notify_top_stable - tables = top_stable.each_slice(5).map do |slice| - terminal_table( - rows: slice.map { |spec| [name_column(spec[0], spec[1][:file]), *table_params(spec[1].values)] } - ) - end + def print_report + puts "#{stable_summary_table}\n\n" + stable_results_tables.each { |stage, table| puts "#{table}\n\n" } + return puts("No unstable reliable tests present!".colorize(:yellow)) if unstable_reliable_test_runs.empty? - puts "\nSending top stable spec report to #{slack_channel} slack channel" - slack_args = { icon_emoji: ":mtg_green:", username: "Stable Spec Report" } - notifier.post(text: "*#{stable_title}*", **slack_args) - tables.each { |table| notifier.post(text: "```#{table}```", **slack_args) } + puts "#{unstable_summary_table}\n\n" + unstable_reliable_results_tables.each { |stage, table| puts "#{table}\n\n" } end - # Print top unstable specs + # Create report issue # # @return [void] - def show_top_unstable - return puts("No unstable tests present!") if top_unstable_reliable.empty? + def report_in_issue_and_slack + puts "Creating report".colorize(:green) + response = post( + "#{gitlab_api_url}/projects/#{PROJECT_ID}/issues", + { title: "Reliable spec report", description: report_issue_body, labels: "Quality,test" }, + headers: { "PRIVATE-TOKEN" => gitlab_access_token } + ) + web_url = parse_body(response)[:web_url] + puts "Created report issue: #{web_url}" - puts terminal_table( - rows: top_unstable_reliable.map { |k, v| [name_column(k, v[:file]), *table_params(v.values)] }, - title: unstable_title + puts "Sending slack notification".colorize(:green) + notifier.post( + icon_emoji: ":tanuki-protect:", + text: <<~TEXT + ```#{stable_summary_table}``` + ```#{unstable_summary_table}``` + + #{web_url} + TEXT ) + puts "Done!" end - # Post top unstable reliable spec report to slack - # Slice table in to multiple messages due to max char limitation + # Notify failure # + # @param [StandardError] error # @return [void] - def notify_top_unstable - return puts("No unstable tests present!") if top_unstable_reliable.empty? + def notify_failure(error) + notifier.post( + text: "Reliable reporter failed to create report. Error: ```#{error}```", + icon_emoji: ":sadpanda:" + ) + end - tables = top_unstable_reliable.each_slice(5).map do |slice| - terminal_table( - rows: slice.map { |spec| [name_column(spec[0], spec[1][:file]), *table_params(spec[1].values)] } - ) - end + private - puts "\nSending top unstable reliable spec report to #{slack_channel} slack channel" - slack_args = { icon_emoji: ":sadpanda:", username: "Unstable Spec Report" } - notifier.post(text: "*#{unstable_title}*", **slack_args) - tables.each { |table| notifier.post(text: "```#{table}```", **slack_args) } + attr_reader :range, :influxdb_bucket, :slack_channel, :influxdb_url, :influxdb_token + + # Markdown formatted report issue body + # + # @return [String] + def report_issue_body + issue = [] + issue << "[[_TOC_]]" + issue << "# Candidates for promotion to reliable\n\n```\n#{stable_summary_table}\n```" + issue << results_markdown(stable_results_tables) + return issue.join("\n\n") if unstable_reliable_test_runs.empty? + + issue << "# Reliable specs with failures\n\n```\n#{unstable_summary_table}\n```" + issue << results_markdown(unstable_reliable_results_tables) + issue.join("\n\n") end - private + # Stable spec summary table + # + # @return [Terminal::Table] + def stable_summary_table + @stable_summary_table ||= terminal_table( + rows: stable_test_runs.map { |stage, specs| [stage, specs.length] }, + title: "Stable spec summary for past #{range} days".ljust(50), + headings: %w[STAGE COUNT] + ) + end - attr_reader :results, - :slack_channel, - :range, - :run_type, - :stable_title, - :unstable_title + # Unstable reliable summary table + # + # @return [Terminal::Table] + def unstable_summary_table + @unstable_summary_table ||= terminal_table( + rows: unstable_reliable_test_runs.map { |stage, specs| [stage, specs.length] }, + title: "Unstable spec summary for past #{range} days".ljust(50), + headings: %w[STAGE COUNT] + ) + end - # Top stable specs + # Result tables for stable specs # # @return [Hash] - def top_stable - @top_stable ||= runs(reliable: false).sort_by { |k, v| [v[:failure_rate], -v[:runs]] }[0..results - 1].to_h + def stable_results_tables + @stable_results ||= results_tables(:stable) end - # Top unstable reliable specs + # Result table for unstable specs # # @return [Hash] - def top_unstable_reliable - @top_unstable_reliable ||= runs(reliable: true) - .reject { |k, v| v[:failure_rate] == 0 } - .sort_by { |k, v| -v[:failure_rate] }[0..results - 1] - .to_h + def unstable_reliable_results_tables + @unstable_results ||= results_tables(:unstable) + end + + # Markdown formatted tables + # + # @param [Hash] results + # @return [String] + def results_markdown(results) + results.map do |stage, table| + <<~STAGE.strip + ## #{stage} + + <details> + <summary>Executions table</summary> + + ``` + #{table} + ``` + + </details> + STAGE + end.join("\n\n") + end + + # Results table + # + # @param [Symbol] type result type - :stable, :unstable + # @return [Hash<Symbol, Terminal::Table>] + def results_tables(type) + (type == :stable ? stable_test_runs : unstable_reliable_test_runs).to_h do |stage, specs| + headings = ["name", "runs", "failures", "failure rate"] + + [stage, terminal_table( + rows: specs.map { |k, v| [name_column(k, v[:file]), *table_params(v.values)] }, + title: "Top #{type} specs in '#{stage}' stage for past #{range} days", + headings: headings.map(&:upcase) + )] + end + end + + # Stable specs + # + # @return [Hash] + def stable_test_runs + @top_stable ||= begin + stable_specs = test_runs(reliable: false).transform_values do |specs| + specs + .reject { |k, v| v[:failure_rate] != 0 } + .sort_by { |k, v| -v[:runs] } + .to_h + end + + stable_specs.reject { |k, v| v.empty? } + end + end + + # Unstable reliable specs + # + # @return [Hash] + def unstable_reliable_test_runs + @top_unstable_reliable ||= begin + unstable = test_runs(reliable: true).transform_values do |specs| + specs + .reject { |k, v| v[:failure_rate] == 0 } + .sort_by { |k, v| -v[:failure_rate] } + .to_h + end + + unstable.reject { |k, v| v.empty? } + end end # Terminal table for result formatting # # @return [Terminal::Table] - def terminal_table(rows:, title: nil) + def terminal_table(rows:, headings:, title: nil) Terminal::Table.new( - headings: ["name", "runs", "failed", "failure rate"], + headings: headings, style: { all_separators: true }, title: title, rows: rows @@ -126,30 +238,32 @@ module QA # @param [String] file # @return [String] def name_column(name, file) - spec_name = name.length > 100 ? "#{name} ".scan(/.{1,100} /).map(&:strip).join("\n") : name + spec_name = name.length > 150 ? "#{name} ".scan(/.{1,150} /).map(&:strip).join("\n") : name name_line = "name: '#{spec_name}'" file_line = "file: '#{file}'" - "#{name_line}\n#{file_line.ljust(110)}" + "#{name_line}\n#{file_line.ljust(160)}" end # Test executions grouped by name # # @param [Boolean] reliable - # @return [Hash] - def runs(reliable:) - puts("Fetching data on #{reliable ? 'reliable ' : ''}test execution for past 30 days in '#{run_type}' runs") - puts + # @return [Hash<String, Hash>] + def test_runs(reliable:) + puts("Fetching data on #{reliable ? 'reliable ' : ''}test execution for past #{range} days\n".colorize(:green)) - query_api.query(query: query(reliable)).values.each_with_object({}) do |table, result| + all_runs = query_api.query(query: query(reliable)).values + all_runs.each_with_object(Hash.new { |hsh, key| hsh[key] = {} }) do |table, result| records = table.records name = records.last.values["name"] file = records.last.values["file_path"].split("/").last + stage = records.last.values["stage"] || "unknown" + runs = records.count failed = records.count { |r| r.values["status"] == "failed" } failure_rate = (failed.to_f / runs.to_f) * 100 - result[name] = { + result[stage][name] = { file: file, runs: runs, failed: failed, @@ -164,17 +278,24 @@ module QA # @return [String] def query(reliable) <<~QUERY - from(bucket: "e2e-test-stats") - |> range(start: -#{range}d) - |> filter(fn: (r) => r._measurement == "test-stats" and - r.run_type == "#{run_type}" and - r.status != "pending" and - r.merge_request == "false" and - r.quarantined == "false" and - r.reliable == "#{reliable}" and - r._field == "id" - ) - |> group(columns: ["name"]) + from(bucket: "#{influxdb_bucket}") + |> range(start: -#{range}d) + |> filter(fn: (r) => r._measurement == "test-stats") + |> filter(fn: (r) => r.run_type == "staging-full" or + r.run_type == "staging-sanity" or + r.run_type == "staging-sanity-no-admin" or + r.run_type == "production-full" or + r.run_type == "production-sanity" or + r.run_type == "package-and-qa" or + r.run_type == "nightly" + ) + |> filter(fn: (r) => r.status != "pending" and + r.merge_request == "false" and + r.quarantined == "false" and + r.reliable == "#{reliable}" and + r._field == "id" + ) + |> group(columns: ["name"]) QUERY end @@ -192,7 +313,7 @@ module QA @influx_client ||= InfluxDB2::Client.new( influxdb_url, influxdb_token, - bucket: "e2e-test-stats", + bucket: influxdb_bucket, org: "gitlab-qa", precision: InfluxDB2::WritePrecision::NANOSECOND ) @@ -205,29 +326,29 @@ module QA @notifier ||= Slack::Notifier.new( slack_webhook_url, channel: slack_channel, - username: "Reliable spec reporter" + username: "Reliable Spec Report" ) end - # InfluxDb instance url + # Gitlab access token # # @return [String] - def influxdb_url - @influxdb_url ||= ENV["QA_INFLUXDB_URL"] || raise("Missing QA_INFLUXDB_URL environment variable") + def gitlab_access_token + @gitlab_access_token ||= ENV["GITLAB_ACCESS_TOKEN"] || raise("Missing GITLAB_ACCESS_TOKEN env variable") end - # Influxdb token + # Gitlab api url # # @return [String] - def influxdb_token - @influxdb_token ||= ENV["QA_INFLUXDB_TOKEN"] || raise("Missing QA_INFLUXDB_TOKEN environment variable") + def gitlab_api_url + @gitlab_api_url ||= ENV["CI_API_V4_URL"] || raise("Missing CI_API_V4_URL env variable") end # Slack webhook url # # @return [String] def slack_webhook_url - @slack_webhook_url ||= ENV["CI_SLACK_WEBHOOK_URL"] || raise("Missing CI_SLACK_WEBHOOK_URL environment variable") + @slack_webhook_url ||= ENV["SLACK_WEBHOOK"] || raise("Missing SLACK_WEBHOOK env variable") end end end diff --git a/qa/qa/vendor/jira/jira_api.rb b/qa/qa/vendor/jira/jira_api.rb index 64af824418d..15039ac244e 100644 --- a/qa/qa/vendor/jira/jira_api.rb +++ b/qa/qa/vendor/jira/jira_api.rb @@ -7,6 +7,9 @@ module QA include Scenario::Actable include Support::API + DEFAULT_ISSUE_SUMMARY = 'REST ye merry gentlemen.' + DEFAULT_ISSUE_DESCRIPTION = 'Creating of an issue using project keys and issue type names using the REST API' + def base_url host = QA::Runtime::Env.jira_hostname || 'localhost' @@ -18,27 +21,58 @@ module QA end def fetch_issue(issue_key) - response = get("#{api_url}/issue/#{issue_key}", user: Runtime::Env.jira_admin_username, password: Runtime::Env.jira_admin_password) + response = get("#{api_url}/issue/#{issue_key}", + user: Runtime::Env.jira_admin_username, + password: Runtime::Env.jira_admin_password) parse_body(response) end - def create_issue(jira_project_key) + def create_project(project_key = "GL#{SecureRandom.hex(4)}".upcase) + payload = { + key: project_key, + name: "Project #{project_key}", + description: "New Project #{project_key}", + lead: Runtime::Env.jira_admin_username, + projectTypeKey: 'software' + } + response = post( + "#{api_url}/project", + payload.to_json, + headers: { 'Content-Type' => 'application/json' }, + user: Runtime::Env.jira_admin_username, + password: Runtime::Env.jira_admin_password) + + returned_project_key = parse_body(response)[:key] + + QA::Runtime::Logger.debug("Created JIRA project with key: '#{project_key}'") + + returned_project_key + end + + def create_issue( + jira_project_key, + issue_type: 'Bug', + summary: DEFAULT_ISSUE_SUMMARY, + description: DEFAULT_ISSUE_DESCRIPTION + ) payload = { fields: { project: { key: jira_project_key }, - summary: 'REST ye merry gentlemen.', - description: 'Creating of an issue using project keys and issue type names using the REST API', + summary: summary, + description: description, issuetype: { - name: 'Bug' + name: issue_type } } } - response = post("#{api_url}/issue", - payload.to_json, headers: { 'Content-Type': 'application/json' }, + response = post( + "#{api_url}/issue", + payload.to_json, + headers: { 'Content-Type': 'application/json' }, user: Runtime::Env.jira_admin_username, password: Runtime::Env.jira_admin_password) diff --git a/qa/spec/resource/base_spec.rb b/qa/spec/resource/base_spec.rb index b24ced9e310..2a26a479436 100644 --- a/qa/spec/resource/base_spec.rb +++ b/qa/spec/resource/base_spec.rb @@ -3,8 +3,9 @@ RSpec.describe QA::Resource::Base do include QA::Support::Helpers::StubEnv - let(:resource) { spy('resource') } + let(:resource) { spy('resource', username: 'qa') } let(:location) { 'http://location' } + let(:log_regex) { %r{==> Built a MyResource with username 'qa' via #{method} in [\d.\-e]+ seconds+} } shared_context 'with fabrication context' do subject do @@ -68,6 +69,8 @@ RSpec.describe QA::Resource::Base do end context "with debug log level" do + let(:method) { 'api' } + before do allow(QA::Runtime::Logger).to receive(:debug) end @@ -78,7 +81,7 @@ RSpec.describe QA::Resource::Base do subject.fabricate_via_api!('something', resource: resource, parents: []) expect(QA::Runtime::Logger).to have_received(:debug) do |&msg| - expect(msg.call).to match_regex(/==> Built a MyResource via api in [\d.\-e]+ seconds+/) + expect(msg.call).to match_regex(log_regex) end end end @@ -102,6 +105,8 @@ RSpec.describe QA::Resource::Base do end context "with debug log level" do + let(:method) { 'browser_ui' } + before do allow(QA::Runtime::Logger).to receive(:debug) end @@ -112,7 +117,7 @@ RSpec.describe QA::Resource::Base do subject.fabricate_via_browser_ui!('something', resource: resource, parents: []) expect(QA::Runtime::Logger).to have_received(:debug) do |&msg| - expect(msg.call).to match_regex(/==> Built a MyResource via browser_ui in [\d.\-e]+ seconds+/) + expect(msg.call).to match_regex(log_regex) end end end diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb index fb18311bb52..80d8a9a1892 100644 --- a/qa/spec/runtime/env_spec.rb +++ b/qa/spec/runtime/env_spec.rb @@ -169,6 +169,10 @@ RSpec.describe QA::Runtime::Env do end describe '.knapsack?' do + before do + stub_env('CI_NODE_TOTAL', '2') + end + it 'returns true if KNAPSACK_GENERATE_REPORT is defined' do stub_env('KNAPSACK_GENERATE_REPORT', 'true') @@ -190,28 +194,11 @@ RSpec.describe QA::Runtime::Env do it 'returns false if neither KNAPSACK_GENERATE_REPORT nor KNAPSACK_REPORT_PATH nor KNAPSACK_TEST_FILE_PATTERN are defined' do expect(described_class.knapsack?).to be_falsey end - end - describe '.knapsack?' do - it 'returns true if KNAPSACK_GENERATE_REPORT is defined' do + it 'returns false if not running in parallel job' do + stub_env('CI_NODE_TOTAL', '1') stub_env('KNAPSACK_GENERATE_REPORT', 'true') - expect(described_class.knapsack?).to be_truthy - end - - it 'returns true if KNAPSACK_REPORT_PATH is defined' do - stub_env('KNAPSACK_REPORT_PATH', '/a/path') - - expect(described_class.knapsack?).to be_truthy - end - - it 'returns true if KNAPSACK_TEST_FILE_PATTERN is defined' do - stub_env('KNAPSACK_TEST_FILE_PATTERN', '/a/**/pattern') - - expect(described_class.knapsack?).to be_truthy - end - - it 'returns false if neither KNAPSACK_GENERATE_REPORT nor KNAPSACK_REPORT_PATH nor KNAPSACK_TEST_FILE_PATTERN are defined' do expect(described_class.knapsack?).to be_falsey end end diff --git a/qa/spec/scenario/test/integration/kubernetes_spec.rb b/qa/spec/scenario/test/integration/service_ping_disabled_spec.rb index d5885b97343..2db254908f0 100644 --- a/qa/spec/scenario/test/integration/kubernetes_spec.rb +++ b/qa/spec/scenario/test/integration/service_ping_disabled_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true -RSpec.describe QA::Scenario::Test::Integration::Kubernetes do +RSpec.describe QA::Scenario::Test::Integration::ServicePingDisabled do describe '#perform' do it_behaves_like 'a QA scenario class' do - let(:tags) { [:kubernetes] } + let(:tags) { [:service_ping_disabled] } end end end diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb index 640f2de0ca2..4372d9d2728 100644 --- a/qa/spec/spec_helper.rb +++ b/qa/spec/spec_helper.rb @@ -64,6 +64,13 @@ RSpec.configure do |config| end end + config.after(:suite) do |suite| + # If any tests failed, leave the resources behind to help troubleshoot + next if suite.reporter.failed_examples.present? + + QA::Resource::ReusableProject.remove_all_via_api! + end + config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true end diff --git a/qa/spec/support/formatters/test_stats_formatter_spec.rb b/qa/spec/support/formatters/test_stats_formatter_spec.rb index f9baf9bd9d9..71ab9c1d541 100644 --- a/qa/spec/support/formatters/test_stats_formatter_spec.rb +++ b/qa/spec/support/formatters/test_stats_formatter_spec.rb @@ -45,7 +45,7 @@ describe QA::Support::Formatters::TestStatsFormatter do job_name: "test-job", merge_request: "false", run_type: run_type, - stage: stage + stage: stage.match(%r{\d{1,2}_(\w+)}).captures.first }, fields: { id: './spec/support/formatters/test_stats_formatter_spec.rb[1:1]', diff --git a/qa/spec/support/shared_contexts/packages_registry_shared_context.rb b/qa/spec/support/shared_contexts/packages_registry_shared_context.rb index e686d254a44..348176d264b 100644 --- a/qa/spec/support/shared_contexts/packages_registry_shared_context.rb +++ b/qa/spec/support/shared_contexts/packages_registry_shared_context.rb @@ -42,13 +42,13 @@ module QA end let(:project_deploy_token) do - Resource::DeployToken.fabricate_via_browser_ui! do |deploy_token| + Resource::ProjectDeployToken.fabricate_via_api! do |deploy_token| deploy_token.name = 'package-deploy-token' deploy_token.project = package_project - deploy_token.scopes = [ - :read_repository, - :read_package_registry, - :write_package_registry + deploy_token.scopes = %w[ + read_repository + read_package_registry + write_package_registry ] end end diff --git a/qa/spec/tools/reliable_report_spec.rb b/qa/spec/tools/reliable_report_spec.rb index c7d4d28fb21..a048aa2e6ea 100644 --- a/qa/spec/tools/reliable_report_spec.rb +++ b/qa/spec/tools/reliable_report_spec.rb @@ -3,62 +3,94 @@ describe QA::Tools::ReliableReport do include QA::Support::Helpers::StubEnv - subject(:reporter) { described_class.new(run_type, range) } + subject(:run) { described_class.run(range: range, report_in_issue_and_slack: create_issue) } + let(:gitlab_response) { instance_double("RestClient::Response", code: 200, body: { web_url: issue_url }.to_json) } let(:slack_notifier) { instance_double("Slack::Notifier", post: nil) } let(:influx_client) { instance_double("InfluxDB2::Client", create_query_api: query_api) } let(:query_api) { instance_double("InfluxDB2::QueryApi") } let(:slack_channel) { "#quality-reports" } - let(:run_type) { "package-and-qa" } - let(:range) { 30 } - let(:results) { 10 } - - let(:runs) { { 0 => stable_spec, 1 => unstable_spec } } - - let(:stable_spec) do - spec_values = { "name" => "stable spec", "status" => "passed", "file_path" => "some/spec.rb" } - instance_double( - "InfluxDB2::FluxTable", - records: [ - instance_double("InfluxDB2::FluxRecord", values: spec_values), - instance_double("InfluxDB2::FluxRecord", values: spec_values), - instance_double("InfluxDB2::FluxRecord", values: spec_values) - ] - ) + let(:range) { 14 } + let(:issue_url) { "https://gitlab.com/issue/1" } + + let(:runs) do + values = { "name" => "stable spec", "status" => "passed", "file_path" => "some/spec.rb", "stage" => "manage" } + { + 0 => instance_double( + "InfluxDB2::FluxTable", + records: [ + instance_double("InfluxDB2::FluxRecord", values: values), + instance_double("InfluxDB2::FluxRecord", values: values), + instance_double("InfluxDB2::FluxRecord", values: values) + ] + ) + } end - let(:unstable_spec) do - spec_values = { "name" => "unstable spec", "status" => "failed", "file_path" => "some/spec.rb" } - instance_double( - "InfluxDB2::FluxTable", - records: [ - instance_double("InfluxDB2::FluxRecord", values: { **spec_values, "status" => "passed" }), - instance_double("InfluxDB2::FluxRecord", values: spec_values), - instance_double("InfluxDB2::FluxRecord", values: spec_values) - ] - ) + let(:reliable_runs) do + values = { "name" => "unstable spec", "status" => "failed", "file_path" => "some/spec.rb", "stage" => "create" } + { + 0 => instance_double( + "InfluxDB2::FluxTable", + records: [ + instance_double("InfluxDB2::FluxRecord", values: { **values, "status" => "passed" }), + instance_double("InfluxDB2::FluxRecord", values: values), + instance_double("InfluxDB2::FluxRecord", values: values) + ] + ) + } end - def flux_query(reliable) + def flux_query(reliable:) <<~QUERY - from(bucket: "e2e-test-stats") - |> range(start: -#{range}d) - |> filter(fn: (r) => r._measurement == "test-stats" and - r.run_type == "#{run_type}" and - r.status != "pending" and - r.merge_request == "false" and - r.quarantined == "false" and - r.reliable == "#{reliable}" and - r._field == "id" - ) - |> group(columns: ["name"]) + from(bucket: "e2e-test-stats") + |> range(start: -#{range}d) + |> filter(fn: (r) => r._measurement == "test-stats") + |> filter(fn: (r) => r.run_type == "staging-full" or + r.run_type == "staging-sanity" or + r.run_type == "staging-sanity-no-admin" or + r.run_type == "production-full" or + r.run_type == "production-sanity" or + r.run_type == "package-and-qa" or + r.run_type == "nightly" + ) + |> filter(fn: (r) => r.status != "pending" and + r.merge_request == "false" and + r.quarantined == "false" and + r.reliable == "#{reliable}" and + r._field == "id" + ) + |> group(columns: ["name"]) QUERY end - def table(rows, title = nil) + def markdown_section(summary, result, stage, type) + <<~SECTION.strip + ``` + #{summary_table(summary, type)} + ``` + + ## #{stage} + + <details> + <summary>Executions table</summary> + + ``` + #{table(result, ['NAME', 'RUNS', 'FAILURES', 'FAILURE RATE'], "Top #{type} specs in '#{stage}' stage for past #{range} days")} + ``` + + </details> + SECTION + end + + def summary_table(summary, type) + table(summary, %w[STAGE COUNT], "#{type.capitalize} spec summary for past #{range} days".ljust(50)) + end + + def table(rows, headings, title) Terminal::Table.new( - headings: ["name", "runs", "failed", "failure rate"], + headings: headings, style: { all_separators: true }, title: title, rows: rows @@ -67,7 +99,7 @@ describe QA::Tools::ReliableReport do def name_column(spec_name) name = "name: '#{spec_name}'" - file = "file: 'spec.rb'".ljust(110) + file = "file: 'spec.rb'".ljust(160) "#{name}\n#{file}" end @@ -75,71 +107,85 @@ describe QA::Tools::ReliableReport do before do stub_env("QA_INFLUXDB_URL", "url") stub_env("QA_INFLUXDB_TOKEN", "token") - stub_env("CI_SLACK_WEBHOOK_URL", "slack_url") + stub_env("SLACK_WEBHOOK", "slack_url") + stub_env("CI_API_V4_URL", "gitlab_api_url") + stub_env("GITLAB_ACCESS_TOKEN", "gitlab_token") + allow(RestClient::Request).to receive(:execute).and_return(gitlab_response) allow(Slack::Notifier).to receive(:new).and_return(slack_notifier) allow(InfluxDB2::Client).to receive(:new).and_return(influx_client) - allow(query_api).to receive(:query).with(query: query).and_return(runs) - end - context "with stable spec report" do - let(:query) { flux_query(false) } - let(:fetch_message) { "Fetching data on test execution for past #{range} days in '#{run_type}' runs" } - let(:slack_send_message) { "Sending top stable spec report to #{slack_channel} slack channel" } - let(:title) { "Top #{results} stable specs for past #{range} days in '#{run_type}' runs" } - let(:rows) do - [ - [name_column("stable spec"), 3, 0, "0%"], - [name_column("unstable spec"), 3, 2, "66.67%"] - ] - end + allow(query_api).to receive(:query).with(query: flux_query(reliable: false)).and_return(runs) + allow(query_api).to receive(:query).with(query: flux_query(reliable: true)).and_return(reliable_runs) + end - it "prints top stable spec report to console" do - expect { reporter.show_top_stable }.to output("#{fetch_message}\n\n#{table(rows, title)}\n").to_stdout - end + context "without report creation" do + let(:create_issue) { "false" } - it "sends top stable spec report to slack" do - slack_args = { icon_emoji: ":mtg_green:", username: "Stable Spec Report" } + it "does not create report issue", :aggregate_failures do + expect { run }.to output.to_stdout - expect { reporter.notify_top_stable }.to output("#{fetch_message}\n\n\n#{slack_send_message}\n").to_stdout - expect(slack_notifier).to have_received(:post).with(text: "*#{title}*", **slack_args) - expect(slack_notifier).to have_received(:post).with(text: "```#{table(rows)}```", **slack_args) + expect(RestClient::Request).not_to have_received(:execute) + expect(slack_notifier).not_to have_received(:post) end end - context "with unstable spec report" do - let(:query) { flux_query(true) } - let(:fetch_message) { "Fetching data on reliable test execution for past #{range} days in '#{run_type}' runs" } - let(:slack_send_message) { "Sending top unstable reliable spec report to #{slack_channel} slack channel" } - let(:title) { "Top #{results} unstable reliable specs for past #{range} days in '#{run_type}' runs" } - let(:rows) { [[name_column("unstable spec"), 3, 2, "66.67%"]] } + context "with report creation" do + let(:create_issue) { "true" } + let(:issue_body) do + <<~TXT.strip + [[_TOC_]] - it "prints top unstable spec report to console" do - expect { reporter.show_top_unstable }.to output("#{fetch_message}\n\n#{table(rows, title)}\n").to_stdout - end + # Candidates for promotion to reliable - it "sends top unstable reliable spec report to slack" do - slack_args = { icon_emoji: ":sadpanda:", username: "Unstable Spec Report" } + #{markdown_section([['manage', 1]], [[name_column('stable spec'), 3, 0, '0%']], 'manage', 'stable')} - expect { reporter.notify_top_unstable }.to output("#{fetch_message}\n\n\n#{slack_send_message}\n").to_stdout - expect(slack_notifier).to have_received(:post).with(text: "*#{title}*", **slack_args) - expect(slack_notifier).to have_received(:post).with(text: "```#{table(rows)}```", **slack_args) + # Reliable specs with failures + + #{markdown_section([['create', 1]], [[name_column('unstable spec'), 3, 2, '66.67%']], 'create', 'unstable')} + TXT + end + + it "creates report issue", :aggregate_failures do + expect { run }.to output.to_stdout + + expect(RestClient::Request).to have_received(:execute).with( + method: :post, + url: "gitlab_api_url/projects/278964/issues", + verify_ssl: false, + headers: { "PRIVATE-TOKEN" => "gitlab_token" }, + payload: { + title: "Reliable spec report", + description: issue_body, + labels: "Quality,test" + } + ) + expect(slack_notifier).to have_received(:post).with( + icon_emoji: ":tanuki-protect:", + text: <<~TEXT + ```#{summary_table([['manage', 1]], 'stable')}``` + ```#{summary_table([['create', 1]], 'unstable')}``` + + #{issue_url} + TEXT + ) end end - context "without unstable reliable specs" do - let(:query) { flux_query(true) } - let(:runs) { { 0 => stable_spec } } - let(:fetch_message) { "Fetching data on reliable test execution for past #{range} days in '#{run_type}' runs" } - let(:no_result_message) { "No unstable tests present!" } + context "with failure" do + let(:create_issue) { "true" } - it "prints no result message to console" do - expect { reporter.show_top_unstable }.to output("#{fetch_message}\n\n#{no_result_message}\n").to_stdout + before do + allow(query_api).to receive(:query).and_raise("Connection error!") end - it "skips slack notification" do - expect { reporter.notify_top_unstable }.to output("#{fetch_message}\n\n#{no_result_message}\n").to_stdout - expect(slack_notifier).not_to have_received(:post) + it "notifies failure", :aggregate_failures do + expect { expect { run }.to raise_error(SystemExit) }.to output.to_stdout + + expect(slack_notifier).to have_received(:post).with( + icon_emoji: ":sadpanda:", + text: "Reliable reporter failed to create report. Error: ```Connection error!```" + ) end end end diff --git a/qa/tasks/knapsack.rake b/qa/tasks/knapsack.rake new file mode 100644 index 00000000000..ea15793a457 --- /dev/null +++ b/qa/tasks/knapsack.rake @@ -0,0 +1,17 @@ +# frozen_string_literal: true +# rubocop:disable Rails/RakeEnvironment + +require_relative "../qa/tools/knapsack_report" + +namespace :knapsack do + desc "Download latest knapsack report" + task :download do + QA::Tools::KnapsackReport.download + end + + desc "Merge and upload knapsack report" + task :upload, [:glob_pattern] do |_task, args| + QA::Tools::KnapsackReport.upload(args[:glob_pattern]) + end +end +# rubocop:enable Rails/RakeEnvironment diff --git a/qa/tasks/reliable_report.rake b/qa/tasks/reliable_report.rake index 204c959093a..4ec86779704 100644 --- a/qa/tasks/reliable_report.rake +++ b/qa/tasks/reliable_report.rake @@ -3,19 +3,8 @@ require_relative "../qa/tools/reliable_report" -desc "Fetch top most reliable specs" -task :reliable_spec_report, [:run_type, :range, :create_slack_report] do |_task, args| - report = QA::Tools::ReliableReport.new(args[:run_type] || "package-and-qa", args[:range]) - - report.show_top_stable - report.notify_top_stable if args[:create_slack_report] == 'true' -end - -desc "Fetch top most unstable reliable specs" -task :unreliable_spec_report, [:run_type, :range, :create_slack_report] do |_task, args| - report = QA::Tools::ReliableReport.new(args[:run_type] || "package-and-qa", args[:range]) - - report.show_top_unstable - report.notify_top_unstable if args[:create_slack_report] == 'true' +desc "Fetch reliable and unreliable spec data and create report" +task :reliable_spec_report, [:range, :report_in_issue_and_slack] do |_task, args| + QA::Tools::ReliableReport.run(**args) end # rubocop:enable Rails/RakeEnvironment |