diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /qa | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'qa')
106 files changed, 1036 insertions, 396 deletions
diff --git a/qa/Dockerfile b/qa/Dockerfile index d040bddfc7f..76c81d03071 100644 --- a/qa/Dockerfile +++ b/qa/Dockerfile @@ -3,8 +3,8 @@ LABEL maintainer="GitLab Quality Department <quality@gitlab.com>" ENV DEBIAN_FRONTEND="noninteractive" ENV DOCKER_VERSION="17.09.0-ce" -ENV CHROME_VERSION="84.0.4147.89-1" -ENV CHROME_DRIVER_VERSION="84.0.4147.30" +ENV CHROME_VERSION="87.0.4280.141-1" +ENV CHROME_DRIVER_VERSION="87.0.4280.88" ENV CHROME_DEB="google-chrome-stable_${CHROME_VERSION}_amd64.deb" ENV CHROME_URL="https://s3.amazonaws.com/gitlab-google-chrome-stable/${CHROME_DEB}" diff --git a/qa/Gemfile b/qa/Gemfile index da45ba3b955..f55d27c159b 100644 --- a/qa/Gemfile +++ b/qa/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' gem 'gitlab-qa' diff --git a/qa/README.md b/qa/README.md index 5070e1ee9bd..02fa84f4488 100644 --- a/qa/README.md +++ b/qa/README.md @@ -104,6 +104,15 @@ bundle exec bin/qa Test::Instance::All http://localhost:3000 -- qa/specs/feature Note that the separator `--` is required; all subsequent options will be ignored by the QA framework and passed to `rspec`. +#### Running tests for transient bugs + +A suite of tests have been written to test for [transient bugs](https://about.gitlab.com/handbook/engineering/quality/issue-triage/#transient-bugs). +Those tests are tagged `:transient` and therefore can be run via: + +```shell +bundle exec bin/qa Test::Instance::All http://localhost:3000 -- --tag transient +``` + ### Overriding the authenticated user Unless told otherwise, the QA tests will run as the default `root` user seeded @@ -207,7 +216,7 @@ run all the tests in the `Test::Instance::All` scenario, and then enable the feature flag again if it was enabled earlier. Note: the QA framework doesn't currently allow you to easily toggle a feature -flag during a single test, [as you can in unit tests](https://docs.gitlab.com/ee/development/feature_flags.html#specs), +flag during a single test, [as you can in unit tests](https://docs.gitlab.com/ee/development/feature_flags/index.html), but [that capability is planned](https://gitlab.com/gitlab-org/quality/team-tasks/issues/77). Note also that the `--` separator isn't used because `--enable-feature` and `--disable-feature` diff --git a/qa/Rakefile b/qa/Rakefile index 6bafec2a67d..0a040f0aee7 100644 --- a/qa/Rakefile +++ b/qa/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative 'qa/tools/revoke_all_personal_access_tokens' require_relative 'qa/tools/delete_subgroups' require_relative 'qa/tools/generate_perf_testdata' diff --git a/qa/bin/qa b/qa/bin/qa index cbaad4bd7ad..4328adf719b 100755 --- a/qa/bin/qa +++ b/qa/bin/qa @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require_relative '../qa' diff --git a/qa/bin/rubymine b/qa/bin/rubymine index 0be0cf0ec33..7db50f4aade 100755 --- a/qa/bin/rubymine +++ b/qa/bin/rubymine @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require_relative '../qa' @@ -156,6 +156,7 @@ module QA autoload :Mattermost, 'qa/scenario/test/integration/mattermost' autoload :ObjectStorage, 'qa/scenario/test/integration/object_storage' autoload :SMTP, 'qa/scenario/test/integration/smtp' + autoload :SSHTunnel, 'qa/scenario/test/integration/ssh_tunnel' end module Sanity diff --git a/qa/qa/fixtures/auto_devops_rack/Gemfile b/qa/qa/fixtures/auto_devops_rack/Gemfile index fc7514242d0..2c7c77adf94 100644 --- a/qa/qa/fixtures/auto_devops_rack/Gemfile +++ b/qa/qa/fixtures/auto_devops_rack/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' gem 'rack' gem 'rake' diff --git a/qa/qa/fixtures/auto_devops_rack/Rakefile b/qa/qa/fixtures/auto_devops_rack/Rakefile index c865c9aaac1..a6d08103d55 100644 --- a/qa/qa/fixtures/auto_devops_rack/Rakefile +++ b/qa/qa/fixtures/auto_devops_rack/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rake/testtask' task default: %w[test] diff --git a/qa/qa/fixtures/auto_devops_rack/config.ru b/qa/qa/fixtures/auto_devops_rack/config.ru index e990662145a..aea28ef1893 100644 --- a/qa/qa/fixtures/auto_devops_rack/config.ru +++ b/qa/qa/fixtures/auto_devops_rack/config.ru @@ -1 +1,3 @@ +# frozen_string_literal: true + run lambda { |env| [200, { 'Content-Type' => 'text/plain' }, StringIO.new("Hello World! #{ENV['OPTIONAL_MESSAGE']}\n")] } diff --git a/qa/qa/flow/project.rb b/qa/qa/flow/project.rb index db42a3a3594..8a9e2c86332 100644 --- a/qa/qa/flow/project.rb +++ b/qa/qa/flow/project.rb @@ -5,16 +5,6 @@ module QA module Project module_function - def add_member(project:, username:) - project.visit! - - Page::Project::Menu.perform(&:click_members) - - Page::Project::Members.perform do |member_settings| - member_settings.add_member(username) - end - end - def go_to_create_project_from_template if Page::Project::NewExperiment.perform(&:shown?) Page::Project::NewExperiment.perform(&:click_create_from_template_link) diff --git a/qa/qa/flow/sign_up.rb b/qa/qa/flow/sign_up.rb index b367b7976e8..a2a62371092 100644 --- a/qa/qa/flow/sign_up.rb +++ b/qa/qa/flow/sign_up.rb @@ -5,6 +5,10 @@ module QA module SignUp module_function + def page + Capybara.current_session + end + def sign_up!(user) Page::Main::Menu.perform(&:sign_out_if_signed_in) Page::Main::Login.perform(&:switch_to_register_page) @@ -14,6 +18,11 @@ module QA sign_up.fill_new_user_username_field(user.username) sign_up.fill_new_user_email_field(user.email) sign_up.fill_new_user_password_field(user.password) + + Support::Waiter.wait_until(sleep_interval: 0.5) do + page.has_content?("Username is available.") + end + sign_up.click_new_user_register_button end diff --git a/qa/qa/page/admin/overview/users/index.rb b/qa/qa/page/admin/overview/users/index.rb index fea95fdb84a..1885644d226 100644 --- a/qa/qa/page/admin/overview/users/index.rb +++ b/qa/qa/page/admin/overview/users/index.rb @@ -6,7 +6,7 @@ module QA module Overview module Users class Index < QA::Page::Base - view 'app/views/admin/users/index.html.haml' do + view 'app/views/admin/users/_users.html.haml' do element :user_search_field element :pending_approval_tab end diff --git a/qa/qa/page/component/issue_board/show.rb b/qa/qa/page/component/issue_board/show.rb index 15c1c25cbf9..4c1f03fbe86 100644 --- a/qa/qa/page/component/issue_board/show.rb +++ b/qa/qa/page/component/issue_board/show.rb @@ -39,7 +39,7 @@ module QA element :boards_list end - view 'app/assets/javascripts/boards/toggle_focus.js' do + view 'app/assets/javascripts/boards/components/toggle_focus.vue' do element :focus_mode_button end diff --git a/qa/qa/page/component/note.rb b/qa/qa/page/component/note.rb index 0454042289b..50567796bdb 100644 --- a/qa/qa/page/component/note.rb +++ b/qa/qa/page/component/note.rb @@ -162,10 +162,6 @@ module QA fill_element :reply_field, reply_text end - def wait_for_loading - has_no_element?(:skeleton_note_placeholer) - end - private def select_filter_with_text(text) @@ -174,7 +170,7 @@ module QA click_element :discussion_filter_dropdown find_element(:filter_menu_item, text: text).click - wait_for_loading + wait_for_requests end end end diff --git a/qa/qa/page/issuable/new.rb b/qa/qa/page/issuable/new.rb index 7891074092e..c549190c65b 100644 --- a/qa/qa/page/issuable/new.rb +++ b/qa/qa/page/issuable/new.rb @@ -28,6 +28,10 @@ module QA element :assign_to_me_link end + view 'app/views/shared/issuable/form/_template_selector.html.haml' do + element :template_dropdown + end + def fill_title(title) fill_element :issuable_form_title, title end @@ -43,6 +47,13 @@ module QA end end + def choose_template(template_name) + click_element :template_dropdown + within_element(:template_dropdown) do + click_on template_name + end + end + def select_label(label) click_element :issuable_label diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index 627809dacf2..f0df901a8f0 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -6,7 +6,7 @@ module QA class Menu < Page::Base view 'app/views/layouts/header/_current_user_dropdown.html.haml' do element :sign_out_link - element :settings_link + element :edit_profile_link end view 'app/views/layouts/header/_default.html.haml' do @@ -115,10 +115,10 @@ module QA sign_out if signed_in? end - def click_settings_link + def click_edit_profile_link retry_until(reload: false) do within_user_menu do - click_link 'Settings' + click_element(:edit_profile_link) end has_text?('User Settings') diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index ac4d38e5918..18676807fd6 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -58,6 +58,9 @@ module QA view 'app/assets/javascripts/diffs/components/diff_file_header.vue' do element :file_name_content + element :file_title_container + element :dropdown_button + element :edit_in_ide_button end view 'app/assets/javascripts/diffs/components/inline_diff_table_row.vue' do @@ -87,6 +90,15 @@ module QA element :review_preview_toggle end + view 'app/assets/javascripts/vue_shared/components/markdown/suggestion_diff_header.vue' do + element :apply_suggestions_batch_button + element :add_suggestion_batch_button + end + + view 'app/assets/javascripts/vue_shared/components/markdown/header.vue' do + element :suggestion_button + end + def start_review click_element(:start_review_button) @@ -150,15 +162,12 @@ module QA def click_discussions_tab click_element(:notes_tab) - wait_for_loading + wait_for_requests end def click_diffs_tab click_element(:diffs_tab) - - wait_for_loading - - click_element(:dismiss_popover_button) if has_element?(:dismiss_popover_button) + click_element(:dismiss_popover_button) if has_element?(:dismiss_popover_button, wait: 1) end def click_pipeline_link @@ -296,6 +305,31 @@ module QA click_element(:open_in_web_ide_button) wait_for_requests end + + def edit_file_in_web_ide(file_name) + within_element(:file_title_container, file_name: file_name) do + click_element(:dropdown_button) + click_element(:edit_in_ide_button) + end + end + + def add_suggestion_to_diff(suggestion, line) + find("a[data-linenumber='#{line}']").hover + click_element(:diff_comment) + click_element(:suggestion_button) + initial_content = find_element(:reply_field).value + fill_element(:reply_field, '') + fill_element(:reply_field, initial_content.gsub(/(```suggestion:-0\+0\n).*(\n```)/, "\\1#{suggestion}\\2")) + click_element(:comment_now_button) + end + + def add_suggestion_to_batch + all_elements(:add_suggestion_batch_button, minimum: 1).first.click + end + + def apply_suggestions_batch + all_elements(:apply_suggestions_batch_button, minimum: 1).first.click + end end end end diff --git a/qa/qa/page/page_concern.rb b/qa/qa/page/page_concern.rb index 6ba2d27f574..cf1153c0ca3 100644 --- a/qa/qa/page/page_concern.rb +++ b/qa/qa/page/page_concern.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module QA module Page module PageConcern diff --git a/qa/qa/page/project/commit/show.rb b/qa/qa/page/project/commit/show.rb index ba09dd1b92a..8ece81f7088 100644 --- a/qa/qa/page/project/commit/show.rb +++ b/qa/qa/page/project/commit/show.rb @@ -14,12 +14,12 @@ module QA def select_email_patches click_element :options_button - click_element :email_patches + visit_link_in_element :email_patches end def select_plain_diff click_element :options_button - click_element :plain_diff + visit_link_in_element :plain_diff end def commit_sha diff --git a/qa/qa/page/project/members.rb b/qa/qa/page/project/members.rb index 447049ce22a..7e722e02ad0 100644 --- a/qa/qa/page/project/members.rb +++ b/qa/qa/page/project/members.rb @@ -11,10 +11,6 @@ module QA element :invite_member_button end - view 'app/views/projects/project_members/_team.html.haml' do - element :members_list - end - view 'app/views/projects/project_members/index.html.haml' do element :invite_group_tab element :groups_list_tab @@ -25,11 +21,18 @@ module QA element :invite_group_button end - view 'app/views/shared/members/_group.html.haml' do + view 'app/assets/javascripts/pages/projects/project_members/index.js' do element :group_row + end + + view 'app/assets/javascripts/members/components/action_buttons/remove_group_link_button.vue' do element :delete_group_access_link end + view 'app/assets/javascripts/members/components/modals/remove_group_link_modal.vue' do + element :remove_group_link_modal_content + end + def select_group(group_name) click_element :group_select_field search_and_select(group_name) @@ -50,10 +53,13 @@ module QA def remove_group(group_name) click_element :invite_group_tab click_element :groups_list_tab - page.accept_alert do - within_element(:group_row, text: group_name) do - click_element :delete_group_access_link - end + + within_element(:group_row, text: group_name) do + click_element :delete_group_access_link + end + + within_element(:remove_group_link_modal_content) do + click_button 'Remove group' end end end diff --git a/qa/qa/page/project/web_ide/edit.rb b/qa/qa/page/project/web_ide/edit.rb index a8b30922bd2..45c46004790 100644 --- a/qa/qa/page/project/web_ide/edit.rb +++ b/qa/qa/page/project/web_ide/edit.rb @@ -18,7 +18,8 @@ module QA end view 'app/assets/javascripts/ide/components/ide_tree.vue' do - element :new_file + element :new_file_button + element :new_directory_button end view 'app/assets/javascripts/ide/components/ide_tree_list.vue' do @@ -63,6 +64,7 @@ module QA view 'app/assets/javascripts/ide/components/new_dropdown/index.vue' do element :dropdown_button element :rename_move_button + element :delete_button end view 'app/views/shared/_confirm_fork_modal.html.haml' do @@ -82,6 +84,10 @@ module QA element :changed_file_icon_content end + view 'app/assets/javascripts/vue_shared/components/file_icon.vue' do + element :folder_icon_content + end + view 'app/assets/javascripts/vue_shared/components/content_viewer/content_viewer.vue' do element :preview_container end @@ -98,12 +104,20 @@ module QA element :file_upload_field end + view 'app/assets/javascripts/ide/components/commit_sidebar/list_item.vue' do + element :file_to_commit_content + end + def has_file?(file_name) within_element(:file_list) do - has_text?(file_name) + has_element?(:file_name_content, file_name: file_name) end end + def has_file_to_commit?(file_name) + has_element?(:file_to_commit_content, file_name: file_name) + end + def has_project_path?(project_path) has_element?(:project_path_content, project_path: project_path) end @@ -114,6 +128,12 @@ module QA end end + def has_folder_icon?(file_name) + within_element(:file_row_container, file_name: file_name) do + has_element?(:folder_icon_content) + end + end + def has_download_button?(file_name) click_element(:file_row_container, file_name: file_name) within_element(:preview_container) do @@ -128,12 +148,19 @@ module QA end end + def has_file_content?(file_name, file_content) + click_element(:file_row_container, file_name: file_name) + within_element(:editor_container) do + has_text?(file_content) + end + end + def go_to_project click_element(:project_path_content, Page::Project::Show) end def create_new_file_from_template(file_name, template) - click_element(:new_file, Page::Component::WebIDE::Modal::CreateNewFile) + click_element(:new_file_button, Page::Component::WebIDE::Modal::CreateNewFile) within_element(:template_list) do click_on file_name @@ -226,7 +253,7 @@ module QA end def add_file(file_name, file_text) - click_element(:new_file, Page::Component::WebIDE::Modal::CreateNewFile) + click_element(:new_file_button, Page::Component::WebIDE::Modal::CreateNewFile) fill_element(:file_name_field, file_name) click_button('Create file') wait_until(reload: false) { has_file?(file_name) } @@ -235,8 +262,15 @@ module QA end end + def add_directory(directory_name) + click_element(:new_directory_button, Page::Component::WebIDE::Modal::CreateNewFile) + fill_element(:file_name_field, directory_name) + click_button('Create directory') + wait_until(reload: false) { has_file?(directory_name) } + end + def rename_file(file_name, new_file_name) - click_element(:file_name_content, text: file_name) + click_element(:file_name_content, file_name: file_name) click_element(:dropdown_button) click_element(:rename_move_button, Page::Component::WebIDE::Modal::CreateNewFile) fill_element(:file_name_field, new_file_name) @@ -259,6 +293,16 @@ module QA find_element(:file_upload_field, visible: false).send_keys(file_path) end end + + def delete_file(file_name) + click_element(:file_name_content, file_name: file_name) + click_element(:dropdown_button) + click_element(:delete_button) + end + + def switch_to_commit_tab + click_element(:commit_mode_tab) + end end end end diff --git a/qa/qa/resource/ci_variable.rb b/qa/qa/resource/ci_variable.rb index f14fcdaac9f..0b9f4eb6635 100644 --- a/qa/qa/resource/ci_variable.rb +++ b/qa/qa/resource/ci_variable.rb @@ -3,7 +3,7 @@ module QA module Resource class CiVariable < Base - attr_accessor :key, :value, :masked + attr_accessor :key, :value, :masked, :protected attribute :project do Project.fabricate! do |resource| @@ -12,6 +12,11 @@ module QA end end + def initialize + @masked = false + @protected = false + end + def fabricate! project.visit! @@ -49,7 +54,8 @@ module QA { key: key, value: value, - masked: masked + masked: masked, + protected: protected } end end diff --git a/qa/qa/resource/issue.rb b/qa/qa/resource/issue.rb index a6bd8987077..ffffa0eecda 100644 --- a/qa/qa/resource/issue.rb +++ b/qa/qa/resource/issue.rb @@ -5,7 +5,7 @@ require 'securerandom' module QA module Resource class Issue < Base - attr_writer :description, :milestone, :weight + attr_writer :description, :milestone, :template, :weight attribute :project do Project.fabricate! do |resource| @@ -33,7 +33,8 @@ module QA Page::Project::Issue::New.perform do |new_page| new_page.fill_title(@title) - new_page.fill_description(@description) + new_page.choose_template(@template) if @template + new_page.fill_description(@description) if @description new_page.choose_milestone(@milestone) if @milestone new_page.create_new_issue end diff --git a/qa/qa/resource/members.rb b/qa/qa/resource/members.rb index 52928afa7db..a88980f26d8 100644 --- a/qa/qa/resource/members.rb +++ b/qa/qa/resource/members.rb @@ -31,12 +31,13 @@ module QA end class AccessLevel - NO_ACCESS = 0 - GUEST = 10 - REPORTER = 20 - DEVELOPER = 30 - MAINTAINER = 40 - OWNER = 50 + NO_ACCESS = 0 + MINIMAL_ACCESS = 5 + GUEST = 10 + REPORTER = 20 + DEVELOPER = 30 + MAINTAINER = 40 + OWNER = 50 end end end diff --git a/qa/qa/resource/merge_request.rb b/qa/qa/resource/merge_request.rb index ecf25b797a8..fd5f454f134 100644 --- a/qa/qa/resource/merge_request.rb +++ b/qa/qa/resource/merge_request.rb @@ -19,7 +19,8 @@ module QA :file_name, :file_content attr_writer :no_preparation, - :wait_for_merge + :wait_for_merge, + :template attribute :merge_when_pipeline_succeeds attribute :merge_status @@ -73,7 +74,8 @@ module QA Page::Project::Show.perform(&:new_merge_request) Page::MergeRequest::New.perform do |new_page| new_page.fill_title(@title) - new_page.fill_description(@description) + new_page.choose_template(@template) if @template + new_page.fill_description(@description) unless @template new_page.choose_milestone(@milestone) if @milestone new_page.assign_to_me if @assignee == 'me' labels.each do |label| @@ -86,6 +88,8 @@ module QA end def fabricate_via_api! + raise ResourceNotFoundError unless id + resource_web_url(api_get) rescue ResourceNotFoundError populate_target_and_source_if_required diff --git a/qa/qa/resource/personal_access_token.rb b/qa/qa/resource/personal_access_token.rb index 488138326df..6b2301ba916 100644 --- a/qa/qa/resource/personal_access_token.rb +++ b/qa/qa/resource/personal_access_token.rb @@ -15,7 +15,7 @@ module QA end def fabricate! - Page::Main::Menu.perform(&:click_settings_link) + Page::Main::Menu.perform(&:click_edit_profile_link) Page::Profile::Menu.perform(&:click_access_tokens) Page::Profile::PersonalAccessTokens.perform do |token_page| diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb index a92f7912b9e..efb6c2c0591 100644 --- a/qa/qa/resource/project.rb +++ b/qa/qa/resource/project.rb @@ -25,10 +25,6 @@ module QA attribute :template_name attribute :import - attribute :default_branch do - api_response[:default_branch] || Runtime::Env.default_branch - end - attribute :group do Group.fabricate! end @@ -224,6 +220,10 @@ module QA parse_body(get(Runtime::API::Request.new(api_client, api_commits_path).url)) end + def default_branch + reload!.api_response[:default_branch] || Runtime::Env.default_branch + end + def import_status response = get Runtime::API::Request.new(api_client, "/projects/#{id}/import").url diff --git a/qa/qa/resource/repository/wiki_push.rb b/qa/qa/resource/repository/wiki_push.rb index f188e52c969..edf76c7cd78 100644 --- a/qa/qa/resource/repository/wiki_push.rb +++ b/qa/qa/resource/repository/wiki_push.rb @@ -12,14 +12,11 @@ module QA end end - def branch_name - @branch_name ||= wiki.project.default_branch - end - def initialize @file_name = 'Home.md' @file_content = 'This line was created using git push' @commit_message = 'Updating using git push' + @branch_name = 'master' @new_branch = false end diff --git a/qa/qa/resource/ssh_key.rb b/qa/qa/resource/ssh_key.rb index fcd0a479fec..52526275cb0 100644 --- a/qa/qa/resource/ssh_key.rb +++ b/qa/qa/resource/ssh_key.rb @@ -22,7 +22,7 @@ module QA end def fabricate! - Page::Main::Menu.perform(&:click_settings_link) + Page::Main::Menu.perform(&:click_edit_profile_link) Page::Profile::Menu.perform(&:click_ssh_keys) Page::Profile::SSHKeys.perform do |profile_page| diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index 1c637db5385..6c4139da83f 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -411,6 +411,10 @@ module QA ENV.fetch('GITLAB_AGENTK_VERSION', 'v13.7.0') end + def transient_trials + ENV.fetch('GITLAB_QA_TRANSIENT_TRIALS', 10).to_i + end + private def remote_grid_credentials 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 new file mode 100644 index 00000000000..b7f71ad5bcd --- /dev/null +++ b/qa/qa/specs/features/api/1_manage/user_access_termination_spec.rb @@ -0,0 +1,84 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Manage' do + describe 'User', :requires_admin do + before(:all) do + admin_api_client = Runtime::API::Client.as_admin + + @user = Resource::User.fabricate_via_api! do |user| + user.api_client = admin_api_client + end + + @user_api_client = Runtime::API::Client.new(:gitlab, user: @user) + + @group = Resource::Group.fabricate_via_api! + + @group.sandbox.add_member(@user) + + @project = Resource::Project.fabricate_via_api! do |project| + project.group = @group + project.name = "project-for-user-group-access-termination" + project.initialize_with_readme = true + end + end + + context 'after parent group membership termination' do + before do + @group.sandbox.remove_member(@user) + end + + it 'is not allowed to push code via the CLI', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1660' do + expect do + Resource::Repository::Push.fabricate! do |push| + push.repository_http_uri = @project.repository_http_location.uri + push.file_name = 'test.txt' + push.file_content = "# This is a test project named #{@project.name}" + push.commit_message = 'Add test.txt' + push.branch_name = 'new_branch' + push.user = @user + end + 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/-/issues/1661' do + expect do + Resource::File.fabricate_via_api! do |file| + file.api_client = @user_api_client + file.project = @project + file.branch = 'new_branch' + file.commit_message = 'Add new file' + file.name = 'test.txt' + file.content = "New file" + end + 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/-/issues/1662' do + expect do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.api_client = @user_api_client + commit.project = @project + commit.branch = 'new_branch' + commit.start_branch = @project.default_branch + commit.commit_message = 'Add new file' + commit.add_files([ + { file_path: 'test.txt', content: 'new file' } + ]) + end + end.to raise_error(Resource::ApiFabricator::ResourceFabricationFailedError, /403 Forbidden - You are not allowed to push into this branch/) + end + end + + after(:all) do + @user.remove_via_api! + @project.remove_via_api! + begin + @group.remove_via_api! + rescue Resource::ApiFabricator::ResourceNotDeletedError + # It is ok if the group is already marked for deletion by another test + end + end + end + end +end diff --git a/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb index c3cb503ed3f..9bf3474ba5a 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 @@ -88,6 +88,7 @@ module QA read_from_project(project, number_of_reads) praefect_manager.query_read_distribution.each_with_index do |data, index| + diff_found[index] = {} unless diff_found[index] diff_found[index][:diff] = true if data[:value] > praefect_manager.value_for_node(pre_read_data, data[:node]) end diff_found.all? { |node| node.key?(:diff) && node[:diff] } 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 f6d2492c011..3702f95158c 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 @@ -48,7 +48,7 @@ module QA def enable_2fa_for_user(user) Flow::Login.while_signed_in(as: user) do - Page::Main::Menu.perform(&:click_settings_link) + Page::Main::Menu.perform(&:click_edit_profile_link) Page::Profile::Menu.perform(&:click_account) Page::Profile::Accounts::Show.perform(&:click_enable_2fa_button) 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 624f8d20b62..9b2540f67c7 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 do describe 'basic user login' do - it 'user logs in using basic credentials and logs out', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/424' do + it 'user logs in using basic credentials and logs out', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1690' 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 f81dfe4b5c8..2fc3ff2f18f 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 @@ -101,7 +101,7 @@ module QA two_fa_auth.click_copy_and_proceed - expect(two_fa_auth).to have_text('Congratulations! You have enabled Two-factor Authentication!') + expect(two_fa_auth).to have_text('You have set up 2FA for your account!') end end end 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 d9b246fc458..ffc2290b644 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 @@ -58,7 +58,7 @@ module QA # this is the only test that exercise this UI. # Other tests should use the API for this purpose. Flow::Login.sign_in(as: user) - Page::Main::Menu.perform(&:click_settings_link) + Page::Main::Menu.perform(&:click_edit_profile_link) Page::Profile::Menu.perform(&:click_account) Page::Profile::Accounts::Show.perform do |show| show.delete_account(user.password) 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 e71cbeb9837..85cfefd6c5c 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/add_project_member_spec.rb @@ -1,8 +1,16 @@ # frozen_string_literal: true module QA - RSpec.describe 'Manage' do + RSpec.describe 'Manage', :requires_admin do describe 'Add project member' do + before do + Runtime::Feature.enable('vue_project_members_list') + end + + after do + Runtime::Feature.disable('vue_project_members_list') + end + it 'user adds project member', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/482' do Flow::Login.sign_in @@ -16,7 +24,7 @@ module QA Page::Project::Members.perform do |members| members.add_member(user.username) - expect(members).to have_content(/@#{user.username}( Is using seat)?(\n| )?Given access/) + expect(members).to have_content("@#{user.username}") end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb index a2e01398c94..e722710ee00 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 @@ -4,7 +4,7 @@ module QA RSpec.describe 'Manage', :smoke do describe 'Project creation' do it 'user creates a new project', - testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/429' do + testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1234' do Flow::Login.sign_in created_project = Resource::Project.fabricate_via_browser_ui! do |project| diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/dashboard_images_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/dashboard_images_spec.rb index aaf0c51a2db..f2822e3d368 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 @@ -41,7 +41,7 @@ module QA end end - context 'when logged in as a new user', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/465' do + context 'when logged in as a new user', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1693' do it_behaves_like 'loads all images' do let(:new_user) { @new_user } end 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 new file mode 100644 index 00000000000..7ec217cb47d --- /dev/null +++ b/qa/qa/specs/features/browser_ui/1_manage/user/user_access_termination_spec.rb @@ -0,0 +1,65 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Manage' do + describe 'User', :requires_admin do + let(:admin_api_client) { Runtime::API::Client.as_admin } + + let!(:user) do + Resource::User.fabricate_via_api! do |user| + user.api_client = admin_api_client + end + end + + let!(:group) do + group = Resource::Group.fabricate_via_api! + group.sandbox.add_member(user) + group + end + + let!(:project) do + Resource::Project.fabricate_via_api! do |project| + project.group = group + project.name = "project-for-user-access-termination" + project.initialize_with_readme = true + end + end + + context 'after parent group membership termination' do + before do + Flow::Login.while_signed_in_as_admin do + group.sandbox.visit! + + Page::Group::Menu.perform(&:click_group_members_item) + Page::Group::Members.perform do |members_page| + members_page.remove_member(user.username) + end + end + end + + it 'is not allowed to edit the project files', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1663' do + Flow::Login.sign_in(as: user) + project.visit! + + Page::Project::Show.perform do |project| + project.click_file('README.md') + end + + Page::File::Show.perform(&:click_edit) + + expect(page).to have_text("You're not allowed to edit files in this project directly.") + end + + after do + user.remove_via_api! + project.remove_via_api! + begin + group.remove_via_api! + rescue Resource::ApiFabricator::ResourceNotDeletedError + # It is ok if the group is already marked for deletion by another test + end + end + end + end + end +end 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 418865a63d2..f623efe5a3a 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 @@ -1,7 +1,7 @@ # frozen_string_literal: true module QA - RSpec.describe 'Plan', :orchestrated, :smtp do + RSpec.describe 'Plan', :orchestrated, :smtp, :requires_admin do describe 'Email Notification' do include Support::Api @@ -16,13 +16,23 @@ module QA end before do + Runtime::Feature.enable('vue_project_members_list', project: project) Flow::Login.sign_in end + after do + Runtime::Feature.disable('vue_project_members_list', project: project) + end + it 'is received by a user for project invitation', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/676' do - Flow::Project.add_member(project: project, username: user.username) + project.visit! + + Page::Project::Menu.perform(&:click_members) + Page::Project::Members.perform do |member_settings| + member_settings.add_member(user.username) + end - expect(page).to have_content(/@#{user.username}(\n| )?Given access/) + expect(page).to have_content("@#{user.username}") mailhog_items = mailhog_json.dig('items') 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 e394f6b1e9c..a7f862e8911 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 @@ -20,7 +20,7 @@ module QA before do Flow::Login.sign_in - Flow::Project.add_member(project: project, username: user.username) + project.add_member(user) Resource::Issue.fabricate_via_api! do |issue| issue.project = project 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 6ed204a98d4..72c990cbbc2 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/-/issues/434' do + it 'collapses and expands reply for comments in an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1163' 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 d3780186f36..c5cd495f607 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/-/issues/450' do + it 'comments on an issue and edits the comment', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1151' 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 688f42c48c6..de6b24e8477 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 @@ -9,7 +9,7 @@ module QA Flow::Login.sign_in end - it 'creates an issue', :reliable, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/432' do + it 'creates an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1167' do issue = Resource::Issue.fabricate_via_browser_ui! Page::Project::Menu.perform(&:click_issues) 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 new file mode 100644 index 00000000000..5f5fe161e71 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/custom_issue_template_spec.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Plan' do + describe 'Custom issue templates' do + let(:template_name) { 'custom_issue_template'} + let(:template_content) { 'This is a custom issue template test' } + + let(:template_project) do + Resource::Project.fabricate_via_api! do |project| + project.name = "custom-issue-template-project" + project.initialize_with_readme = true + end + end + + before do + Flow::Login.sign_in + + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = template_project + commit.commit_message = 'Add custom issue template' + commit.add_files([ + { + file_path: ".gitlab/issue_templates/#{template_name}.md", + content: template_content + } + ]) + end + end + + it 'creates an issue via custom template', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1229' do + Resource::Issue.fabricate_via_browser_ui! do |issue| + issue.project = template_project + issue.template = template_name + end + + Page::Project::Issue::Show.perform do |issue_page| + expect(issue_page).to have_content(template_content) + end + end + end + end +end 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 c1113e7ec35..a23474ad6f2 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 @@ -24,7 +24,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/-/issues/764' do + it 'successfully exports issues list as CSV', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1141' 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/issue_suggestions_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/issue_suggestions_spec.rb index 7c675862e26..ff33f9d4824 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/-/issues/412' do + it 'shows issue suggestions when creating a new issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1175' 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 42b3e5364b7..1455847277e 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 @@ -39,27 +39,22 @@ module QA private def set_up_jira_integration - # Retry is required because allow_local_requests_from_web_hooks_and_services - # takes some time to get enabled. - # Bug issue: https://gitlab.com/gitlab-org/gitlab/-/issues/217010 - QA::Support::Retrier.retry_on_exception(max_attempts: 5, sleep_interval: 3) do - Runtime::ApplicationSettings.set_application_settings(allow_local_requests_from_web_hooks_and_services: true) + Runtime::ApplicationSettings.set_application_settings(allow_local_requests_from_web_hooks_and_services: true) - page.visit Runtime::Scenario.gitlab_address - Flow::Login.sign_in_unless_signed_in + page.visit Runtime::Scenario.gitlab_address + Flow::Login.sign_in_unless_signed_in - project.visit! + project.visit! - Page::Project::Menu.perform(&:go_to_integrations_settings) - QA::Page::Project::Settings::Integrations.perform(&:click_jira_link) + Page::Project::Menu.perform(&:go_to_integrations_settings) + QA::Page::Project::Settings::Integrations.perform(&:click_jira_link) - QA::Page::Project::Settings::Services::Jira.perform do |jira| - jira.setup_service_with(url: Vendor::Jira::JiraAPI.perform(&:base_url)) - end - - expect(page).not_to have_text("Url is blocked") - expect(page).to have_text("Jira settings saved and active.") + QA::Page::Project::Settings::Services::Jira.perform do |jira| + jira.setup_service_with(url: Vendor::Jira::JiraAPI.perform(&:base_url)) end + + expect(page).not_to have_text("Url is blocked") + expect(page).to have_text("Jira settings saved and active.") end def 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 5a8c9a4601a..cc815fd0e67 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 @@ -21,7 +21,7 @@ module QA end.visit! end - it 'mentions another user in an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/446' do + it 'mentions another user in an issue', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1166' do Page::Project::Issue::Show.perform do |show| at_username = "@#{user.username}" 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 7f60726af0e..8f17a25012b 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/-/issues/820' do + it 'focuses on issue board', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1176' 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 564cfbb8399..8c328abcbe9 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/-/issues/922' do + it 'creates a group milestone', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1148' 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 99d547acb26..78d1471f484 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/-/issues/901' do + it 'creates a project milestone', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1165' 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 6a133540f87..d907cfaab6d 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/-/issues/541' do + it 'relates and unrelates one issue to/from another', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1172' do issue_1.visit! Page::Project::Issue::Show.perform do |show| 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 051e8fcecbe..2e48899742b 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/-/issues/955' do + it 'user adds a design and annotates it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1692' do issue.visit! Page::Project::Issue::Show.perform do |issue| 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 d53e7fcf69a..449795f9707 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 @@ -19,26 +19,21 @@ module QA page.has_text? 'Welcome to Jira' end - # Retry is required because allow_local_requests_from_web_hooks_and_services - # takes some time to get enabled. - # Bug issue: https://gitlab.com/gitlab-org/gitlab/-/issues/217010 - QA::Support::Retrier.retry_on_exception(max_attempts: 5, sleep_interval: 3) do - Runtime::ApplicationSettings.set_application_settings(allow_local_requests_from_web_hooks_and_services: true) + Runtime::ApplicationSettings.set_application_settings(allow_local_requests_from_web_hooks_and_services: true) - page.visit Runtime::Scenario.gitlab_address - Flow::Login.sign_in_unless_signed_in + page.visit Runtime::Scenario.gitlab_address + Flow::Login.sign_in_unless_signed_in - project.visit! + project.visit! - Page::Project::Menu.perform(&:go_to_integrations_settings) - QA::Page::Project::Settings::Integrations.perform(&:click_jira_link) + Page::Project::Menu.perform(&:go_to_integrations_settings) + QA::Page::Project::Settings::Integrations.perform(&:click_jira_link) - QA::Page::Project::Settings::Services::Jira.perform do |jira| - jira.setup_service_with(url: Vendor::Jira::JiraAPI.perform(&:base_url)) - end - - expect(page).not_to have_text("Requests to the local network are not allowed") + QA::Page::Project::Settings::Services::Jira.perform do |jira| + jira.setup_service_with(url: Vendor::Jira::JiraAPI.perform(&:base_url)) end + + 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/-/issues/827' do 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 510fc0c9a16..81ad1896075 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 @@ -16,7 +16,7 @@ module QA Flow::Login.sign_in end - it 'creates a basic merge request', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/409' do + it 'creates a basic merge request', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1276' do Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request| merge_request.project = project merge_request.title = merge_request_title 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 new file mode 100644 index 00000000000..d8341eff41d --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/create_merge_request_via_template_spec.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Merge request custom templates' do + let(:template_name) { 'custom_merge_request_template'} + let(:template_content) { 'This is a custom merge request template test' } + let(:template_project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'custom-mr-template-project' + project.initialize_with_readme = true + end + end + + let(:merge_request_title) { 'One merge request to rule them all' } + + before do + Flow::Login.sign_in + + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = template_project + commit.commit_message = 'Add custom merge request template' + commit.add_files([ + { + file_path: ".gitlab/merge_request_templates/#{template_name}.md", + content: template_content + } + ]) + end + end + + it 'creates a merge request via custom template', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1230' do + Resource::MergeRequest.fabricate_via_browser_ui! do |merge_request| + merge_request.project = template_project + merge_request.title = merge_request_title + merge_request.template = template_name + merge_request.target_new_branch = false + end + + Page::MergeRequest::Show.perform do |merge_request| + expect(merge_request).to have_title(merge_request_title) + expect(merge_request).to have_description(template_content) + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/rebase_merge_request_spec.rb index 823a033ab6d..3414584bae3 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 @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/30226', type: :bug } do describe 'Merge request rebasing' do - it 'user rebases source branch of merge request', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/398' do + it 'user rebases source branch of merge request', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1274' do Flow::Login.sign_in project = Resource::Project.fabricate_via_api! do |project| 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 5b1c15016bf..d11afde5648 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', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/416' do + it 'views the merge request email patches', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1689' do Page::MergeRequest::Show.perform(&:view_email_patches) expect(page.text).to start_with('From') 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 8df68e0f53b..d400876c838 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 @@ -59,7 +59,7 @@ module QA project.visit! end - it 'lists branches correctly after CRUD operations', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/413' do + it 'lists branches correctly after CRUD operations', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1688' 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/clone_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/clone_spec.rb index 47117c4d456..9edde7ac12f 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 @@ -14,10 +14,12 @@ module QA Git::Repository.perform do |repository| repository.uri = project.repository_http_location.uri repository.use_default_credentials + repository.default_branch = project.default_branch repository.act do clone configure_identity('GitLab QA', 'root@gitlab.com') + checkout(default_branch, new_branch: true) commit_file('test.rb', 'class Test; end', 'Add Test class') commit_file('README.md', '# Test', 'Add Readme') push_changes 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 5781bf8a7f0..3440b462302 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 @@ -26,6 +26,8 @@ module QA repository.use_default_credentials repository.clone repository.configure_identity(username, email) + repository.default_branch = project.default_branch + repository.checkout(project.default_branch, new_branch: true) git_protocol_reported = repository.push_with_git_protocol( git_protocol, 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 8d966c9e46d..38c9216005f 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 @@ -49,6 +49,8 @@ module QA repository.use_ssh_key(ssh_key) repository.clone repository.configure_identity(username, email) + repository.default_branch = project.default_branch + repository.checkout(project.default_branch, new_branch: true) git_protocol_reported = repository.push_with_git_protocol( git_protocol, 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 08af18a992e..35ec2135491 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', :ldap_no_tls, :smoke do - it 'user using a personal access token pushes code to the repository', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/430' do + it 'user using a personal access token pushes code to the repository', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1278' do Flow::Login.sign_in access_token = Resource::PersonalAccessToken.fabricate!.access_token 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 5e7c17cbfaf..c56e6d1267c 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/-/issues/969' do + it 'pushes code to the repository via SSH', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1678' do Resource::Repository::ProjectPush.fabricate! do |push| push.project = project push.ssh_key = @key @@ -41,7 +41,8 @@ module QA end end - it 'pushes multiple branches and tags together', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/970' do + it 'pushes multiple branches and tags together', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1679 + ' do branches = [] tags = [] Git::Repository.perform do |repository| 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 2001069c2a4..a90bb920107 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/-/issues/929' do + it 'user can add an SSH key', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1685' do key = Resource::SSHKey.fabricate_via_browser_ui! do |resource| resource.title = key_title end @@ -20,8 +20,8 @@ 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/-/issues/930' do - Page::Main::Menu.perform(&:click_settings_link) + it 'can delete an ssh key', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1686' do + Page::Main::Menu.perform(&:click_edit_profile_link) Page::Profile::Menu.perform(&:click_ssh_keys) Page::Profile::SSHKeys.perform do |ssh_keys| ssh_keys.remove_key(key.title) diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/add_file_to_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/add_file_to_snippet_spec.rb index 469335db5ab..604c98ca21e 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/add_file_to_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/add_file_to_snippet_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - describe 'Multiple file snippet' do + describe 'Multiple file snippet', quarantine: { only: { pipeline: :master }, issue: 'https://gitlab.com/gitlab-org/gitaly/-/issues/3143', type: :bug } do let(:personal_snippet) do Resource::Snippet.fabricate_via_api! do |snippet| snippet.title = 'Personal snippet to add file to' 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 a21c5d58aad..2940b2067a1 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 @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - describe 'Version control for personal snippets' do + describe 'Version control for personal snippets', quarantine: { only: { pipeline: :master }, issue: 'https://gitlab.com/gitlab-org/gitaly/-/issues/3143', type: :bug } do let(:new_file) { 'new_snippet_file' } let(:changed_content) { 'changes' } let(:commit_message) { 'Changes to snippets' } 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 4ce6c3fdcd3..b91424d5b65 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 @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - describe 'Version control for project snippets' do + describe 'Version control for project snippets', quarantine: { only: { pipeline: :master }, issue: 'https://gitlab.com/gitlab-org/gitaly/-/issues/3143', type: :bug } do let(:new_file) { 'new_snippet_file' } let(:changed_content) { 'changes' } let(:commit_message) { 'Changes to snippets' } diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb index 8002e95cf0d..5c0983dabb6 100644 --- a/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/snippet/delete_file_from_snippet_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - describe 'Multiple file snippet' do + describe 'Multiple file snippet', quarantine: { only: { pipeline: :master }, issue: 'https://gitlab.com/gitlab-org/gitaly/-/issues/3143', type: :bug } do let(:personal_snippet) do Resource::Snippet.fabricate_via_api! do |snippet| snippet.title = 'Personal snippet to delete file from' diff --git a/qa/qa/specs/features/browser_ui/3_create/transient/apply_suggestion_spec.rb b/qa/qa/specs/features/browser_ui/3_create/transient/apply_suggestion_spec.rb new file mode 100644 index 00000000000..eab2729af83 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/transient/apply_suggestion_spec.rb @@ -0,0 +1,61 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + context 'Transient tests', :transient do + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'project-for-transient-test' + end + end + + let(:code_for_merge) do + Pathname + .new(__dir__) + .join('../../../../../fixtures/metrics_dashboards/templating.yml') + end + + let(:merge_request) do + Resource::MergeRequest.fabricate_via_api! do |merge_request| + merge_request.project = project + merge_request.title = 'Transient MR' + merge_request.description = 'detecting transient bugs' + merge_request.file_content = File.read(code_for_merge) + end + end + + let(:dev_user) do + Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) + end + + before do + project.add_member(dev_user) + Flow::Login.sign_in(as: dev_user, skip_page_validation: true) + + merge_request.visit! + + Page::MergeRequest::Show.perform(&:click_diffs_tab) + + [4, 6, 10, 13].each do |line_number| + Page::MergeRequest::Show.perform do |merge_request| + merge_request.add_suggestion_to_diff("This is the #{line_number} suggestion!", line_number) + end + end + + Flow::Login.sign_in + + merge_request.visit! + end + + it 'applies multiple suggestions', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1177' do + Page::MergeRequest::Show.perform do |merge_request| + merge_request.click_diffs_tab + 4.times { merge_request.add_suggestion_to_batch } + merge_request.apply_suggestions_batch + + expect(merge_request).to have_css('.badge-success', text: "Applied", count: 4) + end + end + end + end +end 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 new file mode 100644 index 00000000000..293c9043266 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/add_new_directory_in_web_ide_spec.rb @@ -0,0 +1,70 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Add a directory in Web IDE' do + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'add-directory-project' + project.initialize_with_readme = true + end + end + + before do + Flow::Login.sign_in + + project.visit! + end + + context 'when a directory with the same name already exists' do + let(:directory_name) { 'first_directory' } + + before do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.add_files([ + { + file_path: 'first_directory/test_file.txt', + content: "Test file content" + } + ]) + end + + project.visit! + + Page::Project::Show.perform(&:open_web_ide!) + end + + it 'throws an error', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1615' do + Page::Project::WebIDE::Edit.perform do |ide| + ide.add_directory(directory_name) + end + + expect(page).to have_content('The name "first_directory" is already taken in this directory.') + end + end + + context 'when user adds a new empty directory' do + let(:directory_name) { 'new_empty_directory' } + + before do + Page::Project::Show.perform(&:open_web_ide!) + end + + it 'shows in the tree view but cannot be committed', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1614' do + Page::Project::WebIDE::Edit.perform do |ide| + ide.add_directory(directory_name) + + expect(ide).to have_file(directory_name) + expect(ide).to have_folder_icon(directory_name) + expect(ide).not_to have_file_addition_icon(directory_name) + + ide.switch_to_commit_tab + + expect(ide).not_to have_file_to_commit(directory_name) + end + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb index dad5ad74a4c..ce1b6f4a3ec 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_fork_in_web_ide_spec.rb @@ -2,7 +2,7 @@ module QA RSpec.describe 'Create' do - describe 'Open a fork in Web IDE', quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/284081', type: :investigating } do + describe 'Open a fork in Web IDE' do let(:parent_project) do Resource::Project.fabricate_via_api! do |project| project.name = 'parent-project' @@ -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/-/issues/959' 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/-/issues/1697' 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/-/issues/960' do + it 'opens the fork when a user clicks Web IDE in the main project', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1698' 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 new file mode 100644 index 00000000000..1789e20e216 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/open_web_ide_from_diff_tab_spec.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +module QA + RSpec.describe 'Create' do + describe 'Open Web IDE from Diff Tab' do + files = [ + { + file_path: 'file1', + content: 'test1' + }, + { + file_path: 'file2', + content: 'test2' + }, + { + file_path: 'file3', + content: 'test3' + } + ] + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.initialize_with_readme = true + end + end + + let(:source) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.branch = 'new-mr' + commit.start_branch = project.default_branch + commit.commit_message = 'Add new files' + commit.add_files(files) + end + end + + let(:merge_request) do + Resource::MergeRequest.fabricate_via_api! do |mr| + mr.source = source + mr.project = project + mr.source_branch = 'new-mr' + mr.target_new_branch = false + end + end + + before do + Flow::Login.sign_in + + 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/-/issues/997' do + Page::MergeRequest::Show.perform do |show| + show.click_diffs_tab + show.edit_file_in_web_ide('file1') + end + + Page::Project::WebIDE::Edit.perform do |ide| + files.each do |files| + expect(ide).to have_file(files[:file_path]) + expect(ide).to have_file_content(files[:file_path], files[:content]) + end + + ide.delete_file('file1') + ide.commit_changes + end + + merge_request.visit! + + Page::MergeRequest::Show.perform do |show| + show.click_diffs_tab + + expect(show).not_to have_file('file1') + expect(show).to have_file('file2') + expect(show).to have_file('file3') + end + end + end + end +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 d62f894279f..0a342664dd2 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' do + it 'throws an error', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1136' 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' do + it 'shows the Edit tab with the text', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1138' 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' do + it 'shows a Download button', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1137' 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' do + it 'shows an image viewer', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1139' do Page::Project::WebIDE::Edit.perform do |ide| ide.upload_file(file_path) 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 new file mode 100644 index 00000000000..5b976ae4126 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/pipeline_with_protected_variable_spec.rb @@ -0,0 +1,148 @@ +# frozen_string_literal: true + +require 'faker' + +module QA + RSpec.describe 'Verify', :runner do + describe 'Pipeline with protected variable' do + let(:executor) { "qa-runner-#{Faker::Alphanumeric.alphanumeric(8)}" } + let(:protected_value) { Faker::Alphanumeric.alphanumeric(8) } + + let(:project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'project-with-ci-variables' + project.description = 'project with CI variables' + end + end + + let!(:runner) do + Resource::Runner.fabricate! do |runner| + runner.project = project + runner.name = executor + runner.tags = [executor] + end + end + + let!(:ci_file) do + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.project = project + commit.commit_message = 'Add .gitlab-ci.yml' + commit.add_files( + [ + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + job: + tags: + - #{executor} + script: echo $PROTECTED_VARIABLE + YAML + } + ] + ) + end + end + + let(:developer) do + Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) + end + + let(:maintainer) do + Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_2, Runtime::Env.gitlab_qa_password_2) + end + + before do + Flow::Login.sign_in + project.visit! + project.add_member(developer) + project.add_member(maintainer, Resource::Members::AccessLevel::MAINTAINER) + add_ci_variable + end + + after do + runner.remove_via_api! + end + + it 'exposes variable on protected branch', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/156' do + create_protected_branch + + [developer, maintainer].each do |user| + user_commit_to_protected_branch(Runtime::API::Client.new(:gitlab, user: user)) + go_to_pipeline_job(user) + + Page::Project::Job::Show.perform do |show| + expect(show.output).to have_content(protected_value), 'Expect protected variable to be in job log.' + end + end + end + + it 'does not expose variable on unprotected branch', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/156' do + [developer, maintainer].each do |user| + create_merge_request(Runtime::API::Client.new(:gitlab, user: user)) + go_to_pipeline_job(user) + + Page::Project::Job::Show.perform do |show| + expect(show.output).to have_no_content(protected_value), 'Expect protected variable to NOT be in job log.' + end + end + end + + private + + def add_ci_variable + Resource::CiVariable.fabricate_via_api! do |ci_variable| + ci_variable.project = project + ci_variable.key = 'PROTECTED_VARIABLE' + ci_variable.value = protected_value + ci_variable.protected = true + end + end + + def create_protected_branch + # Using default setups, which allows access for developer and maintainer + Resource::ProtectedBranch.fabricate_via_api! do |resource| + resource.branch_name = 'protected-branch' + resource.project = project + end + end + + def user_commit_to_protected_branch(api_client) + Resource::Repository::Commit.fabricate_via_api! do |commit| + commit.api_client = api_client + commit.project = project + commit.branch = 'protected-branch' + commit.commit_message = Faker::Lorem.sentence + commit.add_files( + [ + { + file_path: "#{Faker::Lorem.word}.txt", + content: Faker::Lorem.sentence + } + ] + ) + end + end + + def create_merge_request(api_client) + Resource::MergeRequest.fabricate_via_api! do |merge_request| + merge_request.api_client = api_client + merge_request.project = project + merge_request.description = Faker::Lorem.sentence + merge_request.target_new_branch = false + merge_request.file_name = "#{Faker::Lorem.word}.txt" + merge_request.file_content = Faker::Lorem.sentence + end + end + + def go_to_pipeline_job(user) + Flow::Login.sign_in(as: user) + project.visit! + Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'completed') + + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job('job') + end + end + end + end +end diff --git a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb index 1e6cb4047f9..8617e05f912 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 @@ -24,7 +24,7 @@ module QA runner.remove_via_api! end - it 'users creates a pipeline which gets processed', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/391' do + it 'users creates a pipeline which gets processed', :smoke, testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1279' do Flow::Login.sign_in Resource::Repository::Commit.fabricate_via_api! do |commit| diff --git a/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb b/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb index be6f3b17ccd..6c1a0cea209 100644 --- a/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/composer_registry_spec.rb @@ -104,9 +104,7 @@ module QA index.click_package(package_name) end - Page::Project::Packages::Show.perform do |package| - package.click_delete - end + Page::Project::Packages::Show.perform(&:click_delete) Page::Project::Packages::Index.perform do |index| aggregate_failures 'package deletion' do diff --git a/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb index ae0580ff51b..7effefc4d73 100644 --- a/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/conan_repository_spec.rb @@ -75,9 +75,7 @@ module QA index.click_package(package_name) end - Page::Project::Packages::Show.perform do |package| - package.click_delete - end + Page::Project::Packages::Show.perform(&:click_delete) Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") diff --git a/qa/qa/specs/features/browser_ui/5_package/generic_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/generic_repository_spec.rb index 9a0d832de09..3e3addf9eeb 100644 --- a/qa/qa/specs/features/browser_ui/5_package/generic_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/generic_repository_spec.rb @@ -100,9 +100,7 @@ module QA index.click_package(package_name) end - Page::Project::Packages::Show.perform do |package| - package.click_delete - end + Page::Project::Packages::Show.perform(&:click_delete) Page::Project::Packages::Index.perform do |index| aggregate_failures 'package deletion' do diff --git a/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb index 552302addf9..6ab4a957c57 100644 --- a/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/maven_gradle_repository_spec.rb @@ -112,9 +112,7 @@ module QA index.click_package(package_name) end - Page::Project::Packages::Show.perform do |show| - show.click_delete - end + Page::Project::Packages::Show.perform(&:click_delete) Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") diff --git a/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb index be806fcbb3e..8c3f0930207 100644 --- a/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/nuget_repository_spec.rb @@ -13,6 +13,13 @@ module QA end end + let(:another_project) do + Resource::Project.fabricate_via_api! do |project| + project.name = 'nuget-package-install-project' + project.template_name = 'dotnetcore' + end + end + let!(:runner) do Resource::Runner.fabricate! do |runner| runner.name = "qa-runner-#{Time.now.to_i}" @@ -22,11 +29,21 @@ module QA end end + let!(:another_runner) do + Resource::Runner.fabricate! do |runner| + runner.name = "qa-runner-#{Time.now.to_i}" + runner.tags = ["runner-for-#{another_project.name}"] + runner.executor = :docker + runner.project = another_project + end + end + after do runner.remove_via_api! + another_runner.remove_via_api! end - it 'publishes a nuget package and deletes it', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1073' do + it 'publishes a nuget package at the project level, installs and deletes it at the group level', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1073' do Flow::Login.sign_in Resource::Repository::Commit.fabricate_via_api! do |commit| @@ -37,23 +54,23 @@ module QA { file_path: '.gitlab-ci.yml', content: <<~YAML - image: mcr.microsoft.com/dotnet/core/sdk:3.1 - - stages: - - deploy - - deploy: - stage: deploy - script: - - dotnet restore -p:Configuration=Release - - dotnet build -c Release - - dotnet pack -c Release - - dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text - - dotnet nuget push "bin/Release/*.nupkg" --source gitlab - only: - - "#{project.default_branch}" - tags: - - "runner-for-#{project.name}" + image: mcr.microsoft.com/dotnet/core/sdk:3.1 + + stages: + - deploy + + deploy: + stage: deploy + script: + - dotnet restore -p:Configuration=Release + - dotnet build -c Release + - dotnet pack -c Release + - dotnet nuget add source "$CI_SERVER_URL/api/v4/projects/$CI_PROJECT_ID/packages/nuget/index.json" --name gitlab --username gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text + - dotnet nuget push "bin/Release/*.nupkg" --source gitlab + only: + - "#{project.default_branch}" + tags: + - "runner-for-#{project.name}" YAML } ] @@ -71,16 +88,74 @@ module QA expect(job).to be_successful(timeout: 800) end - Page::Project::Menu.perform(&:click_packages_link) + 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>netcoreapp3.1</TargetFramework> + </PropertyGroup> + + </Project> + EOF + } + ] + ) + commit.update_files( + [ + { + file_path: '.gitlab-ci.yml', + content: <<~YAML + image: mcr.microsoft.com/dotnet/core/sdk:3.1 + + 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 gitlab-ci-token --password $CI_JOB_TOKEN --store-password-in-clear-text + - "dotnet add otherdotnet.csproj package #{package_name} --version 1.0.0" + only: + - "#{another_project.default_branch}" + tags: + - "runner-for-#{another_project.name}" + YAML + } + ] + ) + end + + Flow::Pipeline.visit_latest_pipeline + + Page::Project::Pipeline::Show.perform do |pipeline| + pipeline.click_job('install') + end + + Page::Project::Job::Show.perform do |job| + expect(job).to be_successful(timeout: 800) + end + + project.group.sandbox.visit! + + Page::Group::Menu.perform(&:go_to_group_packages) Page::Project::Packages::Index.perform do |index| expect(index).to have_package(package_name) index.click_package(package_name) end - Page::Project::Packages::Show.perform do |package| - package.click_delete - end + Page::Project::Packages::Show.perform(&:click_delete) Page::Project::Packages::Index.perform do |index| expect(index).to have_content("Package deleted successfully") diff --git a/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb b/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb index d5eca171d6c..396863b33c4 100644 --- a/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb +++ b/qa/qa/specs/features/browser_ui/5_package/pypi_repository_spec.rb @@ -98,9 +98,7 @@ module QA index.click_package(package_name) end - Page::Project::Packages::Show.perform do |package| - package.click_delete - end + Page::Project::Packages::Show.perform(&:click_delete) Page::Project::Packages::Index.perform do |index| aggregate_failures do 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 17c53b3ddc9..5ea7a7bb4cb 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 @@ -30,7 +30,7 @@ module QA pipeline.visit! end - it 'runs a Pages-specific pipeline', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/296937' do + it 'runs a Pages-specific pipeline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/877' 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 9ec05fcf5d3..0ef3715db5e 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/-/issues/751' do + it 'parent pipelines passes if child passes', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1153' 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/-/issues/752' do + it 'parent pipeline fails if child fails', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1152' 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 ed8c8baae0e..6c7ab9f2f72 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/-/issues/754' do + it 'parent pipelines passes if child passes', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1161' 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/-/issues/753' do + it 'parent pipeline passes even if child fails', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1162' 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 a619ccfad19..171a4776eaf 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 @@ -117,7 +117,7 @@ module QA end end - it 'runs an AutoDevOps pipeline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/444' do + it 'runs an AutoDevOps pipeline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1277' do Flow::Pipeline.visit_latest_pipeline Page::Project::Pipeline::Show.perform do |pipeline| diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb index 9027f17678d..04eaa02bda5 100644 --- a/qa/qa/specs/runner.rb +++ b/qa/qa/specs/runner.rb @@ -37,7 +37,7 @@ module QA if tags.any? tags.each { |tag| tags_for_rspec.push(['--tag', tag.to_s]) } else - tags_for_rspec.push(%w[--tag ~orchestrated]) unless (%w[-t --tag] & options).any? + tags_for_rspec.push(%w[--tag ~orchestrated --tag ~transient]) unless (%w[-t --tag] & options).any? end tags_for_rspec.push(%w[--tag ~geo]) unless QA::Runtime::Env.geo_environment? diff --git a/qa/qa/tools/revoke_all_personal_access_tokens.rb b/qa/qa/tools/revoke_all_personal_access_tokens.rb index e33d522bece..0aaf1ed6f7f 100644 --- a/qa/qa/tools/revoke_all_personal_access_tokens.rb +++ b/qa/qa/tools/revoke_all_personal_access_tokens.rb @@ -27,7 +27,7 @@ module QA Runtime::Browser.visit(ENV['GITLAB_ADDRESS'], Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - Page::Main::Menu.perform(&:click_settings_link) + Page::Main::Menu.perform(&:click_edit_profile_link) Page::Profile::Menu.perform(&:click_access_tokens) token_name = 'api-test-token' diff --git a/qa/spec/specs/runner_spec.rb b/qa/spec/specs/runner_spec.rb index b11054f0bd9..642d9e0745b 100644 --- a/qa/spec/specs/runner_spec.rb +++ b/qa/spec/specs/runner_spec.rb @@ -3,9 +3,9 @@ require 'active_support/core_ext/hash' RSpec.describe QA::Specs::Runner do - shared_examples 'excludes orchestrated and geo' do - it 'excludes the orchestrated and geo tags and includes default args' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', *described_class::DEFAULT_TEST_PATH_ARGS]) + shared_examples 'excludes orchestrated, transient, and geo' do + it 'excludes the orchestrated, transient, and geo tags, and includes default args' do + expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~transient', '--tag', '~geo', *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end @@ -18,13 +18,13 @@ RSpec.describe QA::Specs::Runner do QA::Runtime::Scenario.define(:gitlab_address, "http://gitlab.test") end - it_behaves_like 'excludes orchestrated and geo' + it_behaves_like 'excludes orchestrated, transient, and geo' context 'when tty is set' do subject { described_class.new.tap { |runner| runner.tty = true } } it 'sets the `--tty` flag' do - expect_rspec_runner_arguments(['--tty', '--tag', '~orchestrated', '--tag', '~geo', *described_class::DEFAULT_TEST_PATH_ARGS]) + expect_rspec_runner_arguments(['--tty', '--tag', '~orchestrated', '--tag', '~transient', '--tag', '~geo', *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end @@ -43,7 +43,7 @@ RSpec.describe QA::Specs::Runner do context 'when "--tag smoke" is set as options' do subject { described_class.new.tap { |runner| runner.options = %w[--tag smoke] } } - it 'focuses on the given tag without excluded the orchestrated tag' do + it 'focuses on the given tag without excluded tags' do expect_rspec_runner_arguments(['--tag', '~geo', '--tag', 'smoke', *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform @@ -53,8 +53,8 @@ RSpec.describe QA::Specs::Runner do context 'when "qa/specs/features/foo" is set as options' do subject { described_class.new.tap { |runner| runner.options = %w[qa/specs/features/foo] } } - it 'passes the given tests path and excludes the orchestrated and geo tags' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', 'qa/specs/features/foo']) + it 'passes the given tests path and excludes the orchestrated, transient, and geo tags' do + expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~transient', '--tag', '~geo', 'qa/specs/features/foo']) subject.perform end @@ -63,7 +63,7 @@ RSpec.describe QA::Specs::Runner do context 'when "--tag smoke" and "qa/specs/features/foo" are set as options' do subject { described_class.new.tap { |runner| runner.options = %w[--tag smoke qa/specs/features/foo] } } - it 'focuses on the given tag and includes the path without excluding the orchestrated tag' do + it 'focuses on the given tag and includes the path without excluding the orchestrated or transient tags' do expect_rspec_runner_arguments(['--tag', '~geo', '--tag', 'smoke', 'qa/specs/features/foo']) subject.perform @@ -76,7 +76,7 @@ RSpec.describe QA::Specs::Runner do end it 'includes default args and excludes the skip_signup_disabled tag' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', '--tag', '~skip_signup_disabled', *described_class::DEFAULT_TEST_PATH_ARGS]) + expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~transient', '--tag', '~geo', '--tag', '~skip_signup_disabled', *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end @@ -88,7 +88,7 @@ RSpec.describe QA::Specs::Runner do end it 'includes default args and excludes the skip_live_env tag' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', '--tag', '~skip_live_env', *described_class::DEFAULT_TEST_PATH_ARGS]) + expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~transient', '--tag', '~geo', '--tag', '~skip_live_env', *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end end @@ -121,7 +121,7 @@ RSpec.describe QA::Specs::Runner do end it 'includes default args and excludes all unsupported tags' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~geo', *excluded_feature_tags_except(feature), *described_class::DEFAULT_TEST_PATH_ARGS]) + expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~transient', '--tag', '~geo', *excluded_feature_tags_except(feature), *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end @@ -146,11 +146,11 @@ RSpec.describe QA::Specs::Runner do end end - it_behaves_like 'excludes orchestrated and geo' + it_behaves_like 'excludes orchestrated, transient, and geo' end context 'when features are not specified' do - it_behaves_like 'excludes orchestrated and geo' + it_behaves_like 'excludes orchestrated, transient, and geo' end end diff --git a/qa/spec/support/matchers/have_assignee.rb b/qa/spec/support/matchers/have_assignee.rb deleted file mode 100644 index 5e7aa2162b2..00000000000 --- a/qa/spec/support/matchers/have_assignee.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveAssignee - RSpec::Matchers.define :have_assignee do |assignee| - match do |page_object| - page_object.has_assignee?(assignee) - end - - match_when_negated do |page_object| - page_object.has_no_assignee?(assignee) - end - end - end -end diff --git a/qa/spec/support/matchers/have_child_pipeline.rb b/qa/spec/support/matchers/have_child_pipeline.rb deleted file mode 100644 index d05d9d4209a..00000000000 --- a/qa/spec/support/matchers/have_child_pipeline.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveChildPipeline - RSpec::Matchers.define :have_child_pipeline do - match do |page_object| - page_object.has_child_pipeline? - end - - match_when_negated do |page_object| - page_object.has_no_child_pipeline? - end - end - end -end diff --git a/qa/spec/support/matchers/have_content.rb b/qa/spec/support/matchers/have_content.rb deleted file mode 100644 index 66b30b3b6e4..00000000000 --- a/qa/spec/support/matchers/have_content.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveContent - RSpec::Matchers.define :have_content do |content| - match do |page_object| - page_object.has_content?(content) - end - - match_when_negated do |page_object| - page_object.has_no_content?(content) - end - end - end -end diff --git a/qa/spec/support/matchers/have_design.rb b/qa/spec/support/matchers/have_design.rb deleted file mode 100644 index 85f1367297a..00000000000 --- a/qa/spec/support/matchers/have_design.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveDesign - RSpec::Matchers.define :have_design do |design| - match do |page_object| - page_object.has_design?(design) - end - - match_when_negated do |page_object| - page_object.has_no_design?(design) - end - end - end -end diff --git a/qa/spec/support/matchers/have_element.rb b/qa/spec/support/matchers/have_element.rb deleted file mode 100644 index bf74a78a3b5..00000000000 --- a/qa/spec/support/matchers/have_element.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveElement - RSpec::Matchers.define :have_element do |element, **kwargs| - match do |page_object| - page_object.has_element?(element, **kwargs) - end - - match_when_negated do |page_object| - page_object.has_no_element?(element, **kwargs) - end - end - end -end diff --git a/qa/spec/support/matchers/have_file.rb b/qa/spec/support/matchers/have_file.rb deleted file mode 100644 index 2ae295d5ca2..00000000000 --- a/qa/spec/support/matchers/have_file.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveFile - RSpec::Matchers.define :have_file do |file| - match do |page_object| - page_object.has_file?(file) - end - - match_when_negated do |page_object| - page_object.has_no_file?(file) - end - end - end -end diff --git a/qa/spec/support/matchers/have_file_content.rb b/qa/spec/support/matchers/have_file_content.rb deleted file mode 100644 index e42ece6d59e..00000000000 --- a/qa/spec/support/matchers/have_file_content.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveFileContent - RSpec::Matchers.define :have_file_content do |file_content, file_number| - match do |page_object| - page_object.has_file_content?(file_content, file_number) - end - - match_when_negated do |page_object| - page_object.has_no_file_content?(file_content, file_number) - end - end - end -end diff --git a/qa/spec/support/matchers/have_issue.rb b/qa/spec/support/matchers/have_issue.rb deleted file mode 100644 index 7ef30f22726..00000000000 --- a/qa/spec/support/matchers/have_issue.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveIssue - RSpec::Matchers.define :have_issue do |issue| - match do |page_object| - page_object.has_issue?(issue) - end - - match_when_negated do |page_object| - page_object.has_no_issue?(issue) - end - end - end -end diff --git a/qa/spec/support/matchers/have_job.rb b/qa/spec/support/matchers/have_job.rb deleted file mode 100644 index 89829915fce..00000000000 --- a/qa/spec/support/matchers/have_job.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveJob - RSpec::Matchers.define :have_job do |job| - match do |page_object| - page_object.has_job?(job) - end - - match_when_negated do |page_object| - page_object.has_no_job?(job) - end - end - end -end diff --git a/qa/spec/support/matchers/have_matcher.rb b/qa/spec/support/matchers/have_matcher.rb new file mode 100644 index 00000000000..43ae27f8796 --- /dev/null +++ b/qa/spec/support/matchers/have_matcher.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Matchers + PREDICATE_TARGETS = %w[ + element + file_content + assignee + child_pipeline + content + design + file + issue + job + package + pipeline + related_issue_item + snippet_description + ].each do |predicate| + RSpec::Matchers.define "have_#{predicate}" do |*args, **kwargs| + match do |page_object| + page_object.public_send("has_#{predicate}?", *args, **kwargs) # rubocop:disable GitlabSecurity/PublicSend + end + + match_when_negated do |page_object| + page_object.public_send("has_no_#{predicate}?", *args, **kwargs) # rubocop:disable GitlabSecurity/PublicSend + end + end + end +end diff --git a/qa/spec/support/matchers/have_package.rb b/qa/spec/support/matchers/have_package.rb deleted file mode 100644 index 86e9bfee4d1..00000000000 --- a/qa/spec/support/matchers/have_package.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HavePackage - RSpec::Matchers.define :have_package do |package| - match do |page_object| - page_object.has_package?(package) - end - - match_when_negated do |page_object| - page_object.has_no_package?(package) - end - end - end -end diff --git a/qa/spec/support/matchers/have_pipeline.rb b/qa/spec/support/matchers/have_pipeline.rb deleted file mode 100644 index 2bfd49d671a..00000000000 --- a/qa/spec/support/matchers/have_pipeline.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HavePipeline - RSpec::Matchers.define :have_pipeline do - match do |page_object| - page_object.has_pipeline? - end - - match_when_negated do |page_object| - page_object.has_no_pipeline? - end - end - end -end diff --git a/qa/spec/support/matchers/have_related_issue_item.rb b/qa/spec/support/matchers/have_related_issue_item.rb deleted file mode 100644 index 89403f2422a..00000000000 --- a/qa/spec/support/matchers/have_related_issue_item.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveRelatedIssueItem - RSpec::Matchers.define :have_related_issue_item do - match do |page_object| - page_object.has_related_issue_item? - end - - match_when_negated do |page_object| - page_object.has_no_related_issue_item? - end - end - end -end diff --git a/qa/spec/support/matchers/have_snippet_description.rb b/qa/spec/support/matchers/have_snippet_description.rb deleted file mode 100644 index 7c407aefc83..00000000000 --- a/qa/spec/support/matchers/have_snippet_description.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module Matchers - module HaveSnippetDescription - RSpec::Matchers.define :have_snippet_description do |description| - match do |page_object| - page_object.has_snippet_description?(description) - end - - match_when_negated do |page_object| - page_object.has_no_snippet_description? - end - end - end -end |