diff options
Diffstat (limited to 'qa/qa')
192 files changed, 1251 insertions, 1242 deletions
diff --git a/qa/qa/fixtures/auto_devops_rack/Gemfile b/qa/qa/fixtures/auto_devops_rack/Gemfile index fc7514242d0..4dc1482dfd2 100644 --- a/qa/qa/fixtures/auto_devops_rack/Gemfile +++ b/qa/qa/fixtures/auto_devops_rack/Gemfile @@ -1,3 +1,3 @@ -source 'https://rubygems.org' -gem 'rack' -gem 'rake' +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..20b1195c252 100644 --- a/qa/qa/fixtures/auto_devops_rack/Rakefile +++ b/qa/qa/fixtures/auto_devops_rack/Rakefile @@ -1,4 +1,4 @@ -require 'rake/testtask' +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..ea4aebd050f 100644 --- a/qa/qa/fixtures/auto_devops_rack/config.ru +++ b/qa/qa/fixtures/auto_devops_rack/config.ru @@ -1 +1 @@ -run lambda { |env| [200, { 'Content-Type' => 'text/plain' }, StringIO.new("Hello World! #{ENV['OPTIONAL_MESSAGE']}\n")] } +run lambda { |env| [200, {"Content-Type" => "text/plain"}, StringIO.new("Hello World! #{ENV["OPTIONAL_MESSAGE"]}\n")] } diff --git a/qa/qa/git/location.rb b/qa/qa/git/location.rb index b74f38f3ae3..b2b7d80f123 100644 --- a/qa/qa/git/location.rb +++ b/qa/qa/git/location.rb @@ -1,5 +1,5 @@ -require 'uri' -require 'forwardable' +require "uri" +require "forwardable" module QA module Git @@ -14,12 +14,12 @@ module QA def initialize(git_uri) @git_uri = git_uri @uri = - if git_uri =~ %r{\A(?:ssh|http|https)://} + if %r{\A(?:ssh|http|https)://}.match?(git_uri) URI.parse(git_uri) else - *rest, path = git_uri.split(':') + *rest, path = git_uri.split(":") # Host cannot have : so we'll need to escape it - user_host = rest.join('%3A').sub(/\A\[(.+)\]\z/, '\1') + user_host = rest.join("%3A").sub(/\A\[(.+)\]\z/, '\1') URI.parse("ssh://#{user_host}/#{path}") end end diff --git a/qa/qa/git/repository.rb b/qa/qa/git/repository.rb index 0aa94101098..907506ff0e8 100644 --- a/qa/qa/git/repository.rb +++ b/qa/qa/git/repository.rb @@ -1,12 +1,12 @@ # frozen_string_literal: true -require 'cgi' -require 'uri' -require 'open3' -require 'fileutils' -require 'tmpdir' -require 'tempfile' -require 'securerandom' +require "cgi" +require "uri" +require "open3" +require "fileutils" +require "tmpdir" +require "tempfile" +require "securerandom" module QA module Git @@ -22,7 +22,7 @@ module QA # We set HOME to the current working directory (which is a # temporary directory created in .perform()) so the temporarily dropped # .netrc can be utilised - self.env_vars = [%Q{HOME="#{tmp_home_dir}"}] + self.env_vars = [%(HOME="#{tmp_home_dir}")] @use_lfs = false end @@ -55,7 +55,7 @@ module QA self.username, self.password = default_credentials end - def clone(opts = '') + def clone(opts = "") clone_result = run("git clone #{opts} #{uri} ./") return clone_result.response unless clone_result.success @@ -65,17 +65,17 @@ module QA end def checkout(branch_name, new_branch: false) - opts = new_branch ? '-b' : '' - run(%Q{git checkout #{opts} "#{branch_name}"}).to_s + opts = new_branch ? "-b" : "" + run(%(git checkout #{opts} "#{branch_name}")).to_s end def shallow_clone - clone('--depth 1') + clone("--depth 1") end def configure_identity(name, email) - run(%Q{git config user.name #{name}}) - run(%Q{git config user.email #{email}}) + run(%(git config user.name #{name})) + run(%(git config user.email #{email})) end def commit_file(name, contents, message) @@ -87,20 +87,20 @@ module QA ::File.write(name, contents) if use_lfs? - git_lfs_track_result = run(%Q{git lfs track #{name} --lockable}) + git_lfs_track_result = run(%(git lfs track #{name} --lockable)) return git_lfs_track_result.response unless git_lfs_track_result.success end - git_add_result = run(%Q{git add #{name}}) + git_add_result = run(%(git add #{name})) git_lfs_track_result.to_s + git_add_result.to_s end def commit(message) - run(%Q{git commit -m "#{message}"}).to_s + run(%(git commit -m "#{message}")).to_s end - def push_changes(branch = 'master') + def push_changes(branch = "master") run("git push #{uri} #{branch}").to_s end @@ -109,22 +109,22 @@ module QA end def commits - run('git log --oneline').to_s.split("\n") + run("git log --oneline").to_s.split("\n") end def use_ssh_key(key) @private_key_file = Tempfile.new("id_#{SecureRandom.hex(8)}") File.binwrite(private_key_file, key.private_key) - File.chmod(0700, private_key_file) + File.chmod(0o700, private_key_file) @known_hosts_file = Tempfile.new("known_hosts_#{SecureRandom.hex(8)}") - keyscan_params = ['-H'] + keyscan_params = ["-H"] keyscan_params << "-p #{uri.port}" if uri.port keyscan_params << uri.host - res = run("ssh-keyscan #{keyscan_params.join(' ')} >> #{known_hosts_file.path}") + res = run("ssh-keyscan #{keyscan_params.join(" ")} >> #{known_hosts_file.path}") return res.response unless res.success? - self.env_vars << %Q{GIT_SSH_COMMAND="ssh -i #{private_key_file.path} -o UserKnownHostsFile=#{known_hosts_file.path}"} + env_vars << %(GIT_SSH_COMMAND="ssh -i #{private_key_file.path} -o UserKnownHostsFile=#{known_hosts_file.path}") end def delete_ssh_key @@ -134,7 +134,7 @@ module QA known_hosts_file.close(true) end - def push_with_git_protocol(version, file_name, file_content, commit_message = 'Initial commit') + def push_with_git_protocol(version, file_name, file_content, commit_message = "Initial commit") self.git_protocol = version add_file(file_name, file_content) commit(commit_message) @@ -153,7 +153,7 @@ module QA # ls-remote is one command known to respond to Git protocol v2 so we use # it to get output including the version reported via Git tracing output = run("git ls-remote #{uri}", "GIT_TRACE_PACKET=1") - output[/git< version (\d+)/, 1] || 'unknown' + output[/git< version (\d+)/, 1] || "unknown" end def try_add_credentials_to_netrc @@ -168,12 +168,12 @@ module QA attr_reader :uri, :username, :password, :known_hosts_file, :private_key_file, :use_lfs - alias_method :use_lfs?, :use_lfs + alias use_lfs? use_lfs - Result = Struct.new(:success, :response) do + Result = Struct.new(:success, :response) { alias_method :success?, :success alias_method :to_s, :response - end + } def add_credentials? return false if !username || !password @@ -192,13 +192,13 @@ module QA touch_gitconfig_result = run("touch #{tmp_home_dir}/.gitconfig") return touch_gitconfig_result.response unless touch_gitconfig_result.success? - git_lfs_install_result = run('git lfs install') + git_lfs_install_result = run("git lfs install") touch_gitconfig_result.to_s + git_lfs_install_result.to_s end def run(command_str, *extra_env) - command = [env_vars, *extra_env, command_str, '2>&1'].compact.join(' ') + command = [env_vars, *extra_env, command_str, "2>&1"].compact.join(" ") Runtime::Logger.debug "Git: pwd=[#{Dir.pwd}], command=[#{command}]" output, status = Open3.capture2e(command) @@ -229,8 +229,8 @@ module QA # a temporary directory created in .perform() # FileUtils.mkdir_p(tmp_home_dir) - File.open(netrc_file_path, 'a') { |file| file.puts(netrc_content) } - File.chmod(0600, netrc_file_path) + File.open(netrc_file_path, "a") { |file| file.puts(netrc_content) } + File.chmod(0o600, netrc_file_path) end def tmp_home_dir @@ -238,7 +238,7 @@ module QA end def netrc_file_path - @netrc_file_path ||= File.join(tmp_home_dir, '.netrc') + @netrc_file_path ||= File.join(tmp_home_dir, ".netrc") end def netrc_content diff --git a/qa/qa/page/admin/menu.rb b/qa/qa/page/admin/menu.rb index 25564f2dc6e..bfceb84b6fa 100644 --- a/qa/qa/page/admin/menu.rb +++ b/qa/qa/page/admin/menu.rb @@ -4,7 +4,7 @@ module QA module Page module Admin class Menu < Page::Base - view 'app/views/layouts/nav/sidebar/_admin.html.haml' do + view "app/views/layouts/nav/sidebar/_admin.html.haml" do element :admin_sidebar element :admin_sidebar_submenu element :admin_settings_item diff --git a/qa/qa/page/admin/settings/component/account_and_limit.rb b/qa/qa/page/admin/settings/component/account_and_limit.rb index a61c8cc77cd..a8d5e118e3f 100644 --- a/qa/qa/page/admin/settings/component/account_and_limit.rb +++ b/qa/qa/page/admin/settings/component/account_and_limit.rb @@ -6,7 +6,7 @@ module QA module Settings module Component class AccountAndLimit < Page::Base - view 'app/views/admin/application_settings/_account_and_limit.html.haml' do + view "app/views/admin/application_settings/_account_and_limit.html.haml" do element :receive_max_input_size_field element :save_changes_button end diff --git a/qa/qa/page/admin/settings/component/repository_storage.rb b/qa/qa/page/admin/settings/component/repository_storage.rb index 2ed0cd73aa3..47264c7aa53 100644 --- a/qa/qa/page/admin/settings/component/repository_storage.rb +++ b/qa/qa/page/admin/settings/component/repository_storage.rb @@ -6,7 +6,7 @@ module QA module Settings module Component class RepositoryStorage < Page::Base - view 'app/views/admin/application_settings/_repository_storage.html.haml' do + view "app/views/admin/application_settings/_repository_storage.html.haml" do element :hashed_storage_checkbox element :save_changes_button end diff --git a/qa/qa/page/admin/settings/general.rb b/qa/qa/page/admin/settings/general.rb index 93b290f7e03..fdf942d5cad 100644 --- a/qa/qa/page/admin/settings/general.rb +++ b/qa/qa/page/admin/settings/general.rb @@ -7,7 +7,7 @@ module QA class General < Page::Base include QA::Page::Settings::Common - view 'app/views/admin/application_settings/show.html.haml' do + view "app/views/admin/application_settings/show.html.haml" do element :account_and_limit_settings end diff --git a/qa/qa/page/admin/settings/repository.rb b/qa/qa/page/admin/settings/repository.rb index b7f1deb21bd..c4b5ad09665 100644 --- a/qa/qa/page/admin/settings/repository.rb +++ b/qa/qa/page/admin/settings/repository.rb @@ -7,7 +7,7 @@ module QA class Repository < Page::Base include QA::Page::Settings::Common - view 'app/views/admin/application_settings/repository.html.haml' do + view "app/views/admin/application_settings/repository.html.haml" do element :repository_storage_settings end diff --git a/qa/qa/page/alert/auto_devops_alert.rb b/qa/qa/page/alert/auto_devops_alert.rb index 8f66c805b77..dcbc3f4c121 100644 --- a/qa/qa/page/alert/auto_devops_alert.rb +++ b/qa/qa/page/alert/auto_devops_alert.rb @@ -4,7 +4,7 @@ module QA module Page module Alert class AutoDevopsAlert < Page::Base - view 'app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml' do + view "app/views/shared/_auto_devops_implicitly_enabled_banner.html.haml" do element :auto_devops_banner end end diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index 11ebd70292e..0646f24d03b 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'capybara/dsl' +require "capybara/dsl" module QA module Page @@ -71,10 +71,10 @@ module QA JS return false unless wait(interval: 0.5, max: 60, reload: false) do - page.evaluate_script('xhr.readyState == XMLHttpRequest.DONE') + page.evaluate_script("xhr.readyState == XMLHttpRequest.DONE") end - page.evaluate_script('xhr.status') == 200 + page.evaluate_script("xhr.status") == 200 end def find_element(name, text: nil, wait: Capybara.default_max_wait_time) @@ -126,7 +126,7 @@ module QA end def finished_loading? - has_no_css?('.fa-spinner', wait: Capybara.default_max_wait_time) + has_no_css?(".fa-spinner", wait: Capybara.default_max_wait_time) end def within_element(name) @@ -154,7 +154,7 @@ module QA end def click_body - find('body').click + find("body").click end def self.path diff --git a/qa/qa/page/component/clone_panel.rb b/qa/qa/page/component/clone_panel.rb index b80877f5ecd..1aa45638154 100644 --- a/qa/qa/page/component/clone_panel.rb +++ b/qa/qa/page/component/clone_panel.rb @@ -5,7 +5,7 @@ module QA module Component module ClonePanel def self.included(base) - base.view 'app/views/projects/buttons/_clone.html.haml' do + base.view "app/views/projects/buttons/_clone.html.haml" do element :clone_dropdown element :clone_options element :ssh_clone_url diff --git a/qa/qa/page/component/dropdown_filter.rb b/qa/qa/page/component/dropdown_filter.rb index e896c382779..27d0c053500 100644 --- a/qa/qa/page/component/dropdown_filter.rb +++ b/qa/qa/page/component/dropdown_filter.rb @@ -6,10 +6,10 @@ module QA module DropdownFilter def filter_and_select(item) wait(reload: false) do - page.has_css?('.dropdown-input-field') + page.has_css?(".dropdown-input-field") end - find('.dropdown-input-field').set(item) + find(".dropdown-input-field").set(item) click_link item end end diff --git a/qa/qa/page/component/dropzone.rb b/qa/qa/page/component/dropzone.rb index fd44c57123a..58182d735ba 100644 --- a/qa/qa/page/component/dropzone.rb +++ b/qa/qa/page/component/dropzone.rb @@ -17,8 +17,8 @@ module QA def attach_file(attachment) filename = ::File.basename(attachment) - field_style = { visibility: 'visible', height: '', width: '' } - page.attach_file(attachment, class: 'dz-hidden-input', make_visible: field_style) + field_style = {visibility: "visible", height: "", width: ""} + page.attach_file(attachment, class: "dz-hidden-input", make_visible: field_style) # Wait for link to be appended to dropzone text page.wait(reload: false) do diff --git a/qa/qa/page/component/groups_filter.rb b/qa/qa/page/component/groups_filter.rb index cc50bb439b4..0ea8b48e47f 100644 --- a/qa/qa/page/component/groups_filter.rb +++ b/qa/qa/page/component/groups_filter.rb @@ -5,11 +5,11 @@ module QA module Component module GroupsFilter def self.included(base) - base.view 'app/views/shared/groups/_search_form.html.haml' do + base.view "app/views/shared/groups/_search_form.html.haml" do element :groups_filter end - base.view 'app/assets/javascripts/groups/components/groups.vue' do + base.view "app/assets/javascripts/groups/components/groups.vue" do element :groups_list_tree_container end end @@ -28,7 +28,7 @@ module QA end # If there are no groups we'll know immediately because we filtered the list - return false if page.has_text?('No groups or projects matched your search', wait: 0) + return false if page.has_text?("No groups or projects matched your search", wait: 0) # The name will be present as filter input so we check for a link, not text page.has_link?(name, wait: 0) diff --git a/qa/qa/page/component/issuable/common.rb b/qa/qa/page/component/issuable/common.rb index cfd8ac1e7c8..48a5b89a2d5 100644 --- a/qa/qa/page/component/issuable/common.rb +++ b/qa/qa/page/component/issuable/common.rb @@ -6,24 +6,24 @@ module QA module Issuable module Common def self.included(base) - base.view 'app/assets/javascripts/issue_show/components/title.vue' do + base.view "app/assets/javascripts/issue_show/components/title.vue" do element :edit_button end - base.view 'app/assets/javascripts/issue_show/components/fields/title.vue' do + base.view "app/assets/javascripts/issue_show/components/fields/title.vue" do element :title_input end - base.view 'app/assets/javascripts/issue_show/components/fields/description.vue' do + base.view "app/assets/javascripts/issue_show/components/fields/description.vue" do element :description_textarea end - base.view 'app/assets/javascripts/issue_show/components/edit_actions.vue' do + base.view "app/assets/javascripts/issue_show/components/edit_actions.vue" do element :save_button element :delete_button end - base.view 'app/assets/javascripts/issue_show/components/edit_actions.vue' do + base.view "app/assets/javascripts/issue_show/components/edit_actions.vue" do element :save_button element :delete_button end diff --git a/qa/qa/page/component/lazy_loader.rb b/qa/qa/page/component/lazy_loader.rb index 6f74a4691ba..5555195ee25 100644 --- a/qa/qa/page/component/lazy_loader.rb +++ b/qa/qa/page/component/lazy_loader.rb @@ -5,7 +5,7 @@ module QA module Component module LazyLoader def self.included(base) - base.view 'app/assets/javascripts/lazy_loader.js' do + base.view "app/assets/javascripts/lazy_loader.js" do element :js_lazy_loaded end end diff --git a/qa/qa/page/component/legacy_clone_panel.rb b/qa/qa/page/component/legacy_clone_panel.rb index e495cf4ef04..50f207fdddc 100644 --- a/qa/qa/page/component/legacy_clone_panel.rb +++ b/qa/qa/page/component/legacy_clone_panel.rb @@ -5,26 +5,26 @@ module QA module Component module LegacyClonePanel def self.included(base) - base.view 'app/views/shared/_clone_panel.html.haml' do + base.view "app/views/shared/_clone_panel.html.haml" do element :clone_dropdown - element :clone_options_dropdown, '.clone-options-dropdown' # rubocop:disable QA/ElementWithPattern - element :project_repository_location, 'text_field_tag :project_clone' # rubocop:disable QA/ElementWithPattern + element :clone_options_dropdown, ".clone-options-dropdown" # rubocop:disable QA/ElementWithPattern + element :project_repository_location, "text_field_tag :project_clone" # rubocop:disable QA/ElementWithPattern end end def choose_repository_clone_http - choose_repository_clone('HTTP', 'http') + choose_repository_clone("HTTP", "http") end def choose_repository_clone_ssh # It's not always beginning with ssh:// so detecting with @ # would be more reliable because ssh would always contain it. # We can't use .git because HTTP also contain that part. - choose_repository_clone('SSH', '@') + choose_repository_clone("SSH", "@") end def repository_location - Git::Location.new(find('#project_clone').value) + Git::Location.new(find("#project_clone").value) end private @@ -33,7 +33,7 @@ module QA wait(reload: false) do click_element :clone_dropdown - page.within('.clone-options-dropdown') do + page.within(".clone-options-dropdown") do click_link(kind) end diff --git a/qa/qa/page/component/note.rb b/qa/qa/page/component/note.rb index f5add6bc9b5..224b9cd00aa 100644 --- a/qa/qa/page/component/note.rb +++ b/qa/qa/page/component/note.rb @@ -5,21 +5,21 @@ module QA module Component module Note def self.included(base) - base.view 'app/assets/javascripts/notes/components/comment_form.vue' do + base.view "app/assets/javascripts/notes/components/comment_form.vue" do element :note_dropdown element :discussion_option end - base.view 'app/assets/javascripts/notes/components/note_form.vue' do + base.view "app/assets/javascripts/notes/components/note_form.vue" do element :reply_input element :reply_comment_button end - base.view 'app/assets/javascripts/notes/components/noteable_discussion.vue' do + base.view "app/assets/javascripts/notes/components/noteable_discussion.vue" do element :discussion_reply end - base.view 'app/assets/javascripts/notes/components/toggle_replies_widget.vue' do + base.view "app/assets/javascripts/notes/components/toggle_replies_widget.vue" do element :expand_replies element :collapse_replies end diff --git a/qa/qa/page/component/select2.rb b/qa/qa/page/component/select2.rb index 98bcb96b92c..46c59999b9a 100644 --- a/qa/qa/page/component/select2.rb +++ b/qa/qa/page/component/select2.rb @@ -3,17 +3,17 @@ module QA module Component module Select2 def select_item(item_text) - find('.select2-result-label', text: item_text).click + find(".select2-result-label", text: item_text).click end def clear_current_selection_if_present - if has_css?('a > abbr.select2-search-choice-close', wait: 1.0) - find('a > abbr.select2-search-choice-close').click + if has_css?("a > abbr.select2-search-choice-close", wait: 1.0) + find("a > abbr.select2-search-choice-close").click end end def search_and_select(item_text) - find('.select2-input').set(item_text) + find(".select2-input").set(item_text) select_item(item_text) end end diff --git a/qa/qa/page/component/users_select.rb b/qa/qa/page/component/users_select.rb index f88d6450a33..e51943f24b4 100644 --- a/qa/qa/page/component/users_select.rb +++ b/qa/qa/page/component/users_select.rb @@ -6,7 +6,7 @@ module QA module UsersSelect def select_user(element, username) find("#{element_selector_css(element)} input").set(username) - find('.ajax-users-dropdown .user-username', text: "@#{username}").click + find(".ajax-users-dropdown .user-username", text: "@#{username}").click end end end diff --git a/qa/qa/page/dashboard/groups.rb b/qa/qa/page/dashboard/groups.rb index 7a07515de62..3292fa96851 100644 --- a/qa/qa/page/dashboard/groups.rb +++ b/qa/qa/page/dashboard/groups.rb @@ -6,12 +6,12 @@ module QA class Groups < Page::Base include Page::Component::GroupsFilter - view 'app/views/shared/groups/_search_form.html.haml' do - element :groups_filter, 'search_field_tag :filter' # rubocop:disable QA/ElementWithPattern - element :groups_filter_placeholder, 'Search by name' # rubocop:disable QA/ElementWithPattern + view "app/views/shared/groups/_search_form.html.haml" do + element :groups_filter, "search_field_tag :filter" # rubocop:disable QA/ElementWithPattern + element :groups_filter_placeholder, "Search by name" # rubocop:disable QA/ElementWithPattern end - view 'app/views/dashboard/_groups_head.html.haml' do + view "app/views/dashboard/_groups_head.html.haml" do element :new_group_button, 'link_to _("New group")' # rubocop:disable QA/ElementWithPattern end @@ -24,7 +24,7 @@ module QA end def go_to_new_group - click_on 'New group' + click_on "New group" end end end diff --git a/qa/qa/page/dashboard/projects.rb b/qa/qa/page/dashboard/projects.rb index 0f434577b3b..9ccc65a7662 100644 --- a/qa/qa/page/dashboard/projects.rb +++ b/qa/qa/page/dashboard/projects.rb @@ -2,9 +2,9 @@ module QA module Page module Dashboard class Projects < Page::Base - view 'app/views/dashboard/projects/index.html.haml' + view "app/views/dashboard/projects/index.html.haml" - view 'app/views/shared/projects/_search_form.html.haml' do + view "app/views/shared/projects/_search_form.html.haml" do element :form_filter_by_name, /form_tag.+id: 'project-filter-form'/ # rubocop:disable QA/ElementWithPattern end @@ -17,7 +17,7 @@ module QA private def filter_by_name(name) - page.within('form#project-filter-form') do + page.within("form#project-filter-form") do fill_in :name, with: name end end diff --git a/qa/qa/page/element.rb b/qa/qa/page/element.rb index 9944a39ce07..fdeb1c0d656 100644 --- a/qa/qa/page/element.rb +++ b/qa/qa/page/element.rb @@ -9,7 +9,7 @@ module QA end def selector - "qa-#{@name.to_s.tr('_', '-')}" + "qa-#{@name.to_s.tr("_", "-")}" end def selector_css diff --git a/qa/qa/page/file/form.rb b/qa/qa/page/file/form.rb index a1534231691..e6cc8402b17 100644 --- a/qa/qa/page/file/form.rb +++ b/qa/qa/page/file/form.rb @@ -5,16 +5,16 @@ module QA include Shared::CommitMessage include Page::Component::DropdownFilter - view 'app/views/projects/blob/_editor.html.haml' do + view "app/views/projects/blob/_editor.html.haml" do element :file_name, "text_field_tag 'file_name'" # rubocop:disable QA/ElementWithPattern - element :editor, '#editor' # rubocop:disable QA/ElementWithPattern + element :editor, "#editor" # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/_commit_button.html.haml' do + view "app/views/projects/_commit_button.html.haml" do element :commit_changes, "button_tag 'Commit changes'" # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/blob/_template_selectors.html.haml' do + view "app/views/projects/blob/_template_selectors.html.haml" do element :template_type_dropdown element :gitignore_dropdown element :gitlab_ci_yml_dropdown @@ -23,7 +23,7 @@ module QA end def add_name(name) - fill_in 'file_name', with: name + fill_in "file_name", with: name end def add_content(content) @@ -31,11 +31,11 @@ module QA end def remove_content - text_area.send_keys([:command, 'a'], :backspace) + text_area.send_keys([:command, "a"], :backspace) end def commit_changes - click_on 'Commit changes' + click_on "Commit changes" end def select_template(template_type, template) @@ -43,16 +43,16 @@ module QA click_link template_type case template_type - when '.gitignore' + when ".gitignore" click_element :gitignore_dropdown - when '.gitlab-ci.yml' + when ".gitlab-ci.yml" click_element :gitlab_ci_yml_dropdown - when 'Dockerfile' + when "Dockerfile" click_element :dockerfile_dropdown - when 'LICENSE' + when "LICENSE" click_element :license_dropdown else - raise %Q(Unsupported template_type "#{template_type}". Please confirm that it is a valid option.) + raise %(Unsupported template_type "#{template_type}". Please confirm that it is a valid option.) end filter_and_select template end @@ -60,7 +60,7 @@ module QA private def text_area - find('#editor>textarea', visible: false) + find("#editor>textarea", visible: false) end end end diff --git a/qa/qa/page/file/shared/commit_message.rb b/qa/qa/page/file/shared/commit_message.rb index aa1bb081cd3..7d8cc757427 100644 --- a/qa/qa/page/file/shared/commit_message.rb +++ b/qa/qa/page/file/shared/commit_message.rb @@ -4,13 +4,13 @@ module QA module Shared module CommitMessage def self.included(base) - base.view 'app/views/shared/_commit_message_container.html.haml' do + base.view "app/views/shared/_commit_message_container.html.haml" do element :commit_message, "text_area_tag 'commit_message'" # rubocop:disable QA/ElementWithPattern end end def add_commit_message(message) - fill_in 'commit_message', with: message + fill_in "commit_message", with: message end end end diff --git a/qa/qa/page/file/show.rb b/qa/qa/page/file/show.rb index abd8ebb089f..b4ba02a4426 100644 --- a/qa/qa/page/file/show.rb +++ b/qa/qa/page/file/show.rb @@ -4,25 +4,25 @@ module QA class Show < Page::Base include Shared::CommitMessage - view 'app/helpers/blob_helper.rb' do + view "app/helpers/blob_helper.rb" do element :edit_button, "_('Edit')" # rubocop:disable QA/ElementWithPattern element :delete_button, /label:\s+"Delete"/ # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/blob/_remove.html.haml' do + view "app/views/projects/blob/_remove.html.haml" do element :delete_file_button, "button_tag 'Delete file'" # rubocop:disable QA/ElementWithPattern end def click_edit - click_on 'Edit' + click_on "Edit" end def click_delete - click_on 'Delete' + click_on "Delete" end def click_delete_file - click_on 'Delete file' + click_on "Delete file" end end end diff --git a/qa/qa/page/group/new.rb b/qa/qa/page/group/new.rb index 39584daf334..a8db21d785d 100644 --- a/qa/qa/page/group/new.rb +++ b/qa/qa/page/group/new.rb @@ -2,24 +2,24 @@ module QA module Page module Group class New < Page::Base - view 'app/views/shared/_group_form.html.haml' do - element :group_path_field, 'text_field :path' # rubocop:disable QA/ElementWithPattern - element :group_name_field, 'text_field :name' # rubocop:disable QA/ElementWithPattern - element :group_description_field, 'text_area :description' # rubocop:disable QA/ElementWithPattern + view "app/views/shared/_group_form.html.haml" do + element :group_path_field, "text_field :path" # rubocop:disable QA/ElementWithPattern + element :group_name_field, "text_field :name" # rubocop:disable QA/ElementWithPattern + element :group_description_field, "text_area :description" # rubocop:disable QA/ElementWithPattern end - view 'app/views/groups/new.html.haml' do + view "app/views/groups/new.html.haml" do element :create_group_button, "submit 'Create group'" # rubocop:disable QA/ElementWithPattern - element :visibility_radios, 'visibility_level:' # rubocop:disable QA/ElementWithPattern + element :visibility_radios, "visibility_level:" # rubocop:disable QA/ElementWithPattern end def set_path(path) - fill_in 'group_path', with: path - fill_in 'group_name', with: path + fill_in "group_path", with: path + fill_in "group_name", with: path end def set_description(description) - fill_in 'group_description', with: description + fill_in "group_description", with: description end def set_visibility(visibility) @@ -27,7 +27,7 @@ module QA end def create - click_button 'Create group' + click_button "Create group" end end end diff --git a/qa/qa/page/group/show.rb b/qa/qa/page/group/show.rb index 41716326685..287967771a6 100644 --- a/qa/qa/page/group/show.rb +++ b/qa/qa/page/group/show.rb @@ -6,7 +6,7 @@ module QA class Show < Page::Base include Page::Component::GroupsFilter - view 'app/views/groups/_home_panel.html.haml' do + view "app/views/groups/_home_panel.html.haml" do element :new_project_or_subgroup_dropdown element :new_project_or_subgroup_dropdown_toggle element :new_project_option @@ -14,8 +14,8 @@ module QA element :new_in_group_button end - view 'app/assets/javascripts/groups/constants.js' do - element :no_result_text, 'No groups or projects matched your search' # rubocop:disable QA/ElementWithPattern + view "app/assets/javascripts/groups/constants.js" do + element :no_result_text, "No groups or projects matched your search" # rubocop:disable QA/ElementWithPattern end def go_to_subgroup(name) diff --git a/qa/qa/page/issuable/sidebar.rb b/qa/qa/page/issuable/sidebar.rb index d3751b712c9..3d1fdf61c47 100644 --- a/qa/qa/page/issuable/sidebar.rb +++ b/qa/qa/page/issuable/sidebar.rb @@ -2,19 +2,19 @@ module QA module Page module Issuable class Sidebar < Page::Base - view 'app/views/shared/issuable/_sidebar.html.haml' do + view "app/views/shared/issuable/_sidebar.html.haml" do element :labels_block, ".issuable-show-labels" # rubocop:disable QA/ElementWithPattern - element :milestones_block, '.block.milestone' # rubocop:disable QA/ElementWithPattern + element :milestones_block, ".block.milestone" # rubocop:disable QA/ElementWithPattern end def has_label?(label) - page.within('.issuable-show-labels') do - !!find('span', text: label) + page.within(".issuable-show-labels") do + !!find("span", text: label) end end def has_milestone?(milestone) - page.within('.block.milestone') do + page.within(".block.milestone") do !!find("[href*='/milestones/']", text: milestone) end end diff --git a/qa/qa/page/label/index.rb b/qa/qa/page/label/index.rb index de0cfa9f293..8bf9692f6fc 100644 --- a/qa/qa/page/label/index.rb +++ b/qa/qa/page/label/index.rb @@ -6,15 +6,15 @@ module QA class Index < Page::Base include Component::LazyLoader - view 'app/views/shared/labels/_nav.html.haml' do + view "app/views/shared/labels/_nav.html.haml" do element :label_create_new end - view 'app/views/shared/empty_states/_labels.html.haml' do + view "app/views/shared/empty_states/_labels.html.haml" do element :label_svg end - view 'app/views/shared/empty_states/_priority_labels.html.haml' do + view "app/views/shared/empty_states/_priority_labels.html.haml" do element :label_svg end diff --git a/qa/qa/page/label/new.rb b/qa/qa/page/label/new.rb index b5422dc9400..00aa01e7f9a 100644 --- a/qa/qa/page/label/new.rb +++ b/qa/qa/page/label/new.rb @@ -2,7 +2,7 @@ module QA module Page module Label class New < Page::Base - view 'app/views/shared/labels/_form.html.haml' do + view "app/views/shared/labels/_form.html.haml" do element :label_title element :label_description element :label_color diff --git a/qa/qa/page/layout/banner.rb b/qa/qa/page/layout/banner.rb index 2223f2adec8..acd8bd6799c 100644 --- a/qa/qa/page/layout/banner.rb +++ b/qa/qa/page/layout/banner.rb @@ -2,13 +2,13 @@ module QA module Page module Layout class Banner < Page::Base - view 'app/views/layouts/header/_read_only_banner.html.haml' do + view "app/views/layouts/header/_read_only_banner.html.haml" do element :flash_notice, ".flash-notice" # rubocop:disable QA/ElementWithPattern end def has_notice?(message) - page.within('.flash-notice') do - !!find('span', text: message) + page.within(".flash-notice") do + !!find("span", text: message) end end end diff --git a/qa/qa/page/main/login.rb b/qa/qa/page/main/login.rb index e03fe9ab83a..2d1056fe461 100644 --- a/qa/qa/page/main/login.rb +++ b/qa/qa/page/main/login.rb @@ -2,41 +2,41 @@ module QA module Page module Main class Login < Page::Base - view 'app/views/devise/passwords/edit.html.haml' do + view "app/views/devise/passwords/edit.html.haml" do element :password_field element :password_confirmation element :change_password_button end - view 'app/views/devise/sessions/_new_base.html.haml' do + view "app/views/devise/sessions/_new_base.html.haml" do element :login_field element :password_field element :sign_in_button end - view 'app/views/devise/sessions/_new_ldap.html.haml' do + view "app/views/devise/sessions/_new_ldap.html.haml" do element :username_field element :password_field element :sign_in_button end - view 'app/views/devise/shared/_tabs_ldap.html.haml' do + view "app/views/devise/shared/_tabs_ldap.html.haml" do element :ldap_tab element :standard_tab element :register_tab end - view 'app/views/devise/shared/_tabs_normal.html.haml' do + view "app/views/devise/shared/_tabs_normal.html.haml" do element :sign_in_tab element :register_tab end - view 'app/helpers/auth_helper.rb' do + view "app/helpers/auth_helper.rb" do element :saml_login_button element :github_login_button end - view 'app/views/layouts/devise.html.haml' do + view "app/views/layouts/devise.html.haml" do element :login_page end @@ -87,7 +87,7 @@ module QA end def self.path - '/users/sign_in' + "/users/sign_in" end def has_sign_in_tab? @@ -103,15 +103,15 @@ module QA end def sign_in_tab? - has_css?(".active", text: 'Sign in') + has_css?(".active", text: "Sign in") end def ldap_tab? - has_css?(".active", text: 'LDAP') + has_css?(".active", text: "LDAP") end def standard_tab? - has_css?(".active", text: 'Standard') + has_css?(".active", text: "Standard") end def switch_to_sign_in_tab @@ -161,7 +161,7 @@ module QA end def set_initial_password_if_present - return unless has_content?('Change your password') + return unless has_content?("Change your password") fill_element :password_field, Runtime::User.password fill_element :password_confirmation, Runtime::User.password diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb index 55500e831c6..b14bc729daf 100644 --- a/qa/qa/page/main/menu.rb +++ b/qa/qa/page/main/menu.rb @@ -4,24 +4,24 @@ module QA module Page module Main class Menu < Page::Base - view 'app/views/layouts/header/_current_user_dropdown.html.haml' do + view "app/views/layouts/header/_current_user_dropdown.html.haml" do element :user_sign_out_link, 'link_to _("Sign out")' # rubocop:disable QA/ElementWithPattern element :settings_link, 'link_to s_("CurrentUser|Settings")' # rubocop:disable QA/ElementWithPattern end - view 'app/views/layouts/header/_default.html.haml' do + view "app/views/layouts/header/_default.html.haml" do element :navbar element :user_avatar - element :user_menu, '.dropdown-menu' # rubocop:disable QA/ElementWithPattern + element :user_menu, ".dropdown-menu" # rubocop:disable QA/ElementWithPattern end - view 'app/views/layouts/nav/_dashboard.html.haml' do + view "app/views/layouts/nav/_dashboard.html.haml" do element :admin_area_link element :projects_dropdown element :groups_dropdown end - view 'app/views/layouts/nav/projects_dropdown/_show.html.haml' do + view "app/views/layouts/nav/projects_dropdown/_show.html.haml" do element :projects_dropdown_sidebar element :your_projects_link end @@ -31,7 +31,7 @@ module QA click_element :groups_dropdown end - page.within('.qa-groups-dropdown-sidebar') do + page.within(".qa-groups-dropdown-sidebar") do click_element :your_groups_link end end @@ -41,7 +41,7 @@ module QA click_element :projects_dropdown end - page.within('.qa-projects-dropdown-sidebar') do + page.within(".qa-projects-dropdown-sidebar") do click_element :your_projects_link end end @@ -52,17 +52,17 @@ module QA def sign_out within_user_menu do - click_link 'Sign out' + click_link "Sign out" end end def go_to_profile_settings retry_until(reload: false) do within_user_menu do - click_link 'Settings' + click_link "Settings" end - has_text?('User Settings') + has_text?("User Settings") end end @@ -77,7 +77,7 @@ module QA private def within_top_menu - page.within('.qa-navbar') do + page.within(".qa-navbar") do yield end end @@ -86,7 +86,7 @@ module QA within_top_menu do click_element :user_avatar - page.within('.dropdown-menu') do + page.within(".dropdown-menu") do yield end end diff --git a/qa/qa/page/main/oauth.rb b/qa/qa/page/main/oauth.rb index bc44d274314..62858ca0aaa 100644 --- a/qa/qa/page/main/oauth.rb +++ b/qa/qa/page/main/oauth.rb @@ -2,16 +2,16 @@ module QA module Page module Main class OAuth < Page::Base - view 'app/views/doorkeeper/authorizations/new.html.haml' do + view "app/views/doorkeeper/authorizations/new.html.haml" do element :authorization_button, 'submit_tag _("Authorize")' # rubocop:disable QA/ElementWithPattern end def needs_authorization? - page.current_url.include?('/oauth') + page.current_url.include?("/oauth") end def authorize! - click_button 'Authorize' + click_button "Authorize" end end end diff --git a/qa/qa/page/main/sign_up.rb b/qa/qa/page/main/sign_up.rb index 46a105003d0..8fe9c956bb7 100644 --- a/qa/qa/page/main/sign_up.rb +++ b/qa/qa/page/main/sign_up.rb @@ -4,7 +4,7 @@ module QA module Page module Main class SignUp < Page::Base - view 'app/views/devise/shared/_signup_box.html.haml' do + view "app/views/devise/shared/_signup_box.html.haml" do element :new_user_name element :new_user_username element :new_user_email @@ -23,11 +23,11 @@ module QA check_element :new_user_accept_terms if has_element?(:new_user_accept_terms) - signed_in = retry_until do + signed_in = retry_until { click_element :new_user_register_button Page::Main::Menu.act { has_personal_area? } - end + } raise "Failed to register and sign in" unless signed_in end diff --git a/qa/qa/page/mattermost/login.rb b/qa/qa/page/mattermost/login.rb index 9b21300ea3c..902e5f7ab9f 100644 --- a/qa/qa/page/mattermost/login.rb +++ b/qa/qa/page/mattermost/login.rb @@ -7,18 +7,18 @@ module QA # # See gitlab-org/gitlab-qa#154 # - view 'app/views/projects/mattermosts/new.html.haml' + view "app/views/projects/mattermosts/new.html.haml" def sign_in_using_oauth - click_link class: 'btn btn-custom-login gitlab' + click_link class: "btn btn-custom-login gitlab" - if page.has_content?('Authorize GitLab Mattermost to use your account?') - click_button 'Authorize' + if page.has_content?("Authorize GitLab Mattermost to use your account?") + click_button "Authorize" end end def self.path - '/login' + "/login" end end end diff --git a/qa/qa/page/mattermost/main.rb b/qa/qa/page/mattermost/main.rb index bc2f9acc729..309d1dabe72 100644 --- a/qa/qa/page/mattermost/main.rb +++ b/qa/qa/page/mattermost/main.rb @@ -7,7 +7,7 @@ module QA # # See gitlab-org/gitlab-qa#154 # - view 'app/views/projects/mattermosts/new.html.haml' + view "app/views/projects/mattermosts/new.html.haml" def initialize visit(Runtime::Scenario.mattermost_address) diff --git a/qa/qa/page/merge_request/new.rb b/qa/qa/page/merge_request/new.rb index 20d9c336367..3fe20ac88d6 100644 --- a/qa/qa/page/merge_request/new.rb +++ b/qa/qa/page/merge_request/new.rb @@ -2,31 +2,31 @@ module QA module Page module MergeRequest class New < Page::Base - view 'app/views/shared/issuable/_form.html.haml' do + view "app/views/shared/issuable/_form.html.haml" do element :issuable_create_button end - view 'app/views/shared/issuable/form/_title.html.haml' do + view "app/views/shared/issuable/form/_title.html.haml" do element :issuable_form_title end - view 'app/views/shared/issuable/form/_metadata.html.haml' do + view "app/views/shared/issuable/form/_metadata.html.haml" do element :issuable_milestone_dropdown end - view 'app/views/shared/form_elements/_description.html.haml' do + view "app/views/shared/form_elements/_description.html.haml" do element :issuable_form_description end - view 'app/views/shared/issuable/_milestone_dropdown.html.haml' do + view "app/views/shared/issuable/_milestone_dropdown.html.haml" do element :issuable_dropdown_menu_milestone end - view 'app/views/shared/issuable/_label_dropdown.html.haml' do + view "app/views/shared/issuable/_label_dropdown.html.haml" do element :issuable_label end - view 'app/views/shared/issuable/form/_metadata_merge_request_assignee.html.haml' do + view "app/views/shared/issuable/form/_metadata_merge_request_assignee.html.haml" do element :assign_to_me_link end diff --git a/qa/qa/page/merge_request/show.rb b/qa/qa/page/merge_request/show.rb index 976e431186d..f716b71cdde 100644 --- a/qa/qa/page/merge_request/show.rb +++ b/qa/qa/page/merge_request/show.rb @@ -6,51 +6,51 @@ module QA class Show < Page::Base include Page::Component::Note - view 'app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue' do + view "app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue" do element :merge_button - element :fast_forward_message, 'Fast-forward merge without a merge commit' # rubocop:disable QA/ElementWithPattern + element :fast_forward_message, "Fast-forward merge without a merge commit" # rubocop:disable QA/ElementWithPattern element :merge_moment_dropdown element :merge_when_pipeline_succeeds_option element :merge_immediately_option end - view 'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue' do - element :merged_status, 'The changes were merged into' # rubocop:disable QA/ElementWithPattern + view "app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.vue" do + element :merged_status, "The changes were merged into" # rubocop:disable QA/ElementWithPattern end - view 'app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue' do + view "app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.vue" do element :mr_rebase_button - element :no_fast_forward_message, 'Fast-forward merge is not possible' # rubocop:disable QA/ElementWithPattern + element :no_fast_forward_message, "Fast-forward merge is not possible" # rubocop:disable QA/ElementWithPattern end - view 'app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue' do + view "app/assets/javascripts/vue_merge_request_widget/components/states/squash_before_merge.vue" do element :squash_checkbox end - view 'app/views/projects/merge_requests/show.html.haml' do + view "app/views/projects/merge_requests/show.html.haml" do element :notes_tab element :diffs_tab end - view 'app/assets/javascripts/diffs/components/diff_line_gutter_content.vue' do + view "app/assets/javascripts/diffs/components/diff_line_gutter_content.vue" do element :diff_comment end - view 'app/assets/javascripts/diffs/components/inline_diff_table_row.vue' do + view "app/assets/javascripts/diffs/components/inline_diff_table_row.vue" do element :new_diff_line end - view 'app/views/shared/issuable/_sidebar.html.haml' do + view "app/views/shared/issuable/_sidebar.html.haml" do element :assignee_block element :labels_block end - view 'app/views/projects/merge_requests/_mr_title.html.haml' do + view "app/views/projects/merge_requests/_mr_title.html.haml" do element :edit_button end def fast_forward_possible? - has_no_text?('Fast-forward merge is not possible') + has_no_text?("Fast-forward merge is not possible") end def has_merge_button? @@ -85,9 +85,9 @@ module QA click_element :mr_rebase_button - success = wait do - has_text?('Fast-forward merge without a merge commit') - end + success = wait { + has_text?("Fast-forward merge without a merge commit") + } raise "Rebase did not appear to be successful" unless success end @@ -100,7 +100,7 @@ module QA def has_label?(label) page.within(element_selector_css(:labels_block)) do - element = find('span', text: label) + element = find("span", text: label) !element.nil? end end @@ -118,9 +118,9 @@ module QA merge_immediately - success = wait do - has_text?('The changes were merged into') - end + success = wait { + has_text?("The changes were merged into") + } raise "Merge did not appear to be successful" unless success end diff --git a/qa/qa/page/profile/menu.rb b/qa/qa/page/profile/menu.rb index 2d503499e13..d01fcb8165a 100644 --- a/qa/qa/page/profile/menu.rb +++ b/qa/qa/page/profile/menu.rb @@ -4,29 +4,29 @@ module QA module Page module Profile class Menu < Page::Base - view 'app/views/layouts/nav/sidebar/_profile.html.haml' do - element :access_token_link, 'link_to profile_personal_access_tokens_path' # rubocop:disable QA/ElementWithPattern - element :access_token_title, 'Access Tokens' # rubocop:disable QA/ElementWithPattern - element :top_level_items, '.sidebar-top-level-items' # rubocop:disable QA/ElementWithPattern - element :ssh_keys, 'SSH Keys' # rubocop:disable QA/ElementWithPattern + view "app/views/layouts/nav/sidebar/_profile.html.haml" do + element :access_token_link, "link_to profile_personal_access_tokens_path" # rubocop:disable QA/ElementWithPattern + element :access_token_title, "Access Tokens" # rubocop:disable QA/ElementWithPattern + element :top_level_items, ".sidebar-top-level-items" # rubocop:disable QA/ElementWithPattern + element :ssh_keys, "SSH Keys" # rubocop:disable QA/ElementWithPattern end def click_access_tokens within_sidebar do - click_link('Access Tokens') + click_link("Access Tokens") end end def click_ssh_keys within_sidebar do - click_link('SSH Keys') + click_link("SSH Keys") end end private def within_sidebar - page.within('.sidebar-top-level-items') do + page.within(".sidebar-top-level-items") do yield end end diff --git a/qa/qa/page/profile/personal_access_tokens.rb b/qa/qa/page/profile/personal_access_tokens.rb index 8c12eff5cf1..c89c06a0548 100644 --- a/qa/qa/page/profile/personal_access_tokens.rb +++ b/qa/qa/page/profile/personal_access_tokens.rb @@ -2,19 +2,19 @@ module QA module Page module Profile class PersonalAccessTokens < Page::Base - view 'app/views/shared/_personal_access_tokens_form.html.haml' do + view "app/views/shared/_personal_access_tokens_form.html.haml" do element :personal_access_token_name_field element :create_token_button end - view 'app/views/shared/tokens/_scopes_form.html.haml' do + view "app/views/shared/tokens/_scopes_form.html.haml" do element :api_radio, 'qa-#{scope}-radio' # rubocop:disable QA/ElementWithPattern, Lint/InterpolationCheck end - view 'app/views/shared/_personal_access_tokens_created_container.html.haml' do + view "app/views/shared/_personal_access_tokens_created_container.html.haml" do element :created_personal_access_token end - view 'app/views/shared/_personal_access_tokens_table.html.haml' do + view "app/views/shared/_personal_access_tokens_table.html.haml" do element :revoke_button end @@ -35,11 +35,11 @@ module QA end def has_token_row_for_name?(token_name) - page.has_css?('tr', text: token_name, wait: 1.0) + page.has_css?("tr", text: token_name, wait: 1.0) end def first_token_row_for_name(token_name) - page.find('tr', text: token_name, match: :first, wait: 1.0) + page.find("tr", text: token_name, match: :first, wait: 1.0) end def revoke_first_token_with_name(token_name) diff --git a/qa/qa/page/profile/ssh_keys.rb b/qa/qa/page/profile/ssh_keys.rb index ce1813b14d0..02234a073ec 100644 --- a/qa/qa/page/profile/ssh_keys.rb +++ b/qa/qa/page/profile/ssh_keys.rb @@ -4,13 +4,13 @@ module QA module Page module Profile class SSHKeys < Page::Base - view 'app/views/profiles/keys/_form.html.haml' do + view "app/views/profiles/keys/_form.html.haml" do element :key_title_field element :key_public_key_field element :add_key_button end - view 'app/views/profiles/keys/_key_details.html.haml' do + view "app/views/profiles/keys/_key_details.html.haml" do element :delete_key_button end diff --git a/qa/qa/page/project/activity.rb b/qa/qa/page/project/activity.rb index 56fbaa90790..e1c9a5b673d 100644 --- a/qa/qa/page/project/activity.rb +++ b/qa/qa/page/project/activity.rb @@ -2,12 +2,12 @@ module QA module Page module Project class Activity < Page::Base - view 'app/views/shared/_event_filter.html.haml' do + view "app/views/shared/_event_filter.html.haml" do element :push_events, "event_filter_link EventFilter::PUSH, _('Push events')" # rubocop:disable QA/ElementWithPattern end def go_to_push_events - click_on 'Push events' + click_on "Push events" end end end diff --git a/qa/qa/page/project/branches/show.rb b/qa/qa/page/project/branches/show.rb index 922a6ddb086..333da0f3879 100644 --- a/qa/qa/page/project/branches/show.rb +++ b/qa/qa/page/project/branches/show.rb @@ -5,13 +5,13 @@ module QA module Project module Branches class Show < Page::Base - view 'app/views/projects/branches/_branch.html.haml' do + view "app/views/projects/branches/_branch.html.haml" do element :remove_btn end - view 'app/views/projects/branches/_panel.html.haml' do + view "app/views/projects/branches/_panel.html.haml" do element :all_branches end - view 'app/views/projects/branches/index.html.haml' do + view "app/views/projects/branches/index.html.haml" do element :delete_merged_branches end @@ -50,11 +50,11 @@ module QA end def wait_for_texts_not_to_be_visible(texts) - text_not_visible = wait do + text_not_visible = wait { texts.all? do |text| has_no_text?(text) end - end + } raise "Expected text(s) #{texts} not to be visible" unless text_not_visible end end diff --git a/qa/qa/page/project/commit/show.rb b/qa/qa/page/project/commit/show.rb index 9770b8a657c..2224c8b252e 100644 --- a/qa/qa/page/project/commit/show.rb +++ b/qa/qa/page/project/commit/show.rb @@ -5,7 +5,7 @@ module QA module Project module Commit class Show < Page::Base - view 'app/views/projects/commit/_commit_box.html.haml' do + view "app/views/projects/commit/_commit_box.html.haml" do element :options_button element :email_patches element :plain_diff diff --git a/qa/qa/page/project/fork/new.rb b/qa/qa/page/project/fork/new.rb index 140c004b458..5186cf6a270 100644 --- a/qa/qa/page/project/fork/new.rb +++ b/qa/qa/page/project/fork/new.rb @@ -3,8 +3,8 @@ module QA module Project module Fork class New < Page::Base - view 'app/views/projects/forks/_fork_button.html.haml' do - element :namespace, 'link_to project_forks_path' # rubocop:disable QA/ElementWithPattern + view "app/views/projects/forks/_fork_button.html.haml" do + element :namespace, "link_to project_forks_path" # rubocop:disable QA/ElementWithPattern end def choose_namespace(namespace = Runtime::Namespace.path) diff --git a/qa/qa/page/project/import/github.rb b/qa/qa/page/project/import/github.rb index 45c8d834a74..eedabfb0192 100644 --- a/qa/qa/page/project/import/github.rb +++ b/qa/qa/page/project/import/github.rb @@ -5,12 +5,12 @@ module QA class Github < Page::Base include Page::Component::Select2 - view 'app/views/import/github/new.html.haml' do - element :personal_access_token_field, 'text_field_tag :personal_access_token' # rubocop:disable QA/ElementWithPattern + view "app/views/import/github/new.html.haml" do + element :personal_access_token_field, "text_field_tag :personal_access_token" # rubocop:disable QA/ElementWithPattern element :list_repos_button, "submit_tag _('List your GitHub repositories')" # rubocop:disable QA/ElementWithPattern end - view 'app/assets/javascripts/import_projects/components/provider_repo_table_row.vue' do + view "app/assets/javascripts/import_projects/components/provider_repo_table_row.vue" do element :project_import_row element :project_namespace_select element :project_path_field @@ -18,11 +18,11 @@ module QA end def add_personal_access_token(personal_access_token) - fill_in 'personal_access_token', with: personal_access_token + fill_in "personal_access_token", with: personal_access_token end def list_repos - click_button 'List your GitHub repositories' + click_button "List your GitHub repositories" end def import!(full_path, name) @@ -68,7 +68,7 @@ module QA def wait_for_success wait(max: 60, interval: 1.0, reload: false) do - page.has_content?('Done', wait: 1.0) + page.has_content?("Done", wait: 1.0) end end end diff --git a/qa/qa/page/project/issue/index.rb b/qa/qa/page/project/issue/index.rb index 1035bf74a43..d7f915349e0 100644 --- a/qa/qa/page/project/issue/index.rb +++ b/qa/qa/page/project/issue/index.rb @@ -3,8 +3,8 @@ module QA module Project module Issue class Index < Page::Base - view 'app/views/projects/issues/_issue.html.haml' do - element :issue_link, 'link_to issue.title' # rubocop:disable QA/ElementWithPattern + view "app/views/projects/issues/_issue.html.haml" do + element :issue_link, "link_to issue.title" # rubocop:disable QA/ElementWithPattern end def go_to_issue(title) diff --git a/qa/qa/page/project/issue/new.rb b/qa/qa/page/project/issue/new.rb index 03b605ab24b..d88893dc7fe 100644 --- a/qa/qa/page/project/issue/new.rb +++ b/qa/qa/page/project/issue/new.rb @@ -3,28 +3,28 @@ module QA module Project module Issue class New < Page::Base - view 'app/views/shared/issuable/_form.html.haml' do + view "app/views/shared/issuable/_form.html.haml" do element :submit_issue_button, 'form.submit "Submit' # rubocop:disable QA/ElementWithPattern end - view 'app/views/shared/issuable/form/_title.html.haml' do - element :issue_title_textbox, 'form.text_field :title' # rubocop:disable QA/ElementWithPattern + view "app/views/shared/issuable/form/_title.html.haml" do + element :issue_title_textbox, "form.text_field :title" # rubocop:disable QA/ElementWithPattern end - view 'app/views/shared/form_elements/_description.html.haml' do + view "app/views/shared/form_elements/_description.html.haml" do element :issue_description_textarea, "render 'projects/zen', f: form, attr: :description" # rubocop:disable QA/ElementWithPattern end def add_title(title) - fill_in 'issue_title', with: title + fill_in "issue_title", with: title end def add_description(description) - fill_in 'issue_description', with: description + fill_in "issue_description", with: description end def create_new_issue - click_on 'Submit issue' + click_on "Submit issue" end end end diff --git a/qa/qa/page/project/issue/show.rb b/qa/qa/page/project/issue/show.rb index 9df3db1bba0..6edd2f57c81 100644 --- a/qa/qa/page/project/issue/show.rb +++ b/qa/qa/page/project/issue/show.rb @@ -8,22 +8,22 @@ module QA include Page::Component::Issuable::Common include Page::Component::Note - view 'app/views/shared/notes/_form.html.haml' do - element :new_note_form, 'new-note' # rubocop:disable QA/ElementWithPattern - element :new_note_form, 'attr: :note' # rubocop:disable QA/ElementWithPattern + view "app/views/shared/notes/_form.html.haml" do + element :new_note_form, "new-note" # rubocop:disable QA/ElementWithPattern + element :new_note_form, "attr: :note" # rubocop:disable QA/ElementWithPattern end - view 'app/assets/javascripts/notes/components/comment_form.vue' do + view "app/assets/javascripts/notes/components/comment_form.vue" do element :comment_button element :comment_input end - view 'app/assets/javascripts/notes/components/discussion_filter.vue' do + view "app/assets/javascripts/notes/components/discussion_filter.vue" do element :discussion_filter element :filter_options end - view 'app/assets/javascripts/notes/components/noteable_note.vue' do + view "app/assets/javascripts/notes/components/noteable_note.vue" do element :noteable_note_item end @@ -33,7 +33,7 @@ module QA fill_element :comment_input, text unless attachment.nil? - QA::Page::Component::Dropzone.new(self, '.new-note') + QA::Page::Component::Dropzone.new(self, ".new-note") .attach_file(attachment) end @@ -47,15 +47,15 @@ module QA end def select_comments_only_filter - select_filter_with_text('Show comments only') + select_filter_with_text("Show comments only") end def select_history_only_filter - select_filter_with_text('Show history only') + select_filter_with_text("Show history only") end def select_all_activities_filter - select_filter_with_text('Show all activity') + select_filter_with_text("Show all activity") end private diff --git a/qa/qa/page/project/job/show.rb b/qa/qa/page/project/job/show.rb index 9c218f4ed8b..29decc028e4 100644 --- a/qa/qa/page/project/job/show.rb +++ b/qa/qa/page/project/job/show.rb @@ -2,17 +2,17 @@ module QA::Page module Project::Job class Show < QA::Page::Base COMPLETED_STATUSES = %w[passed failed canceled blocked skipped manual].freeze # excludes created, pending, running - PASSED_STATUS = 'passed'.freeze + PASSED_STATUS = "passed".freeze - view 'app/assets/javascripts/jobs/components/job_log.vue' do + view "app/assets/javascripts/jobs/components/job_log.vue" do element :build_trace end - view 'app/assets/javascripts/vue_shared/components/ci_badge_link.vue' do + view "app/assets/javascripts/vue_shared/components/ci_badge_link.vue" do element :status_badge end - view 'app/assets/javascripts/jobs/components/stages_dropdown.vue' do + view "app/assets/javascripts/jobs/components/stages_dropdown.vue" do element :pipeline_path end diff --git a/qa/qa/page/project/menu.rb b/qa/qa/page/project/menu.rb index 46dfe87fe25..41da83d66b5 100644 --- a/qa/qa/page/project/menu.rb +++ b/qa/qa/page/project/menu.rb @@ -12,7 +12,7 @@ module QA include SubMenus::Repository include SubMenus::Settings - view 'app/views/layouts/nav/sidebar/_project.html.haml' do + view "app/views/layouts/nav/sidebar/_project.html.haml" do element :activity_link element :merge_requests_link element :wiki_link diff --git a/qa/qa/page/project/milestone/index.rb b/qa/qa/page/project/milestone/index.rb index a1519c9ef1c..332696796b4 100644 --- a/qa/qa/page/project/milestone/index.rb +++ b/qa/qa/page/project/milestone/index.rb @@ -3,7 +3,7 @@ module QA module Project module Milestone class Index < Page::Base - view 'app/views/projects/milestones/index.html.haml' do + view "app/views/projects/milestones/index.html.haml" do element :new_project_milestone end diff --git a/qa/qa/page/project/milestone/new.rb b/qa/qa/page/project/milestone/new.rb index 992ef89004b..a0b9c7b8b11 100644 --- a/qa/qa/page/project/milestone/new.rb +++ b/qa/qa/page/project/milestone/new.rb @@ -3,7 +3,7 @@ module QA module Project module Milestone class New < Page::Base - view 'app/views/projects/milestones/_form.html.haml' do + view "app/views/projects/milestones/_form.html.haml" do element :milestone_create_button element :milestone_title element :milestone_description diff --git a/qa/qa/page/project/new.rb b/qa/qa/page/project/new.rb index 9f1867ef8a5..ebda3b2b044 100644 --- a/qa/qa/page/project/new.rb +++ b/qa/qa/page/project/new.rb @@ -4,22 +4,22 @@ module QA class New < Page::Base include Page::Component::Select2 - view 'app/views/projects/new.html.haml' do + view "app/views/projects/new.html.haml" do element :project_create_from_template_tab element :import_project_tab, "Import project" # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/_new_project_fields.html.haml' do + view "app/views/projects/_new_project_fields.html.haml" do element :project_namespace_select - element :project_namespace_field, 'namespaces_options' # rubocop:disable QA/ElementWithPattern - element :project_name, 'text_field :name' # rubocop:disable QA/ElementWithPattern - element :project_path, 'text_field :path' # rubocop:disable QA/ElementWithPattern - element :project_description, 'text_area :description' # rubocop:disable QA/ElementWithPattern + element :project_namespace_field, "namespaces_options" # rubocop:disable QA/ElementWithPattern + element :project_name, "text_field :name" # rubocop:disable QA/ElementWithPattern + element :project_path, "text_field :path" # rubocop:disable QA/ElementWithPattern + element :project_description, "text_area :description" # rubocop:disable QA/ElementWithPattern element :project_create_button, "submit 'Create project'" # rubocop:disable QA/ElementWithPattern - element :visibility_radios, 'visibility_level:' # rubocop:disable QA/ElementWithPattern + element :visibility_radios, "visibility_level:" # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/_import_project_pane.html.haml' do + view "app/views/projects/_import_project_pane.html.haml" do element :import_github, "icon('github', text: 'GitHub')" # rubocop:disable QA/ElementWithPattern end @@ -30,19 +30,19 @@ module QA end def go_to_import_project - click_on 'Import project' + click_on "Import project" end def choose_name(name) - fill_in 'project_name', with: name + fill_in "project_name", with: name end def add_description(description) - fill_in 'project_description', with: description + fill_in "project_description", with: description end def create_new_project - click_on 'Create project' + click_on "Create project" end def go_to_create_from_template @@ -54,7 +54,7 @@ module QA end def go_to_github_import - click_link 'GitHub' + click_link "GitHub" end end end diff --git a/qa/qa/page/project/operations/environments/index.rb b/qa/qa/page/project/operations/environments/index.rb index 63965a57edd..401d3566779 100644 --- a/qa/qa/page/project/operations/environments/index.rb +++ b/qa/qa/page/project/operations/environments/index.rb @@ -6,7 +6,7 @@ module QA module Operations module Environments class Index < Page::Base - view 'app/assets/javascripts/environments/components/environment_item.vue' do + view "app/assets/javascripts/environments/components/environment_item.vue" do element :environment_link end diff --git a/qa/qa/page/project/operations/environments/show.rb b/qa/qa/page/project/operations/environments/show.rb index aa88c218c89..a5142b3e042 100644 --- a/qa/qa/page/project/operations/environments/show.rb +++ b/qa/qa/page/project/operations/environments/show.rb @@ -6,7 +6,7 @@ module QA module Operations module Environments class Show < Page::Base - view 'app/views/projects/environments/_external_url.html.haml' do + view "app/views/projects/environments/_external_url.html.haml" do element :view_deployment end diff --git a/qa/qa/page/project/operations/kubernetes/add.rb b/qa/qa/page/project/operations/kubernetes/add.rb index 939f912ea85..46df5d2e833 100644 --- a/qa/qa/page/project/operations/kubernetes/add.rb +++ b/qa/qa/page/project/operations/kubernetes/add.rb @@ -4,12 +4,12 @@ module QA module Operations module Kubernetes class Add < Page::Base - view 'app/views/clusters/clusters/new.html.haml' do + view "app/views/clusters/clusters/new.html.haml" do element :add_existing_cluster_button, "Add existing cluster" # rubocop:disable QA/ElementWithPattern end def add_existing_cluster - click_on 'Add existing cluster' + click_on "Add existing cluster" end end end diff --git a/qa/qa/page/project/operations/kubernetes/add_existing.rb b/qa/qa/page/project/operations/kubernetes/add_existing.rb index ffd5b36e1ae..cfe9538b1f7 100644 --- a/qa/qa/page/project/operations/kubernetes/add_existing.rb +++ b/qa/qa/page/project/operations/kubernetes/add_existing.rb @@ -4,33 +4,33 @@ module QA module Operations module Kubernetes class AddExisting < Page::Base - view 'app/views/clusters/clusters/user/_form.html.haml' do - element :cluster_name, 'text_field :name' # rubocop:disable QA/ElementWithPattern - element :api_url, 'text_field :api_url' # rubocop:disable QA/ElementWithPattern - element :ca_certificate, 'text_area :ca_cert' # rubocop:disable QA/ElementWithPattern - element :token, 'text_field :token' # rubocop:disable QA/ElementWithPattern + view "app/views/clusters/clusters/user/_form.html.haml" do + element :cluster_name, "text_field :name" # rubocop:disable QA/ElementWithPattern + element :api_url, "text_field :api_url" # rubocop:disable QA/ElementWithPattern + element :ca_certificate, "text_area :ca_cert" # rubocop:disable QA/ElementWithPattern + element :token, "text_field :token" # rubocop:disable QA/ElementWithPattern element :add_cluster_button, "submit s_('ClusterIntegration|Add Kubernetes cluster')" # rubocop:disable QA/ElementWithPattern element :rbac_checkbox end def set_cluster_name(name) - fill_in 'cluster_name', with: name + fill_in "cluster_name", with: name end def set_api_url(api_url) - fill_in 'cluster_platform_kubernetes_attributes_api_url', with: api_url + fill_in "cluster_platform_kubernetes_attributes_api_url", with: api_url end def set_ca_certificate(ca_certificate) - fill_in 'cluster_platform_kubernetes_attributes_ca_cert', with: ca_certificate + fill_in "cluster_platform_kubernetes_attributes_ca_cert", with: ca_certificate end def set_token(token) - fill_in 'cluster_platform_kubernetes_attributes_token', with: token + fill_in "cluster_platform_kubernetes_attributes_token", with: token end def add_cluster! - click_on 'Add Kubernetes cluster' + click_on "Add Kubernetes cluster" end def uncheck_rbac! diff --git a/qa/qa/page/project/operations/kubernetes/index.rb b/qa/qa/page/project/operations/kubernetes/index.rb index 67a74af1cd2..be64d96ef92 100644 --- a/qa/qa/page/project/operations/kubernetes/index.rb +++ b/qa/qa/page/project/operations/kubernetes/index.rb @@ -4,12 +4,12 @@ module QA module Operations module Kubernetes class Index < Page::Base - view 'app/views/clusters/clusters/_empty_state.html.haml' do + view "app/views/clusters/clusters/_empty_state.html.haml" do element :add_kubernetes_cluster_button, "link_to s_('ClusterIntegration|Add Kubernetes cluster')" # rubocop:disable QA/ElementWithPattern end def add_kubernetes_cluster - click_on 'Add Kubernetes cluster' + click_on "Add Kubernetes cluster" end end end diff --git a/qa/qa/page/project/operations/kubernetes/show.rb b/qa/qa/page/project/operations/kubernetes/show.rb index d4e1679b6bf..37129fd61b0 100644 --- a/qa/qa/page/project/operations/kubernetes/show.rb +++ b/qa/qa/page/project/operations/kubernetes/show.rb @@ -4,38 +4,38 @@ module QA module Operations module Kubernetes class Show < Page::Base - view 'app/assets/javascripts/clusters/components/application_row.vue' do - element :application_row, 'js-cluster-application-row-${this.id}' # rubocop:disable QA/ElementWithPattern + view "app/assets/javascripts/clusters/components/application_row.vue" do + element :application_row, "js-cluster-application-row-${this.id}" # rubocop:disable QA/ElementWithPattern element :install_button, "s__('ClusterIntegration|Install')" # rubocop:disable QA/ElementWithPattern element :installed_button, "s__('ClusterIntegration|Installed')" # rubocop:disable QA/ElementWithPattern end - view 'app/assets/javascripts/clusters/components/applications.vue' do + view "app/assets/javascripts/clusters/components/applications.vue" do element :ingress_ip_address, 'id="ingress-ip-address"' # rubocop:disable QA/ElementWithPattern end - view 'app/views/clusters/clusters/_form.html.haml' do + view "app/views/clusters/clusters/_form.html.haml" do element :base_domain element :save_domain end def install!(application_name) within(".js-cluster-application-row-#{application_name}") do - page.has_button?('Install', wait: 30) - click_on 'Install' + page.has_button?("Install", wait: 30) + click_on "Install" end end def await_installed(application_name) within(".js-cluster-application-row-#{application_name}") do - page.has_text?('Installed', wait: 300) + page.has_text?("Installed", wait: 300) end end def ingress_ip # We need to wait longer since it can take some time before the # ip address is assigned for the ingress controller - page.find('#ingress-ip-address', wait: 1200).value + page.find("#ingress-ip-address", wait: 1200).value end def set_domain(domain) diff --git a/qa/qa/page/project/pipeline/index.rb b/qa/qa/page/project/pipeline/index.rb index 19d83ecc4f4..4dbdebc80fc 100644 --- a/qa/qa/page/project/pipeline/index.rb +++ b/qa/qa/page/project/pipeline/index.rb @@ -1,16 +1,16 @@ module QA::Page module Project::Pipeline class Index < QA::Page::Base - view 'app/assets/javascripts/pipelines/components/pipeline_url.vue' do + view "app/assets/javascripts/pipelines/components/pipeline_url.vue" do element :pipeline_link, 'class="js-pipeline-url-link"' # rubocop:disable QA/ElementWithPattern end def go_to_latest_pipeline - css = '.js-pipeline-url-link' + css = ".js-pipeline-url-link" - link = wait(reload: false) do + link = wait(reload: false) { first(css) - end + } link.click end diff --git a/qa/qa/page/project/pipeline/show.rb b/qa/qa/page/project/pipeline/show.rb index 6f8a66bf527..295d48258ce 100644 --- a/qa/qa/page/project/pipeline/show.rb +++ b/qa/qa/page/project/pipeline/show.rb @@ -1,44 +1,44 @@ module QA::Page module Project::Pipeline class Show < QA::Page::Base - view 'app/assets/javascripts/vue_shared/components/header_ci_component.vue' do + view "app/assets/javascripts/vue_shared/components/header_ci_component.vue" do element :pipeline_header, /header class.*ci-header-container.*/ # rubocop:disable QA/ElementWithPattern end - view 'app/assets/javascripts/pipelines/components/graph/graph_component.vue' do + view "app/assets/javascripts/pipelines/components/graph/graph_component.vue" do element :pipeline_graph, /class.*pipeline-graph.*/ # rubocop:disable QA/ElementWithPattern end - view 'app/assets/javascripts/pipelines/components/graph/job_item.vue' do + view "app/assets/javascripts/pipelines/components/graph/job_item.vue" do element :job_component, /class.*ci-job-component.*/ # rubocop:disable QA/ElementWithPattern element :job_link end - view 'app/assets/javascripts/vue_shared/components/ci_icon.vue' do - element :status_icon, 'ci-status-icon-${status}' # rubocop:disable QA/ElementWithPattern + view "app/assets/javascripts/vue_shared/components/ci_icon.vue" do + element :status_icon, "ci-status-icon-${status}" # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/pipelines/_info.html.haml' do + view "app/views/projects/pipelines/_info.html.haml" do element :pipeline_badges end def running? - within('.ci-header-container') do - page.has_content?('running') + within(".ci-header-container") do + page.has_content?("running") end end def has_build?(name, status: :success, wait: nil) - within('.pipeline-graph') do - within('.ci-job-component', text: name) do - has_selector?(".ci-status-icon-#{status}", { wait: wait }.compact) + within(".pipeline-graph") do + within(".ci-job-component", text: name) do + has_selector?(".ci-status-icon-#{status}", {wait: wait}.compact) end end end def has_tag?(tag_name) within_element(:pipeline_badges) do - has_selector?('.badge', text: tag_name) + has_selector?(".badge", text: tag_name) end end @@ -47,7 +47,7 @@ module QA::Page end def go_to_first_job - css = '.js-pipeline-graph-job-link' + css = ".js-pipeline-graph-job-link" wait(reload: false) do has_css?(css) diff --git a/qa/qa/page/project/settings/advanced.rb b/qa/qa/page/project/settings/advanced.rb index 578f097e2dc..9e9cde6aa23 100644 --- a/qa/qa/page/project/settings/advanced.rb +++ b/qa/qa/page/project/settings/advanced.rb @@ -3,9 +3,9 @@ module QA module Project module Settings class Advanced < Page::Base - view 'app/views/projects/edit.html.haml' do - element :project_path_field, 'text_field :path' # rubocop:disable QA/ElementWithPattern - element :project_name_field, 'text_field :name' # rubocop:disable QA/ElementWithPattern + view "app/views/projects/edit.html.haml" do + element :project_path_field, "text_field :path" # rubocop:disable QA/ElementWithPattern + element :project_name_field, "text_field :name" # rubocop:disable QA/ElementWithPattern element :rename_project_button, "submit 'Rename project'" # rubocop:disable QA/ElementWithPattern end @@ -24,7 +24,7 @@ module QA end def rename_project! - click_on 'Rename project' + click_on "Rename project" end end end diff --git a/qa/qa/page/project/settings/ci_cd.rb b/qa/qa/page/project/settings/ci_cd.rb index 2de39b8ebf5..c8f8234ab63 100644 --- a/qa/qa/page/project/settings/ci_cd.rb +++ b/qa/qa/page/project/settings/ci_cd.rb @@ -5,14 +5,14 @@ module QA # rubocop:disable Naming/FileName class CICD < Page::Base include Common - view 'app/views/projects/settings/ci_cd/show.html.haml' do + view "app/views/projects/settings/ci_cd/show.html.haml" do element :autodevops_settings element :runners_settings element :variables_settings end - view 'app/views/projects/settings/ci_cd/_autodevops_form.html.haml' do - element :enable_auto_devops_field, 'check_box :enabled' # rubocop:disable QA/ElementWithPattern + view "app/views/projects/settings/ci_cd/_autodevops_form.html.haml" do + element :enable_auto_devops_field, "check_box :enabled" # rubocop:disable QA/ElementWithPattern element :enable_auto_devops_button, "%strong= s_('CICD|Default to Auto DevOps pipeline')" # rubocop:disable QA/ElementWithPattern element :save_changes_button, "submit _('Save changes')" # rubocop:disable QA/ElementWithPattern end @@ -31,8 +31,8 @@ module QA # rubocop:disable Naming/FileName def enable_auto_devops expand_section(:autodevops_settings) do - check 'Default to Auto DevOps pipeline' - click_on 'Save changes' + check "Default to Auto DevOps pipeline" + click_on "Save changes" end end end diff --git a/qa/qa/page/project/settings/ci_variables.rb b/qa/qa/page/project/settings/ci_variables.rb index e7a6e4bf628..f9dda69da46 100644 --- a/qa/qa/page/project/settings/ci_variables.rb +++ b/qa/qa/page/project/settings/ci_variables.rb @@ -5,15 +5,15 @@ module QA class CiVariables < Page::Base include Common - view 'app/views/ci/variables/_variable_row.html.haml' do - element :variable_row, '.ci-variable-row-body' # rubocop:disable QA/ElementWithPattern - element :variable_key, '.qa-ci-variable-input-key' # rubocop:disable QA/ElementWithPattern - element :variable_value, '.qa-ci-variable-input-value' # rubocop:disable QA/ElementWithPattern + view "app/views/ci/variables/_variable_row.html.haml" do + element :variable_row, ".ci-variable-row-body" # rubocop:disable QA/ElementWithPattern + element :variable_key, ".qa-ci-variable-input-key" # rubocop:disable QA/ElementWithPattern + element :variable_value, ".qa-ci-variable-input-value" # rubocop:disable QA/ElementWithPattern end - view 'app/views/ci/variables/_index.html.haml' do - element :save_variables, '.js-ci-variables-save-button' # rubocop:disable QA/ElementWithPattern - element :reveal_values, '.js-secret-value-reveal-button' # rubocop:disable QA/ElementWithPattern + view "app/views/ci/variables/_index.html.haml" do + element :save_variables, ".js-ci-variables-save-button" # rubocop:disable QA/ElementWithPattern + element :reveal_values, ".js-secret-value-reveal-button" # rubocop:disable QA/ElementWithPattern end def fill_variable(key, value) @@ -33,16 +33,16 @@ module QA end def save_variables - find('.js-ci-variables-save-button').click + find(".js-ci-variables-save-button").click end def reveal_variables - find('.js-secret-value-reveal-button').click + find(".js-secret-value-reveal-button").click end def variable_value(key) - within('.ci-variable-row-body', text: key) do - find('.qa-ci-variable-input-value').value + within(".ci-variable-row-body", text: key) do + find(".qa-ci-variable-input-value").value end end end diff --git a/qa/qa/page/project/settings/common.rb b/qa/qa/page/project/settings/common.rb index f3b217677f2..8349ad4e29c 100644 --- a/qa/qa/page/project/settings/common.rb +++ b/qa/qa/page/project/settings/common.rb @@ -7,7 +7,7 @@ module QA def self.included(base) base.class_eval do - view 'app/views/projects/edit.html.haml' do + view "app/views/projects/edit.html.haml" do element :advanced_settings_expand, "= expanded ? 'Collapse' : 'Expand'" # rubocop:disable QA/ElementWithPattern end end diff --git a/qa/qa/page/project/settings/deploy_keys.rb b/qa/qa/page/project/settings/deploy_keys.rb index e0f9e84096d..b286b16f1b1 100644 --- a/qa/qa/page/project/settings/deploy_keys.rb +++ b/qa/qa/page/project/settings/deploy_keys.rb @@ -3,32 +3,32 @@ module QA module Project module Settings class DeployKeys < Page::Base - view 'app/views/projects/deploy_keys/_form.html.haml' do - element :deploy_key_title, 'text_field :title' # rubocop:disable QA/ElementWithPattern - element :deploy_key_key, 'text_area :key' # rubocop:disable QA/ElementWithPattern + view "app/views/projects/deploy_keys/_form.html.haml" do + element :deploy_key_title, "text_field :title" # rubocop:disable QA/ElementWithPattern + element :deploy_key_key, "text_area :key" # rubocop:disable QA/ElementWithPattern end - view 'app/assets/javascripts/deploy_keys/components/app.vue' do + view "app/assets/javascripts/deploy_keys/components/app.vue" do element :deploy_keys_section, /class=".*deploy\-keys.*"/ # rubocop:disable QA/ElementWithPattern element :project_deploy_keys, 'class="qa-project-deploy-keys"' # rubocop:disable QA/ElementWithPattern end - view 'app/assets/javascripts/deploy_keys/components/key.vue' do + view "app/assets/javascripts/deploy_keys/components/key.vue" do element :key element :key_title element :key_fingerprint end def add_key - click_on 'Add key' + click_on "Add key" end def fill_key_title(title) - fill_in 'deploy_key_title', with: title + fill_in "deploy_key_title", with: title end def fill_key_value(key) - fill_in 'deploy_key_key', with: key + fill_in "deploy_key_key", with: key end def find_fingerprint(title) diff --git a/qa/qa/page/project/settings/deploy_tokens.rb b/qa/qa/page/project/settings/deploy_tokens.rb index 2d42372cbc5..f3934197aad 100644 --- a/qa/qa/page/project/settings/deploy_tokens.rb +++ b/qa/qa/page/project/settings/deploy_tokens.rb @@ -3,7 +3,7 @@ module QA module Project module Settings class DeployTokens < Page::Base - view 'app/views/projects/deploy_tokens/_form.html.haml' do + view "app/views/projects/deploy_tokens/_form.html.haml" do element :deploy_token_name element :deploy_token_expires_at element :deploy_token_read_repository @@ -11,7 +11,7 @@ module QA element :create_deploy_token end - view 'app/views/projects/deploy_tokens/_new_deploy_token.html.haml' do + view "app/views/projects/deploy_tokens/_new_deploy_token.html.haml" do element :created_deploy_token_section element :deploy_token_user element :deploy_token diff --git a/qa/qa/page/project/settings/main.rb b/qa/qa/page/project/settings/main.rb index d8cf1d49dd2..61cfd39f0be 100644 --- a/qa/qa/page/project/settings/main.rb +++ b/qa/qa/page/project/settings/main.rb @@ -5,7 +5,7 @@ module QA class Main < Page::Base include Common - view 'app/views/projects/edit.html.haml' do + view "app/views/projects/edit.html.haml" do element :advanced_settings end diff --git a/qa/qa/page/project/settings/members.rb b/qa/qa/page/project/settings/members.rb index 7fed93ca83f..28ed205a87a 100644 --- a/qa/qa/page/project/settings/members.rb +++ b/qa/qa/page/project/settings/members.rb @@ -7,12 +7,12 @@ module QA class Members < Page::Base include Page::Component::UsersSelect - view 'app/views/projects/project_members/_new_project_member.html.haml' do + view "app/views/projects/project_members/_new_project_member.html.haml" do element :member_select_input element :add_member_button end - view 'app/views/projects/project_members/_team.html.haml' do + view "app/views/projects/project_members/_team.html.haml" do element :members_list end diff --git a/qa/qa/page/project/settings/merge_request.rb b/qa/qa/page/project/settings/merge_request.rb index d044d3715a9..9ac8b8b797d 100644 --- a/qa/qa/page/project/settings/merge_request.rb +++ b/qa/qa/page/project/settings/merge_request.rb @@ -5,12 +5,12 @@ module QA class MergeRequest < QA::Page::Base include Common - view 'app/views/projects/edit.html.haml' do + view "app/views/projects/edit.html.haml" do element :merge_request_settings element :save_merge_request_changes end - view 'app/views/projects/_merge_request_merge_method_settings.html.haml' do + view "app/views/projects/_merge_request_merge_method_settings.html.haml" do element :radio_button_merge_ff end diff --git a/qa/qa/page/project/settings/mirroring_repositories.rb b/qa/qa/page/project/settings/mirroring_repositories.rb index 831166f6373..3c811a172b6 100644 --- a/qa/qa/page/project/settings/mirroring_repositories.rb +++ b/qa/qa/page/project/settings/mirroring_repositories.rb @@ -5,12 +5,12 @@ module QA module Project module Settings class MirroringRepositories < Page::Base - view 'app/views/projects/mirrors/_authentication_method.html.haml' do + view "app/views/projects/mirrors/_authentication_method.html.haml" do element :authentication_method element :password end - view 'app/views/projects/mirrors/_mirror_repos.html.haml' do + view "app/views/projects/mirrors/_mirror_repos.html.haml" do element :mirror_repository_url_input element :mirror_repository_button element :mirror_repository_url @@ -18,11 +18,11 @@ module QA element :mirrored_repository_row end - view 'app/views/projects/mirrors/_mirror_repos_form.html.haml' do + view "app/views/projects/mirrors/_mirror_repos_form.html.haml" do element :mirror_direction end - view 'app/views/shared/_remote_mirror_update_button.html.haml' do + view "app/views/shared/_remote_mirror_update_button.html.haml" do element :update_now_button end @@ -65,13 +65,13 @@ module QA wait(interval: 1) do within_element_by_index(:mirrored_repository_row, row_index) do last_update = find_element(:mirror_last_update_at, wait: 0) - last_update.has_text?('just now') || last_update.has_text?('seconds') + last_update.has_text?("just now") || last_update.has_text?("seconds") end end # Fail early if the page still shows that there has been no update within_element_by_index(:mirrored_repository_row, row_index) do - find_element(:mirror_last_update_at, wait: 0).assert_no_text('Never') + find_element(:mirror_last_update_at, wait: 0).assert_no_text("Never") end end diff --git a/qa/qa/page/project/settings/protected_branches.rb b/qa/qa/page/project/settings/protected_branches.rb index 76591a4e3fe..6f84e56a197 100644 --- a/qa/qa/page/project/settings/protected_branches.rb +++ b/qa/qa/page/project/settings/protected_branches.rb @@ -3,23 +3,23 @@ module QA module Project module Settings class ProtectedBranches < Page::Base - view 'app/views/projects/protected_branches/shared/_dropdown.html.haml' do + view "app/views/projects/protected_branches/shared/_dropdown.html.haml" do element :protected_branch_select element :protected_branch_dropdown end - view 'app/views/projects/protected_branches/_create_protected_branch.html.haml' do + view "app/views/projects/protected_branches/_create_protected_branch.html.haml" do element :allowed_to_push_select element :allowed_to_push_dropdown element :allowed_to_merge_select element :allowed_to_merge_dropdown end - view 'app/views/projects/protected_branches/_update_protected_branch.html.haml' do + view "app/views/projects/protected_branches/_update_protected_branch.html.haml" do element :allowed_to_merge end - view 'app/views/projects/protected_branches/shared/_branches_list.html.haml' do + view "app/views/projects/protected_branches/shared/_branches_list.html.haml" do element :protected_branches_list end @@ -32,29 +32,29 @@ module QA end def allow_no_one_to_push - click_allow(:push, 'No one') + click_allow(:push, "No one") end def allow_devs_and_maintainers_to_push - click_allow(:push, 'Developers + Maintainers') + click_allow(:push, "Developers + Maintainers") end # @deprecated - alias_method :allow_devs_and_masters_to_push, :allow_devs_and_maintainers_to_push + alias allow_devs_and_masters_to_push allow_devs_and_maintainers_to_push def allow_no_one_to_merge - click_allow(:merge, 'No one') + click_allow(:merge, "No one") end def allow_devs_and_maintainers_to_merge - click_allow(:merge, 'Developers + Maintainers') + click_allow(:merge, "Developers + Maintainers") end # @deprecated - alias_method :allow_devs_and_masters_to_merge, :allow_devs_and_maintainers_to_merge + alias allow_devs_and_masters_to_merge allow_devs_and_maintainers_to_merge def protect_branch - click_on 'Protect' + click_on "Protect" end private diff --git a/qa/qa/page/project/settings/repository.rb b/qa/qa/page/project/settings/repository.rb index ac0b87aca5e..7598876ed78 100644 --- a/qa/qa/page/project/settings/repository.rb +++ b/qa/qa/page/project/settings/repository.rb @@ -5,15 +5,15 @@ module QA class Repository < Page::Base include Common - view 'app/views/projects/deploy_keys/_index.html.haml' do + view "app/views/projects/deploy_keys/_index.html.haml" do element :deploy_keys_settings end - view 'app/views/projects/protected_branches/shared/_index.html.haml' do + view "app/views/projects/protected_branches/shared/_index.html.haml" do element :protected_branches_settings end - view 'app/views/projects/mirrors/_mirror_repos.html.haml' do + view "app/views/projects/mirrors/_mirror_repos.html.haml" do element :mirroring_repositories_settings end diff --git a/qa/qa/page/project/settings/runners.rb b/qa/qa/page/project/settings/runners.rb index ac930f5385a..81ec1807798 100644 --- a/qa/qa/page/project/settings/runners.rb +++ b/qa/qa/page/project/settings/runners.rb @@ -3,30 +3,30 @@ module QA module Project module Settings class Runners < Page::Base - view 'app/views/ci/runner/_how_to_setup_runner.html.haml' do - element :registration_token, '%code#registration_token' # rubocop:disable QA/ElementWithPattern - element :coordinator_address, '%code#coordinator_address' # rubocop:disable QA/ElementWithPattern + view "app/views/ci/runner/_how_to_setup_runner.html.haml" do + element :registration_token, "%code#registration_token" # rubocop:disable QA/ElementWithPattern + element :coordinator_address, "%code#coordinator_address" # rubocop:disable QA/ElementWithPattern end ## # TODO, phase-out CSS classes added in Ruby helpers. # - view 'app/helpers/runners_helper.rb' do + view "app/helpers/runners_helper.rb" do # rubocop:disable Lint/InterpolationCheck element :runner_status, 'runner-status-#{status}' # rubocop:disable QA/ElementWithPattern # rubocop:enable Lint/InterpolationCheck end def registration_token - find('code#registration_token').text + find("code#registration_token").text end def coordinator_address - find('code#coordinator_address').text + find("code#coordinator_address").text end def has_online_runner? - page.has_css?('.runner-status-online') + page.has_css?(".runner-status-online") end end end diff --git a/qa/qa/page/project/show.rb b/qa/qa/page/project/show.rb index 9c21d9ddbfa..8f26cc5a50c 100644 --- a/qa/qa/page/project/show.rb +++ b/qa/qa/page/project/show.rb @@ -6,52 +6,52 @@ module QA class Show < Page::Base include Page::Component::ClonePanel - view 'app/views/layouts/header/_new_dropdown.haml' do + view "app/views/layouts/header/_new_dropdown.haml" do element :new_menu_toggle element :new_issue_link, "link_to _('New issue'), new_project_issue_path(@project)" # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/_last_push.html.haml' do + view "app/views/projects/_last_push.html.haml" do element :create_merge_request end - view 'app/views/projects/_home_panel.html.haml' do + view "app/views/projects/_home_panel.html.haml" do element :project_name end - view 'app/views/projects/_files.html.haml' do - element :tree_holder, '.tree-holder' # rubocop:disable QA/ElementWithPattern + view "app/views/projects/_files.html.haml" do + element :tree_holder, ".tree-holder" # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/buttons/_dropdown.html.haml' do + view "app/views/projects/buttons/_dropdown.html.haml" do element :create_new_dropdown end - view 'app/views/projects/buttons/_fork.html.haml' do + view "app/views/projects/buttons/_fork.html.haml" do element :fork_label, "%span= s_('ProjectOverview|Fork')" # rubocop:disable QA/ElementWithPattern element :fork_link, "link_to new_project_fork_path(@project)" # rubocop:disable QA/ElementWithPattern end - view 'app/views/projects/empty.html.haml' do + view "app/views/projects/empty.html.haml" do element :quick_actions end - view 'app/views/projects/tree/_tree_content.html.haml' do + view "app/views/projects/tree/_tree_content.html.haml" do element :file_tree end - view 'app/views/projects/tree/_tree_header.html.haml' do + view "app/views/projects/tree/_tree_header.html.haml" do element :add_to_tree element :new_file_option element :web_ide_button end - view 'app/views/shared/_ref_switcher.html.haml' do + view "app/views/shared/_ref_switcher.html.haml" do element :branches_select element :branches_dropdown end - view 'app/views/projects/blob/viewers/_loading.html.haml' do + view "app/views/projects/blob/viewers/_loading.html.haml" do element :spinner end @@ -63,7 +63,7 @@ module QA def create_first_new_file! within_element(:quick_actions) do - click_link_with_text 'New file' + click_link_with_text "New file" end end @@ -73,7 +73,7 @@ module QA end def fork_project - click_on 'Fork' + click_on "Fork" end def go_to_file(filename) @@ -90,7 +90,7 @@ module QA def go_to_new_issue click_element :new_menu_toggle - click_link 'New issue' + click_link "New issue" end def last_commit_content @@ -110,7 +110,7 @@ module QA end def project_name - find('.qa-project-name').text + find(".qa-project-name").text end def switch_to_branch(branch_name) @@ -123,7 +123,7 @@ module QA def wait_for_import wait(reload: true) do - has_css?('.tree-holder') + has_css?(".tree-holder") end end end diff --git a/qa/qa/page/project/sub_menus/ci_cd.rb b/qa/qa/page/project/sub_menus/ci_cd.rb index adae2ce08c4..3f80c46e15f 100644 --- a/qa/qa/page/project/sub_menus/ci_cd.rb +++ b/qa/qa/page/project/sub_menus/ci_cd.rb @@ -7,7 +7,7 @@ module QA module CiCd def self.included(base) base.class_eval do - view 'app/views/layouts/nav/sidebar/_project.html.haml' do + view "app/views/layouts/nav/sidebar/_project.html.haml" do element :link_pipelines end end diff --git a/qa/qa/page/project/sub_menus/common.rb b/qa/qa/page/project/sub_menus/common.rb index c94e1e85256..42f5a451411 100644 --- a/qa/qa/page/project/sub_menus/common.rb +++ b/qa/qa/page/project/sub_menus/common.rb @@ -6,13 +6,13 @@ module QA module SubMenus module Common def within_sidebar - within('.sidebar-top-level-items') do + within(".sidebar-top-level-items") do yield end end def within_submenu - within('.fly-out-list') do + within(".fly-out-list") do yield end end diff --git a/qa/qa/page/project/sub_menus/issues.rb b/qa/qa/page/project/sub_menus/issues.rb index f81e4f34909..d8d7c4ca785 100644 --- a/qa/qa/page/project/sub_menus/issues.rb +++ b/qa/qa/page/project/sub_menus/issues.rb @@ -7,7 +7,7 @@ module QA module Issues def self.included(base) base.class_eval do - view 'app/views/layouts/nav/sidebar/_project.html.haml' do + view "app/views/layouts/nav/sidebar/_project.html.haml" do element :issues_item element :labels_link element :milestones_link @@ -17,7 +17,7 @@ module QA def click_issues within_sidebar do - click_link('Issues') + click_link("Issues") end end diff --git a/qa/qa/page/project/sub_menus/operations.rb b/qa/qa/page/project/sub_menus/operations.rb index cf9fc453565..00c54b95d9e 100644 --- a/qa/qa/page/project/sub_menus/operations.rb +++ b/qa/qa/page/project/sub_menus/operations.rb @@ -7,7 +7,7 @@ module QA module Operations def self.included(base) base.class_eval do - view 'app/views/layouts/nav/sidebar/_project.html.haml' do + view "app/views/layouts/nav/sidebar/_project.html.haml" do element :link_operations element :operations_environments_link end @@ -25,7 +25,7 @@ module QA def click_operations_kubernetes hover_operations do within_submenu do - click_link('Kubernetes') + click_link("Kubernetes") end end end diff --git a/qa/qa/page/project/sub_menus/repository.rb b/qa/qa/page/project/sub_menus/repository.rb index 29eaa9a74de..d4b6e8b7a8b 100644 --- a/qa/qa/page/project/sub_menus/repository.rb +++ b/qa/qa/page/project/sub_menus/repository.rb @@ -7,7 +7,7 @@ module QA module Repository def self.included(base) base.class_eval do - view 'app/views/layouts/nav/sidebar/_project.html.haml' do + view "app/views/layouts/nav/sidebar/_project.html.haml" do element :project_menu_repo element :branches_link end diff --git a/qa/qa/page/project/sub_menus/settings.rb b/qa/qa/page/project/sub_menus/settings.rb index 62c594c0210..38a3626086f 100644 --- a/qa/qa/page/project/sub_menus/settings.rb +++ b/qa/qa/page/project/sub_menus/settings.rb @@ -7,7 +7,7 @@ module QA module Settings def self.included(base) base.class_eval do - view 'app/views/layouts/nav/sidebar/_project.html.haml' do + view "app/views/layouts/nav/sidebar/_project.html.haml" do element :settings_item element :link_members_settings end @@ -17,7 +17,7 @@ module QA def click_ci_cd_settings hover_settings do within_submenu do - click_link('CI / CD') + click_link("CI / CD") end end end @@ -33,14 +33,14 @@ module QA def click_repository_settings hover_settings do within_submenu do - click_link('Repository') + click_link("Repository") end end end def go_to_settings within_sidebar do - click_on 'Settings' + click_on "Settings" end end diff --git a/qa/qa/page/project/web_ide/edit.rb b/qa/qa/page/project/web_ide/edit.rb index 2b6c01888d5..076d7cff54e 100644 --- a/qa/qa/page/project/web_ide/edit.rb +++ b/qa/qa/page/project/web_ide/edit.rb @@ -7,29 +7,29 @@ module QA class Edit < Page::Base include Page::Component::DropdownFilter - view 'app/assets/javascripts/ide/components/ide_tree.vue' do + view "app/assets/javascripts/ide/components/ide_tree.vue" do element :new_file end - view 'app/assets/javascripts/ide/components/ide_tree_list.vue' do + view "app/assets/javascripts/ide/components/ide_tree_list.vue" do element :file_list end - view 'app/assets/javascripts/ide/components/new_dropdown/modal.vue' do + view "app/assets/javascripts/ide/components/new_dropdown/modal.vue" do element :full_file_path element :template_list end - view 'app/assets/javascripts/ide/components/file_templates/bar.vue' do + view "app/assets/javascripts/ide/components/file_templates/bar.vue" do element :file_templates_bar element :file_template_dropdown end - view 'app/assets/javascripts/ide/components/file_templates/dropdown.vue' do + view "app/assets/javascripts/ide/components/file_templates/dropdown.vue" do element :dropdown_filter_input end - view 'app/assets/javascripts/ide/components/commit_sidebar/form.vue' do + view "app/assets/javascripts/ide/components/commit_sidebar/form.vue" do element :begin_commit_button element :commit_button end @@ -43,11 +43,9 @@ module QA def create_new_file_from_template(file_name, template) click_element :new_file within_element(:template_list) do - begin - click_on file_name - rescue Capybara::ElementNotFound - raise ElementNotFound, %Q(Couldn't find file template named "#{file_name}". Please confirm that it is a valid option.) - end + click_on file_name + rescue Capybara::ElementNotFound + raise ElementNotFound, %(Couldn't find file template named "#{file_name}". Please confirm that it is a valid option.) end wait(reload: false) do @@ -58,7 +56,7 @@ module QA begin click_on template rescue Capybara::ElementNotFound - raise ElementNotFound, %Q(Couldn't find template "#{template}" for #{file_name}. Please confirm that it exists in the list of templates.) + raise ElementNotFound, %(Couldn't find template "#{template}" for #{file_name}. Please confirm that it exists in the list of templates.) end end end @@ -80,13 +78,13 @@ module QA # Retry the attempt to click :commit_button just in case part of the # animation is still in process even when the buttons have the # expected visibility. - commit_success_msg_shown = retry_until do + commit_success_msg_shown = retry_until { click_element :commit_button wait(reload: false) do - has_text?('Your changes have been committed') + has_text?("Your changes have been committed") end - end + } raise "The changes do not appear to have been committed successfully." unless commit_success_msg_shown end diff --git a/qa/qa/page/project/wiki/edit.rb b/qa/qa/page/project/wiki/edit.rb index 8d0eafa1818..3fc7510bc93 100644 --- a/qa/qa/page/project/wiki/edit.rb +++ b/qa/qa/page/project/wiki/edit.rb @@ -3,22 +3,22 @@ module QA module Project module Wiki class Edit < Page::Base - view 'app/views/projects/wikis/_main_links.html.haml' do - element :new_page_link, 'New page' # rubocop:disable QA/ElementWithPattern - element :page_history_link, 'Page history' # rubocop:disable QA/ElementWithPattern - element :edit_page_link, 'Edit' # rubocop:disable QA/ElementWithPattern + view "app/views/projects/wikis/_main_links.html.haml" do + element :new_page_link, "New page" # rubocop:disable QA/ElementWithPattern + element :page_history_link, "Page history" # rubocop:disable QA/ElementWithPattern + element :edit_page_link, "Edit" # rubocop:disable QA/ElementWithPattern end def go_to_new_page - click_on 'New page' + click_on "New page" end def got_to_view_history_page - click_on 'Page history' + click_on "Page history" end def go_to_edit_page - click_on 'Edit' + click_on "Edit" end end end diff --git a/qa/qa/page/project/wiki/new.rb b/qa/qa/page/project/wiki/new.rb index b90e03be36a..e9687e26dd7 100644 --- a/qa/qa/page/project/wiki/new.rb +++ b/qa/qa/page/project/wiki/new.rb @@ -7,7 +7,7 @@ module QA class New < Page::Base include Component::LazyLoader - view 'app/views/projects/wikis/_form.html.haml' do + view "app/views/projects/wikis/_form.html.haml" do element :wiki_title_textbox element :wiki_content_textarea element :wiki_message_textbox @@ -15,11 +15,11 @@ module QA element :create_page_button end - view 'app/views/shared/empty_states/_wikis.html.haml' do + view "app/views/shared/empty_states/_wikis.html.haml" do element :create_first_page_link end - view 'app/views/shared/empty_states/_wikis_layout.html.haml' do + view "app/views/shared/empty_states/_wikis_layout.html.haml" do element :svg_content end diff --git a/qa/qa/page/project/wiki/show.rb b/qa/qa/page/project/wiki/show.rb index dffbc5d60a2..a7462426d41 100644 --- a/qa/qa/page/project/wiki/show.rb +++ b/qa/qa/page/project/wiki/show.rb @@ -7,12 +7,12 @@ module QA class Show < Page::Base include Page::Component::LegacyClonePanel - view 'app/views/projects/wikis/pages.html.haml' do - element :clone_repository_link, 'Clone repository' # rubocop:disable QA/ElementWithPattern + view "app/views/projects/wikis/pages.html.haml" do + element :clone_repository_link, "Clone repository" # rubocop:disable QA/ElementWithPattern end def go_to_clone_repository - click_on 'Clone repository' + click_on "Clone repository" end end end diff --git a/qa/qa/page/settings/common.rb b/qa/qa/page/settings/common.rb index 9fea74eabc9..9ab9d3526c0 100644 --- a/qa/qa/page/settings/common.rb +++ b/qa/qa/page/settings/common.rb @@ -9,9 +9,9 @@ module QA within_element(element_name) do # Because it is possible to click the button before the JS toggle code is bound wait(reload: false) do - click_button 'Expand' unless first('button', text: 'Collapse') + click_button "Expand" unless first("button", text: "Collapse") - has_content?('Collapse') + has_content?("Collapse") end yield if block_given? diff --git a/qa/qa/page/validator.rb b/qa/qa/page/validator.rb index 117d8d4db67..905a3f27269 100644 --- a/qa/qa/page/validator.rb +++ b/qa/qa/page/validator.rb @@ -3,31 +3,31 @@ module QA class Validator ValidationError = Class.new(StandardError) - Error = Struct.new(:page, :message) do + Error = Struct.new(:page, :message) { def to_s "Error: #{page} - #{message}" end - end + } def initialize(constant) @module = constant end def constants - @consts ||= @module.constants.map do |const| + @consts ||= @module.constants.map { |const| @module.const_get(const) - end + } end def descendants - @descendants ||= constants.map do |const| + @descendants ||= constants.map { |const| case const when Class const if const < Page::Base when Module Page::Validator.new(const).descendants end - end + } @descendants.flatten.compact end @@ -45,7 +45,7 @@ module QA def validate! return if errors.none? - raise ValidationError, 'Page views / elements validation error!' + raise ValidationError, "Page views / elements validation error!" end end end diff --git a/qa/qa/page/view.rb b/qa/qa/page/view.rb index c59fad2e223..f1a5a6cef75 100644 --- a/qa/qa/page/view.rb +++ b/qa/qa/page/view.rb @@ -1,4 +1,4 @@ -require 'pathname' +require "pathname" module QA module Page @@ -11,7 +11,7 @@ module QA end def pathname - @pathname ||= ::Pathname.new(::File.join(__dir__, '../../../', @path)) + @pathname ||= ::Pathname.new(::File.join(__dir__, "../../../", @path)) .cleanpath.expand_path end diff --git a/qa/qa/resource/api_fabricator.rb b/qa/qa/resource/api_fabricator.rb index 98eebac0880..9dc5a2e8981 100644 --- a/qa/qa/resource/api_fabricator.rb +++ b/qa/qa/resource/api_fabricator.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require 'active_support/core_ext/object/deep_dup' -require 'capybara/dsl' +require "active_support/core_ext/object/deep_dup" +require "capybara/dsl" module QA module Resource @@ -68,7 +68,8 @@ module QA def api_post response = post( Runtime::API::Request.new(api_client, api_post_path).url, - api_post_body) + api_post_body + ) unless response.code == HTTP_STATUS_CREATED raise ResourceFabricationFailedError, "Fabrication of #{self.class.name} using the API failed (#{response.code}) with `#{response}`." @@ -79,7 +80,7 @@ module QA def api_client @api_client ||= begin - Runtime::API::Client.new(:gitlab, is_new_session: !current_url.start_with?('http')) + Runtime::API::Client.new(:gitlab, is_new_session: !current_url.start_with?("http")) end end diff --git a/qa/qa/resource/base.rb b/qa/qa/resource/base.rb index 523d92c7ef3..0ee4139f10b 100644 --- a/qa/qa/resource/base.rb +++ b/qa/qa/resource/base.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -require 'forwardable' -require 'capybara/dsl' -require 'active_support/core_ext/array/extract_options' +require "forwardable" +require "capybara/dsl" +require "active_support/core_ext/array/extract_options" module QA module Resource @@ -88,7 +88,7 @@ module QA end def self.do_fabricate!(resource:, prepare_block:, parents: []) - prepare_block.call(resource) if prepare_block + prepare_block&.call(resource) resource_web_url = yield resource.web_url = resource_web_url @@ -101,7 +101,7 @@ module QA return yield unless Runtime::Env.debug? start = Time.now - prefix = "==#{'=' * parents.size}>" + prefix = "==#{"=" * parents.size}>" msg = [prefix] msg << "Built a #{name}" msg << "as a dependency of #{parents.last}" if parents.any? @@ -109,7 +109,7 @@ module QA yield.tap do msg << "in #{Time.now - start} seconds" - puts msg.join(' ') + puts msg.join(" ") puts if parents.empty? end end @@ -133,7 +133,8 @@ module QA instance_variable_get("@#{name}") || instance_variable_set( "@#{name}", - populate_attribute(name, block)) + populate_attribute(name, block) + ) end end end diff --git a/qa/qa/resource/branch.rb b/qa/qa/resource/branch.rb index bd52c4abe02..4abd5040da4 100644 --- a/qa/qa/resource/branch.rb +++ b/qa/qa/resource/branch.rb @@ -4,16 +4,16 @@ module QA module Resource class Branch < Base attr_accessor :project, :branch_name, - :allow_to_push, :allow_to_merge, :protected + :allow_to_push, :allow_to_merge, :protected attribute :project do Project.fabricate! do |resource| - resource.name = 'protected-branch-project' + resource.name = "protected-branch-project" end end def initialize - @branch_name = 'test/branch' + @branch_name = "test/branch" @allow_to_push = true @allow_to_merge = true @protected = false @@ -24,18 +24,18 @@ module QA Repository::ProjectPush.fabricate! do |resource| resource.project = project - resource.file_name = 'kick-off.txt' - resource.commit_message = 'First commit' + resource.file_name = "kick-off.txt" + resource.commit_message = "First commit" end - branch = Repository::ProjectPush.fabricate! do |resource| + branch = Repository::ProjectPush.fabricate! { |resource| resource.project = project - resource.file_name = 'README.md' - resource.commit_message = 'Add readme' - resource.branch_name = 'master' + resource.file_name = "README.md" + resource.commit_message = "Add readme" + resource.branch_name = "master" resource.new_branch = false resource.remote_branch = @branch_name - end + } Page::Project::Show.perform do |page| page.wait { page.has_content?(branch_name) } @@ -65,7 +65,7 @@ module QA end page.wait(reload: false) do - !page.first('.btn-success').disabled? + !page.first(".btn-success").disabled? end page.protect_branch diff --git a/qa/qa/resource/ci_variable.rb b/qa/qa/resource/ci_variable.rb index 0570c47d41c..80aca61151c 100644 --- a/qa/qa/resource/ci_variable.rb +++ b/qa/qa/resource/ci_variable.rb @@ -7,8 +7,8 @@ module QA attribute :project do Project.fabricate! do |resource| - resource.name = 'project-with-ci-variables' - resource.description = 'project for adding CI variable test' + resource.name = "project-with-ci-variables" + resource.description = "project for adding CI variable test" end end diff --git a/qa/qa/resource/deploy_key.rb b/qa/qa/resource/deploy_key.rb index 9565598efb0..6a1491d6045 100644 --- a/qa/qa/resource/deploy_key.rb +++ b/qa/qa/resource/deploy_key.rb @@ -15,8 +15,8 @@ module QA attribute :project do Project.fabricate! do |resource| - resource.name = 'project-to-deploy' - resource.description = 'project for adding deploy key test' + resource.name = "project-to-deploy" + resource.description = "project for adding deploy key test" end end diff --git a/qa/qa/resource/deploy_token.rb b/qa/qa/resource/deploy_token.rb index cee4422f6b4..a815f0bec41 100644 --- a/qa/qa/resource/deploy_token.rb +++ b/qa/qa/resource/deploy_token.rb @@ -23,8 +23,8 @@ module QA attribute :project do Project.fabricate! do |resource| - resource.name = 'project-to-deploy' - resource.description = 'project for adding deploy token test' + resource.name = "project-to-deploy" + resource.description = "project for adding deploy token test" end end diff --git a/qa/qa/resource/events/base.rb b/qa/qa/resource/events/base.rb index b50b620b143..7162c80404b 100644 --- a/qa/qa/resource/events/base.rb +++ b/qa/qa/resource/events/base.rb @@ -11,7 +11,7 @@ module QA def events(action: nil) path = [api_get_events] path << "?action=#{CGI.escape(action)}" if action - parse_body(api_get_from("#{path.join}")) + parse_body(api_get_from(path.join.to_s)) end private @@ -21,9 +21,9 @@ module QA end def wait_for_event - event_found = QA::Support::Waiter.wait(max: max_wait) do + event_found = QA::Support::Waiter.wait(max: max_wait) { yield - end + } raise EventNotFoundError, "Timed out waiting for event" unless event_found end diff --git a/qa/qa/resource/events/project.rb b/qa/qa/resource/events/project.rb index 99c78254f42..c8a073f34ae 100644 --- a/qa/qa/resource/events/project.rb +++ b/qa/qa/resource/events/project.rb @@ -7,16 +7,16 @@ module QA include Events::Base def wait_for_push(commit_message) - QA::Runtime::Logger.debug(%Q[#{self.class.name} - wait_for_push with commit message "#{commit_message}"]) + QA::Runtime::Logger.debug(%(#{self.class.name} - wait_for_push with commit message "#{commit_message}")) wait_for_event do - events(action: 'pushed').any? { |event| event.dig(:push_data, :commit_title) == commit_message } + events(action: "pushed").any? { |event| event.dig(:push_data, :commit_title) == commit_message } end end def wait_for_push_new_branch(branch_name = "master") - QA::Runtime::Logger.debug(%Q[#{self.class.name} - wait_for_push_new_branch with branch_name "#{branch_name}"]) + QA::Runtime::Logger.debug(%(#{self.class.name} - wait_for_push_new_branch with branch_name "#{branch_name}")) wait_for_event do - events(action: 'pushed').any? { |event| event.dig(:push_data, :ref) == branch_name } + events(action: "pushed").any? { |event| event.dig(:push_data, :ref) == branch_name } end end end diff --git a/qa/qa/resource/file.rb b/qa/qa/resource/file.rb index 57e82ac19ad..ea89ba0d937 100644 --- a/qa/qa/resource/file.rb +++ b/qa/qa/resource/file.rb @@ -4,19 +4,19 @@ module QA module Resource class File < Base attr_accessor :name, - :content, - :commit_message + :content, + :commit_message attribute :project do Project.fabricate! do |resource| - resource.name = 'project-with-new-file' + resource.name = "project-with-new-file" end end def initialize - @name = 'QA Test - File name' - @content = 'QA Test - File content' - @commit_message = 'QA Test - Commit message' + @name = "QA Test - File name" + @content = "QA Test - File content" + @commit_message = "QA Test - Commit message" end def fabricate! diff --git a/qa/qa/resource/fork.rb b/qa/qa/resource/fork.rb index 03bc1f0820b..1869796e625 100644 --- a/qa/qa/resource/fork.rb +++ b/qa/qa/resource/fork.rb @@ -42,7 +42,7 @@ module QA end Page::Layout::Banner.perform do |page| - page.has_notice?('The project was successfully forked.') + page.has_notice?("The project was successfully forked.") end populate(:project) diff --git a/qa/qa/resource/group.rb b/qa/qa/resource/group.rb index d7f9ec6a836..e6b6b4143e1 100644 --- a/qa/qa/resource/group.rb +++ b/qa/qa/resource/group.rb @@ -28,7 +28,7 @@ module QA Page::Group::New.perform do |group_new| group_new.set_path(path) group_new.set_description(description) - group_new.set_visibility('Public') + group_new.set_visibility("Public") group_new.create end @@ -56,7 +56,7 @@ module QA end def api_post_path - '/groups' + "/groups" end def api_post_body @@ -64,7 +64,7 @@ module QA parent_id: sandbox.id, path: path, name: path, - visibility: 'public' + visibility: "public", } end end diff --git a/qa/qa/resource/issue.rb b/qa/qa/resource/issue.rb index 2c2f27fe231..87e05909d11 100644 --- a/qa/qa/resource/issue.rb +++ b/qa/qa/resource/issue.rb @@ -7,8 +7,8 @@ module QA attribute :project do Project.fabricate! do |resource| - resource.name = 'project-for-issues' - resource.description = 'project for adding issues' + resource.name = "project-for-issues" + resource.description = "project for adding issues" end end diff --git a/qa/qa/resource/kubernetes_cluster.rb b/qa/qa/resource/kubernetes_cluster.rb index 93a06be6818..58c27847645 100644 --- a/qa/qa/resource/kubernetes_cluster.rb +++ b/qa/qa/resource/kubernetes_cluster.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'securerandom' +require "securerandom" module QA module Resource @@ -16,13 +16,16 @@ module QA @project.visit! Page::Project::Menu.perform( - &:click_operations_kubernetes) + &:click_operations_kubernetes + ) Page::Project::Operations::Kubernetes::Index.perform( - &:add_kubernetes_cluster) + &:add_kubernetes_cluster + ) Page::Project::Operations::Kubernetes::Add.perform( - &:add_existing_cluster) + &:add_existing_cluster + ) Page::Project::Operations::Kubernetes::AddExisting.perform do |page| page.set_cluster_name(@cluster.cluster_name) diff --git a/qa/qa/resource/label.rb b/qa/qa/resource/label.rb index c0869cb1f2a..f59144437be 100644 --- a/qa/qa/resource/label.rb +++ b/qa/qa/resource/label.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'securerandom' +require "securerandom" module QA module Resource @@ -11,14 +11,14 @@ module QA attribute :project do Project.fabricate! do |resource| - resource.name = 'project-with-label' + resource.name = "project-with-label" end end def initialize @title = "qa-test-#{SecureRandom.hex(8)}" - @description = 'This is a test label' - @color = '#0033CC' + @description = "This is a test label" + @color = "#0033CC" end def fabricate! diff --git a/qa/qa/resource/merge_request.rb b/qa/qa/resource/merge_request.rb index 45cb317e0eb..6169e760738 100644 --- a/qa/qa/resource/merge_request.rb +++ b/qa/qa/resource/merge_request.rb @@ -1,23 +1,23 @@ # frozen_string_literal: true -require 'securerandom' +require "securerandom" module QA module Resource class MergeRequest < Base attr_accessor :title, - :description, - :source_branch, - :target_branch, - :assignee, - :milestone, - :labels, - :file_name, - :file_content + :description, + :source_branch, + :target_branch, + :assignee, + :milestone, + :labels, + :file_name, + :file_content attribute :project do Project.fabricate! do |resource| - resource.name = 'project-with-merge-request' + resource.name = "project-with-merge-request" end end @@ -26,7 +26,7 @@ module QA Repository::ProjectPush.fabricate! do |resource| resource.project = project - resource.branch_name = 'master' + resource.branch_name = "master" resource.remote_branch = target_branch end end @@ -43,8 +43,8 @@ module QA end def initialize - @title = 'QA test - merge request' - @description = 'This is a test merge request' + @title = "QA test - merge request" + @description = "This is a test merge request" @source_branch = "qa-test-feature-#{SecureRandom.hex(8)}" @target_branch = "master" @assignee = nil @@ -63,7 +63,7 @@ module QA page.fill_title(@title) page.fill_description(@description) page.choose_milestone(@milestone) if @milestone - page.assign_to_me if @assignee == 'me' + page.assign_to_me if @assignee == "me" labels.each do |label| page.select_label(label) end diff --git a/qa/qa/resource/merge_request_from_fork.rb b/qa/qa/resource/merge_request_from_fork.rb index 5d20a6e9c75..87a0aba9472 100644 --- a/qa/qa/resource/merge_request_from_fork.rb +++ b/qa/qa/resource/merge_request_from_fork.rb @@ -13,7 +13,7 @@ module QA Repository::ProjectPush.fabricate! do |resource| resource.project = fork.project resource.branch_name = fork_branch - resource.file_name = 'file2.txt' + resource.file_name = "file2.txt" resource.user = fork.user end end diff --git a/qa/qa/resource/personal_access_token.rb b/qa/qa/resource/personal_access_token.rb index b8dd0a3562f..48ba57f6f03 100644 --- a/qa/qa/resource/personal_access_token.rb +++ b/qa/qa/resource/personal_access_token.rb @@ -17,7 +17,7 @@ module QA Page::Profile::Menu.perform(&:click_access_tokens) Page::Profile::PersonalAccessTokens.perform do |page| - page.fill_token_name(name || 'api-test-token') + page.fill_token_name(name || "api-test-token") page.check_api page.create_token end diff --git a/qa/qa/resource/project.rb b/qa/qa/resource/project.rb index de1e9f04c36..1fabad13345 100644 --- a/qa/qa/resource/project.rb +++ b/qa/qa/resource/project.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'securerandom' +require "securerandom" module QA module Resource @@ -31,7 +31,7 @@ module QA end def initialize - @description = 'My awesome project' + @description = "My awesome project" end def name=(raw_name) @@ -47,7 +47,7 @@ module QA page.choose_test_namespace page.choose_name(@name) page.add_description(@description) - page.set_visibility('Public') + page.set_visibility("Public") page.create_new_project end end @@ -63,7 +63,7 @@ module QA end def api_post_path - '/projects' + "/projects" end def api_post_body @@ -72,7 +72,7 @@ module QA path: name, name: name, description: description, - visibility: 'public' + visibility: "public", } end diff --git a/qa/qa/resource/project_imported_from_github.rb b/qa/qa/resource/project_imported_from_github.rb index 0d25e7dd842..cecae9c9377 100644 --- a/qa/qa/resource/project_imported_from_github.rb +++ b/qa/qa/resource/project_imported_from_github.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'securerandom' +require "securerandom" module QA module Resource diff --git a/qa/qa/resource/project_milestone.rb b/qa/qa/resource/project_milestone.rb index a4d6657caff..9b06831c998 100644 --- a/qa/qa/resource/project_milestone.rb +++ b/qa/qa/resource/project_milestone.rb @@ -12,7 +12,7 @@ module QA def title=(title) @title = "#{title}-#{SecureRandom.hex(4)}" - @description = 'A milestone' + @description = "A milestone" end def fabricate! diff --git a/qa/qa/resource/repository/project_push.rb b/qa/qa/resource/repository/project_push.rb index cad89ebb0bb..4e7aead978c 100644 --- a/qa/qa/resource/repository/project_push.rb +++ b/qa/qa/resource/repository/project_push.rb @@ -8,16 +8,16 @@ module QA attribute :project do Project.fabricate! do |resource| - resource.name = 'project-with-code' - resource.description = 'Project with repository' + resource.name = "project-with-code" + resource.description = "Project with repository" end end def initialize - @file_name = 'file.txt' - @file_content = '# This is test project' + @file_name = "file.txt" + @file_content = "# This is test project" @commit_message = "This is a test commit" - @branch_name = 'master' + @branch_name = "master" @new_branch = true @wait_for_push = true end diff --git a/qa/qa/resource/repository/push.rb b/qa/qa/resource/repository/push.rb index a5827fb6e73..5b415de99a3 100644 --- a/qa/qa/resource/repository/push.rb +++ b/qa/qa/resource/repository/push.rb @@ -1,22 +1,22 @@ # frozen_string_literal: true -require 'pathname' +require "pathname" module QA module Resource module Repository class Push < Base attr_accessor :file_name, :file_content, :commit_message, - :branch_name, :new_branch, :output, :repository_http_uri, - :repository_ssh_uri, :ssh_key, :user, :use_lfs + :branch_name, :new_branch, :output, :repository_http_uri, + :repository_ssh_uri, :ssh_key, :user, :use_lfs attr_writer :remote_branch def initialize - @file_name = 'file.txt' - @file_content = '# This is test file' + @file_name = "file.txt" + @file_content = "# This is test file" @commit_message = "This is a test commit" - @branch_name = 'master' + @branch_name = "master" @new_branch = true @repository_http_uri = "" @ssh_key = nil @@ -36,7 +36,7 @@ module QA def files=(files) if !files.is_a?(Array) || files.empty? || - files.any? { |file| !file.has_key?(:name) || !file.has_key?(:content) } + files.any? { |file| !file.key?(:name) || !file.key?(:content) } raise ArgumentError, "Please provide an array of hashes e.g.: [{name: 'file1', content: 'foo'}]" end @@ -45,7 +45,7 @@ module QA def fabricate! Git::Repository.perform do |repository| - @output = '' + @output = "" if ssh_key repository.uri = repository_ssh_uri @@ -57,8 +57,8 @@ module QA repository.use_lfs = use_lfs - username = 'GitLab QA' - email = 'root@gitlab.com' + username = "GitLab QA" + email = "root@gitlab.com" if user repository.username = user.username diff --git a/qa/qa/resource/repository/wiki_push.rb b/qa/qa/resource/repository/wiki_push.rb index 77c4c8a514d..647b689599e 100644 --- a/qa/qa/resource/repository/wiki_push.rb +++ b/qa/qa/resource/repository/wiki_push.rb @@ -6,17 +6,17 @@ module QA class WikiPush < Repository::Push attribute :wiki do Wiki.fabricate! do |resource| - resource.title = 'Home' - resource.content = '# My First Wiki Content' - resource.message = 'Update home' + resource.title = "Home" + resource.content = "# My First Wiki Content" + resource.message = "Update home" end end def initialize - @file_name = 'Home.md' - @file_content = '# Welcome to My Wiki' - @commit_message = 'Updating Home Page' - @branch_name = 'master' + @file_name = "Home.md" + @file_content = "# Welcome to My Wiki" + @commit_message = "Updating Home Page" + @branch_name = "master" @new_branch = false end diff --git a/qa/qa/resource/runner.rb b/qa/qa/resource/runner.rb index 08ae3f22117..bb1e4b88d92 100644 --- a/qa/qa/resource/runner.rb +++ b/qa/qa/resource/runner.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'securerandom' +require "securerandom" module QA module Resource @@ -9,8 +9,8 @@ module QA attribute :project do Project.fabricate! do |resource| - resource.name = 'project-with-ci-cd' - resource.description = 'Project with CI/CD Pipelines' + resource.name = "project-with-ci-cd" + resource.description = "Project with CI/CD Pipelines" end end @@ -23,7 +23,7 @@ module QA end def image - @image || 'gitlab/gitlab-runner:alpine' + @image || "gitlab/gitlab-runner:alpine" end def fabricate! diff --git a/qa/qa/resource/sandbox.rb b/qa/qa/resource/sandbox.rb index 41ce857a8b8..f7d6b27290d 100644 --- a/qa/qa/resource/sandbox.rb +++ b/qa/qa/resource/sandbox.rb @@ -26,8 +26,8 @@ module QA Page::Group::New.perform do |group| group.set_path(path) - group.set_description('GitLab QA Sandbox Group') - group.set_visibility('Public') + group.set_description("GitLab QA Sandbox Group") + group.set_visibility("Public") group.create end end @@ -45,14 +45,14 @@ module QA end def api_post_path - '/groups' + "/groups" end def api_post_body { path: path, name: path, - visibility: 'public' + visibility: "public", } end end diff --git a/qa/qa/resource/user.rb b/qa/qa/resource/user.rb index 6c5e91b6488..cdafa364738 100644 --- a/qa/qa/resource/user.rb +++ b/qa/qa/resource/user.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'securerandom' +require "securerandom" module QA module Resource @@ -21,7 +21,7 @@ module QA end def password - @password || 'password' + @password || "password" end def name @@ -36,7 +36,7 @@ module QA @public_email ||= begin api_public_email = api_resource&.dig(:public_email) - api_public_email && api_public_email != '' ? api_public_email : Runtime::User.default_email + api_public_email && api_public_email != "" ? api_public_email : Runtime::User.default_email end end @@ -75,7 +75,7 @@ module QA end def api_post_path - '/users' + "/users" end def api_post_body @@ -84,18 +84,18 @@ module QA password: password, username: username, name: name, - skip_confirmation: true + skip_confirmation: true, }.merge(ldap_post_body) end def self.fabricate_or_use(username, password) if Runtime::Env.signup_disabled? - self.new.tap do |user| + new.tap do |user| user.username = username user.password = password end else - self.fabricate! + fabricate! end end @@ -105,8 +105,8 @@ module QA return {} unless extern_uid && provider { - extern_uid: extern_uid, - provider: provider + extern_uid: extern_uid, + provider: provider, } end diff --git a/qa/qa/resource/wiki.rb b/qa/qa/resource/wiki.rb index e942e9718a0..3d5f6a5ebfa 100644 --- a/qa/qa/resource/wiki.rb +++ b/qa/qa/resource/wiki.rb @@ -7,8 +7,8 @@ module QA attribute :project do Project.fabricate! do |resource| - resource.name = 'project-for-wikis' - resource.description = 'project for adding wikis' + resource.name = "project-for-wikis" + resource.description = "project for adding wikis" end end diff --git a/qa/qa/runtime/api/client.rb b/qa/qa/runtime/api/client.rb index aff84c89f0e..dc0f23d9300 100644 --- a/qa/qa/runtime/api/client.rb +++ b/qa/qa/runtime/api/client.rb @@ -1,4 +1,4 @@ -require 'airborne' +require "airborne" module QA module Runtime diff --git a/qa/qa/runtime/api/request.rb b/qa/qa/runtime/api/request.rb index ff9f0004524..2b84f24d0a6 100644 --- a/qa/qa/runtime/api/request.rb +++ b/qa/qa/runtime/api/request.rb @@ -2,7 +2,7 @@ module QA module Runtime module API class Request - API_VERSION = 'v4'.freeze + API_VERSION = "v4".freeze def initialize(api_client, path, **query_string) query_string[:private_token] ||= api_client.personal_access_token unless query_string[:oauth_access_token] @@ -28,11 +28,11 @@ module QA # # Returns the relative path to the requested API resource def request_path(path, version: API_VERSION, **query_string) - full_path = ::File.join('/api', version, path) + full_path = ::File.join("/api", version, path) if query_string.any? - full_path << (path.include?('?') ? '&' : '?') - full_path << query_string.map { |k, v| "#{k}=#{CGI.escape(v)}" }.join('&') + full_path << (path.include?("?") ? "&" : "?") + full_path << query_string.map { |k, v| "#{k}=#{CGI.escape(v)}" }.join("&") end full_path diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb index 0b805b855ac..ee1e4d11a1e 100644 --- a/qa/qa/runtime/browser.rb +++ b/qa/qa/runtime/browser.rb @@ -1,7 +1,7 @@ -require 'rspec/core' -require 'capybara/rspec' -require 'capybara-screenshot/rspec' -require 'selenium-webdriver' +require "rspec/core" +require "capybara/rspec" +require "capybara-screenshot/rspec" +require "selenium-webdriver" module QA module Runtime @@ -44,16 +44,16 @@ module QA Capybara.register_driver QA::Runtime::Env.browser do |app| capabilities = Selenium::WebDriver::Remote::Capabilities.send(QA::Runtime::Env.browser, - # This enables access to logs with `page.driver.manage.get_log(:browser)` - loggingPrefs: { - browser: "ALL", - client: "ALL", - driver: "ALL", - server: "ALL" - }) + # This enables access to logs with `page.driver.manage.get_log(:browser)` + loggingPrefs: { + browser: "ALL", + client: "ALL", + driver: "ALL", + server: "ALL", + }) if QA::Runtime::Env.accept_insecure_certs? - capabilities['acceptInsecureCerts'] = true + capabilities["acceptInsecureCerts"] = true end # QA::Runtime::Env.browser.capitalize will work for every driver type except PhantomJS. @@ -79,7 +79,7 @@ module QA # Use the same profile on QA runs if CHROME_REUSE_PROFILE is true. # Useful to speed up local QA. if QA::Runtime::Env.reuse_chrome_profile? - qa_profile_dir = ::File.expand_path('../../tmp/qa-profile', __dir__) + qa_profile_dir = ::File.expand_path("../../tmp/qa-profile", __dir__) options.add_argument("user-data-dir=#{qa_profile_dir}") end @@ -90,7 +90,7 @@ module QA browser: QA::Runtime::Env.browser, clear_local_storage: true, desired_capabilities: capabilities, - options: options + options: options, } selenium_options[:url] = QA::Runtime::Env.remote_grid if QA::Runtime::Env.remote_grid @@ -110,7 +110,7 @@ module QA end Capybara::Screenshot.register_filename_prefix_formatter(:rspec) do |example| - ::File.join(QA::Runtime::Namespace.name, example.file_path.sub('./qa/specs/features/', '')) + ::File.join(QA::Runtime::Namespace.name, example.file_path.sub("./qa/specs/features/", "")) end Capybara.configure do |config| @@ -118,7 +118,7 @@ module QA config.javascript_driver = QA::Runtime::Env.browser config.default_max_wait_time = 10 # https://github.com/mattheworiordan/capybara-screenshot/issues/164 - config.save_path = ::File.expand_path('../../tmp', __dir__) + config.save_path = ::File.expand_path("../../tmp", __dir__) end end diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb index dd0ddbdbd6b..0caa67b5034 100644 --- a/qa/qa/runtime/env.rb +++ b/qa/qa/runtime/env.rb @@ -10,7 +10,7 @@ module QA # The environment variables used to indicate if the environment under test # supports the given feature SUPPORTED_FEATURES = { - git_protocol_v2: 'QA_CAN_TEST_GIT_PROTOCOL_V2' + git_protocol_v2: "QA_CAN_TEST_GIT_PROTOCOL_V2", }.freeze def supported_features @@ -18,42 +18,42 @@ module QA end def debug? - enabled?(ENV['QA_DEBUG'], default: false) + enabled?(ENV["QA_DEBUG"], default: false) end def log_destination - ENV['QA_LOG_PATH'] || $stdout + ENV["QA_LOG_PATH"] || $stdout end # set to 'false' to have Chrome run visibly instead of headless def chrome_headless? - enabled?(ENV['CHROME_HEADLESS']) + enabled?(ENV["CHROME_HEADLESS"]) end # set to 'true' to have Chrome use a fixed profile directory def reuse_chrome_profile? - enabled?(ENV['CHROME_REUSE_PROFILE'], default: false) + enabled?(ENV["CHROME_REUSE_PROFILE"], default: false) end def accept_insecure_certs? - enabled?(ENV['ACCEPT_INSECURE_CERTS']) + enabled?(ENV["ACCEPT_INSECURE_CERTS"]) end def running_in_ci? - ENV['CI'] || ENV['CI_SERVER'] + ENV["CI"] || ENV["CI_SERVER"] end def qa_cookies - ENV['QA_COOKIES'] && ENV['QA_COOKIES'].split(';') + ENV["QA_COOKIES"]&.split(";") end def signup_disabled? - enabled?(ENV['SIGNUP_DISABLED'], default: false) + enabled?(ENV["SIGNUP_DISABLED"], default: false) end # specifies token that can be used for the api def personal_access_token - @personal_access_token ||= ENV['PERSONAL_ACCESS_TOKEN'] + @personal_access_token ||= ENV["PERSONAL_ACCESS_TOKEN"] end def remote_grid @@ -63,49 +63,49 @@ module QA # - "https://user:pass@somehost.com:443/wd/hub" # - "http://localhost:4444/wd/hub" - return if (ENV['QA_REMOTE_GRID'] || '').empty? + return if (ENV["QA_REMOTE_GRID"] || "").empty? - "#{remote_grid_protocol}://#{remote_grid_credentials}#{ENV['QA_REMOTE_GRID']}/wd/hub" + "#{remote_grid_protocol}://#{remote_grid_credentials}#{ENV["QA_REMOTE_GRID"]}/wd/hub" end def remote_grid_username - ENV['QA_REMOTE_GRID_USERNAME'] + ENV["QA_REMOTE_GRID_USERNAME"] end def remote_grid_access_key - ENV['QA_REMOTE_GRID_ACCESS_KEY'] + ENV["QA_REMOTE_GRID_ACCESS_KEY"] end def remote_grid_protocol - ENV['QA_REMOTE_GRID_PROTOCOL'] || 'http' + ENV["QA_REMOTE_GRID_PROTOCOL"] || "http" end def browser - ENV['QA_BROWSER'].nil? ? :chrome : ENV['QA_BROWSER'].to_sym + ENV["QA_BROWSER"].nil? ? :chrome : ENV["QA_BROWSER"].to_sym end def user_username - ENV['GITLAB_USERNAME'] + ENV["GITLAB_USERNAME"] end def user_password - ENV['GITLAB_PASSWORD'] + ENV["GITLAB_PASSWORD"] end def admin_username - ENV['GITLAB_ADMIN_USERNAME'] + ENV["GITLAB_ADMIN_USERNAME"] end def admin_password - ENV['GITLAB_ADMIN_PASSWORD'] + ENV["GITLAB_ADMIN_PASSWORD"] end def github_username - ENV['GITHUB_USERNAME'] + ENV["GITHUB_USERNAME"] end def github_password - ENV['GITHUB_PASSWORD'] + ENV["GITHUB_PASSWORD"] end def forker? @@ -113,47 +113,47 @@ module QA end def forker_username - ENV['GITLAB_FORKER_USERNAME'] + ENV["GITLAB_FORKER_USERNAME"] end def forker_password - ENV['GITLAB_FORKER_PASSWORD'] + ENV["GITLAB_FORKER_PASSWORD"] end def gitlab_qa_username_1 - ENV['GITLAB_QA_USERNAME_1'] || 'gitlab-qa-user1' + ENV["GITLAB_QA_USERNAME_1"] || "gitlab-qa-user1" end def gitlab_qa_password_1 - ENV['GITLAB_QA_PASSWORD_1'] + ENV["GITLAB_QA_PASSWORD_1"] end def gitlab_qa_username_2 - ENV['GITLAB_QA_USERNAME_2'] || 'gitlab-qa-user2' + ENV["GITLAB_QA_USERNAME_2"] || "gitlab-qa-user2" end def gitlab_qa_password_2 - ENV['GITLAB_QA_PASSWORD_2'] + ENV["GITLAB_QA_PASSWORD_2"] end def ldap_username - @ldap_username ||= ENV['GITLAB_LDAP_USERNAME'] + @ldap_username ||= ENV["GITLAB_LDAP_USERNAME"] end def ldap_password - @ldap_password ||= ENV['GITLAB_LDAP_PASSWORD'] + @ldap_password ||= ENV["GITLAB_LDAP_PASSWORD"] end def sandbox_name - ENV['GITLAB_SANDBOX_NAME'] + ENV["GITLAB_SANDBOX_NAME"] end def namespace_name - ENV['GITLAB_NAMESPACE_NAME'] + ENV["GITLAB_NAMESPACE_NAME"] end def auto_devops_project_name - ENV['GITLAB_AUTO_DEVOPS_PROJECT_NAME'] + ENV["GITLAB_AUTO_DEVOPS_PROJECT_NAME"] end def gcloud_account_key @@ -165,7 +165,7 @@ module QA end def gcloud_zone - ENV.fetch('GCLOUD_ZONE') + ENV.fetch("GCLOUD_ZONE") end def has_gcloud_credentials? @@ -174,7 +174,7 @@ module QA # Specifies the token that can be used for the GitHub API def github_access_token - ENV['GITHUB_ACCESS_TOKEN'].to_s.strip + ENV["GITHUB_ACCESS_TOKEN"].to_s.strip end def require_github_access_token! @@ -187,7 +187,7 @@ module QA # the feature is supported in the environment under test. # All features are supported by default. def can_test?(feature) - raise ArgumentError, %Q(Unknown feature "#{feature}") unless SUPPORTED_FEATURES.include? feature + raise ArgumentError, %(Unknown feature "#{feature}") unless SUPPORTED_FEATURES.include? feature enabled?(ENV[SUPPORTED_FEATURES[feature]], default: true) end @@ -196,12 +196,12 @@ module QA def remote_grid_credentials if remote_grid_username - raise ArgumentError, %Q(Please provide an access key for user "#{remote_grid_username}") unless remote_grid_access_key + raise ArgumentError, %(Please provide an access key for user "#{remote_grid_username}") unless remote_grid_access_key return "#{remote_grid_username}:#{remote_grid_access_key}@" end - '' + "" end def enabled?(value, default: true) diff --git a/qa/qa/runtime/key/base.rb b/qa/qa/runtime/key/base.rb index 67a992e2115..ecd1f619846 100644 --- a/qa/qa/runtime/key/base.rb +++ b/qa/qa/runtime/key/base.rb @@ -19,7 +19,7 @@ module QA private def ssh_keygen(name, bits, path) - cmd = %W[ssh-keygen -t #{name} -b #{bits} -f #{path} -N] << '' + cmd = %W[ssh-keygen -t #{name} -b #{bits} -f #{path} -N] << "" Service::Shellout.shell(cmd) end diff --git a/qa/qa/runtime/key/ecdsa.rb b/qa/qa/runtime/key/ecdsa.rb index 20adad45913..b2e58c08687 100644 --- a/qa/qa/runtime/key/ecdsa.rb +++ b/qa/qa/runtime/key/ecdsa.rb @@ -4,7 +4,7 @@ module QA module Key class ECDSA < Base def initialize(bits = 521) - super('ecdsa', bits) + super("ecdsa", bits) end end end diff --git a/qa/qa/runtime/key/ed25519.rb b/qa/qa/runtime/key/ed25519.rb index 63865c1cee5..04f1afcc4a9 100644 --- a/qa/qa/runtime/key/ed25519.rb +++ b/qa/qa/runtime/key/ed25519.rb @@ -4,7 +4,7 @@ module QA module Key class ED25519 < Base def initialize - super('ed25519', 256) + super("ed25519", 256) end end end diff --git a/qa/qa/runtime/key/rsa.rb b/qa/qa/runtime/key/rsa.rb index d94bde52325..af7842076df 100644 --- a/qa/qa/runtime/key/rsa.rb +++ b/qa/qa/runtime/key/rsa.rb @@ -3,7 +3,7 @@ module QA module Key class RSA < Base def initialize(bits = 4096) - super('rsa', bits) + super("rsa", bits) end end end diff --git a/qa/qa/runtime/logger.rb b/qa/qa/runtime/logger.rb index bd5c4fe5bf5..a9c2c6f9e8d 100644 --- a/qa/qa/runtime/logger.rb +++ b/qa/qa/runtime/logger.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'logger' +require "logger" module QA module Runtime diff --git a/qa/qa/runtime/namespace.rb b/qa/qa/runtime/namespace.rb index 9d7c1aea508..26b83074c7f 100644 --- a/qa/qa/runtime/namespace.rb +++ b/qa/qa/runtime/namespace.rb @@ -10,7 +10,7 @@ module QA def name # If any changes are made to the name tag, following script has to be considered: # https://ops.gitlab.net/gitlab-com/gl-infra/traffic-generator/blob/master/bin/janitor.bash - @name ||= Runtime::Env.namespace_name || "qa-test-#{time.strftime('%Y-%m-%d-%H-%M-%S')}-#{SecureRandom.hex(8)}" + @name ||= Runtime::Env.namespace_name || "qa-test-#{time.strftime("%Y-%m-%d-%H-%M-%S")}-#{SecureRandom.hex(8)}" end def path @@ -18,7 +18,7 @@ module QA end def sandbox_name - Runtime::Env.sandbox_name || 'gitlab-qa-sandbox-group' + Runtime::Env.sandbox_name || "gitlab-qa-sandbox-group" end end end diff --git a/qa/qa/runtime/path.rb b/qa/qa/runtime/path.rb index 3169c5dd743..725e16257ea 100644 --- a/qa/qa/runtime/path.rb +++ b/qa/qa/runtime/path.rb @@ -6,7 +6,7 @@ module QA extend self def qa_root - ::File.expand_path('../../', __dir__) + ::File.expand_path("../../", __dir__) end end end diff --git a/qa/qa/runtime/release.rb b/qa/qa/runtime/release.rb index b1f7ec482c8..8d6570f6d15 100644 --- a/qa/qa/runtime/release.rb +++ b/qa/qa/runtime/release.rb @@ -21,7 +21,7 @@ module QA end def self.method_missing(name, *args) - self.new.strategy.public_send(name, *args) + new.strategy.public_send(name, *args) end end end diff --git a/qa/qa/runtime/user.rb b/qa/qa/runtime/user.rb index e8bcb8a9f50..62139a42cda 100644 --- a/qa/qa/runtime/user.rb +++ b/qa/qa/runtime/user.rb @@ -4,15 +4,15 @@ module QA extend self def default_username - 'root' + "root" end def default_email - 'admin@example.com' + "admin@example.com" end def default_password - '5iveL!fe' + "5iveL!fe" end def username diff --git a/qa/qa/scenario/bootable.rb b/qa/qa/scenario/bootable.rb index dd12ea6d492..6f4ac07cf26 100644 --- a/qa/qa/scenario/bootable.rb +++ b/qa/qa/scenario/bootable.rb @@ -1,4 +1,4 @@ -require 'optparse' +require "optparse" module QA module Scenario @@ -11,24 +11,24 @@ module QA module ClassMethods def launch!(argv) - return self.perform(*argv) unless has_attributes? + return perform(*argv) unless has_attributes? - arguments = OptionParser.new do |parser| + arguments = OptionParser.new { |parser| options.to_a.each do |opt| parser.on(opt.arg, opt.desc) do |value| Runtime::Scenario.define(opt.name, value) end end - end + } arguments.parse!(argv) - self.perform(Runtime::Scenario.attributes, *arguments.default_argv) + perform(Runtime::Scenario.attributes, *arguments.default_argv) end private - def attribute(name, arg, desc = '') + def attribute(name, arg, desc = "") options.push(Option.new(name, arg, desc)) end diff --git a/qa/qa/scenario/test/instance.rb b/qa/qa/scenario/test/instance.rb index b4098619e4e..06bac5d2256 100644 --- a/qa/qa/scenario/test/instance.rb +++ b/qa/qa/scenario/test/instance.rb @@ -11,7 +11,7 @@ module QA include Bootable def self.perform(*args) - self.tap do |scenario| + tap do |scenario| yield scenario if block_given? break scenario.do_perform(*args) end diff --git a/qa/qa/scenario/test/sanity/selectors.rb b/qa/qa/scenario/test/sanity/selectors.rb index cff320cb751..5056ba592f0 100644 --- a/qa/qa/scenario/test/sanity/selectors.rb +++ b/qa/qa/scenario/test/sanity/selectors.rb @@ -8,9 +8,9 @@ module QA PAGES = [QA::Page].freeze def perform(*) - validators = PAGES.map do |pages| + validators = PAGES.map { |pages| Page::Validator.new(pages) - end + } validators.map(&:errors).flatten.tap do |errors| break if errors.none? @@ -45,7 +45,7 @@ module QA validators.each(&:validate!) - puts 'Views / selectors validation passed!' + puts "Views / selectors validation passed!" end end end diff --git a/qa/qa/service/kubernetes_cluster.rb b/qa/qa/service/kubernetes_cluster.rb index 41ab702d8b2..1929dfb5682 100644 --- a/qa/qa/service/kubernetes_cluster.rb +++ b/qa/qa/service/kubernetes_cluster.rb @@ -1,6 +1,6 @@ -require 'securerandom' -require 'mkmf' -require 'pathname' +require "securerandom" +require "mkmf" +require "pathname" module QA module Service @@ -21,7 +21,7 @@ module QA validate_dependencies login_if_not_already_logged_in - shell <<~CMD.tr("\n", ' ') + shell <<~CMD.tr("\n", " ") gcloud container clusters create #{cluster_name} #{auth_options} @@ -37,22 +37,22 @@ module QA @admin_user = "#{cluster_name}-admin" master_auth = JSON.parse(`gcloud container clusters describe #{cluster_name} --zone #{Runtime::Env.gcloud_zone} --format 'json(masterAuth.username, masterAuth.password)'`) - shell <<~CMD.tr("\n", ' ') + shell <<~CMD.tr("\n", " ") kubectl config set-credentials #{@admin_user} - --username #{master_auth['masterAuth']['username']} - --password #{master_auth['masterAuth']['password']} + --username #{master_auth["masterAuth"]["username"]} + --password #{master_auth["masterAuth"]["password"]} CMD if rbac create_service_account secrets = JSON.parse(`kubectl get secrets -o json`) - gitlab_account = secrets['items'].find do |item| - item['metadata']['annotations']['kubernetes.io/service-account.name'] == 'gitlab-account' - end + gitlab_account = secrets["items"].find { |item| + item["metadata"]["annotations"]["kubernetes.io/service-account.name"] == "gitlab-account" + } - @ca_certificate = Base64.decode64(gitlab_account['data']['ca.crt']) - @token = Base64.decode64(gitlab_account['data']['token']) + @ca_certificate = Base64.decode64(gitlab_account["data"]["ca.crt"]) + @token = Base64.decode64(gitlab_account["data"]["token"]) else @ca_certificate = Base64.decode64(`kubectl get secrets -o jsonpath="{.items[0].data['ca\\.crt']}"`) @token = Base64.decode64(`kubectl get secrets -o jsonpath='{.items[0].data.token}'`) @@ -62,18 +62,18 @@ module QA end def remove! - shell <<~CMD.tr("\n", ' ') - gcloud container clusters delete - --zone #{Runtime::Env.gcloud_zone} - #{cluster_name} - --quiet --async - CMD + shell <<~CMD.tr("\n", " ") + gcloud container clusters delete + --zone #{Runtime::Env.gcloud_zone} + #{cluster_name} + --quiet --async + CMD end private def create_service_account - shell('kubectl create -f -', stdin_data: service_account) + shell("kubectl create -f -", stdin_data: service_account) shell("kubectl --user #{@admin_user} create -f -", stdin_data: service_account_role_binding) end @@ -109,8 +109,8 @@ module QA end def validate_dependencies - find_executable('gcloud') || raise("You must first install `gcloud` executable to run these tests.") - find_executable('kubectl') || raise("You must first install `kubectl` executable to run these tests.") + find_executable("gcloud") || raise("You must first install `gcloud` executable to run these tests.") + find_executable("kubectl") || raise("You must first install `kubectl` executable to run these tests.") end def login_if_not_already_logged_in @@ -128,13 +128,13 @@ module QA def attempt_login_with_env_vars puts "No gcloud account. Attempting to login from env vars GCLOUD_ACCOUNT_EMAIL and GCLOUD_ACCOUNT_KEY." - gcloud_account_key = Tempfile.new('gcloud-account-key') + gcloud_account_key = Tempfile.new("gcloud-account-key") gcloud_account_key.write(Runtime::Env.gcloud_account_key) gcloud_account_key.close gcloud_account_email = Runtime::Env.gcloud_account_email shell("gcloud auth activate-service-account #{gcloud_account_email} --key-file #{gcloud_account_key.path}") ensure - gcloud_account_key && gcloud_account_key.unlink + gcloud_account_key&.unlink end end end diff --git a/qa/qa/service/runner.rb b/qa/qa/service/runner.rb index 9417c707105..c1a85b38029 100644 --- a/qa/qa/service/runner.rb +++ b/qa/qa/service/runner.rb @@ -1,4 +1,4 @@ -require 'securerandom' +require "securerandom" module QA module Service @@ -8,16 +8,16 @@ module QA attr_accessor :token, :address, :tags, :image def initialize(name) - @image = 'gitlab/gitlab-runner:alpine' + @image = "gitlab/gitlab-runner:alpine" @name = name || "qa-runner-#{SecureRandom.hex(4)}" - @network = Runtime::Scenario.attributes[:network] || 'test' + @network = Runtime::Scenario.attributes[:network] || "test" @tags = %w[qa test] end def network shell "docker network inspect #{@network}" rescue CommandError - 'bridge' + "bridge" else @network end @@ -27,14 +27,14 @@ module QA end def register! - shell <<~CMD.tr("\n", ' ') + shell <<~CMD.tr("\n", " ") docker run -d --rm --entrypoint=/bin/sh --network #{network} --name #{@name} -e CI_SERVER_URL=#{@address} -e REGISTER_NON_INTERACTIVE=true -e REGISTRATION_TOKEN=#{@token} -e RUNNER_EXECUTOR=shell - -e RUNNER_TAG_LIST=#{@tags.join(',')} + -e RUNNER_TAG_LIST=#{@tags.join(",")} -e RUNNER_NAME=#{@name} #{@image} -c 'gitlab-runner register && gitlab-runner run' CMD diff --git a/qa/qa/service/shellout.rb b/qa/qa/service/shellout.rb index 43dc0851571..6593558b634 100644 --- a/qa/qa/service/shellout.rb +++ b/qa/qa/service/shellout.rb @@ -1,4 +1,4 @@ -require 'open3' +require "open3" module QA module Service diff --git a/qa/qa/specs/features/api/1_manage/users_spec.rb b/qa/qa/specs/features/api/1_manage/users_spec.rb index ba1ba204d24..4e299bdb88c 100644 --- a/qa/qa/specs/features/api/1_manage/users_spec.rb +++ b/qa/qa/specs/features/api/1_manage/users_spec.rb @@ -1,22 +1,22 @@ # frozen_string_literal: true module QA - context 'Manage' do - describe 'Users API' do + context "Manage" do + describe "Users API" do before(:context) do @api_client = Runtime::API::Client.new(:gitlab) end - let(:request) { Runtime::API::Request.new(@api_client, '/users') } + let(:request) { Runtime::API::Request.new(@api_client, "/users") } - it 'GET /users' do + it "GET /users" do get request.url expect_status(200) end - it 'GET /users/:username with a valid username' do - get request.url, { params: { username: Runtime::User.username } } + it "GET /users/:username with a valid username" do + get request.url, {params: {username: Runtime::User.username}} expect_status(200) expect(json_body).to contain_exactly( @@ -24,8 +24,8 @@ module QA ) end - it 'GET /users/:username with an invalid username' do - get request.url, { params: { username: SecureRandom.hex(10) } } + it "GET /users/:username with an invalid username" do + get request.url, {params: {username: SecureRandom.hex(10)}} expect_status(200) expect(json_body).to eq([]) diff --git a/qa/qa/specs/features/api/3_create/repository/files_spec.rb b/qa/qa/specs/features/api/3_create/repository/files_spec.rb index bc0b5ebfe10..eaf37750623 100644 --- a/qa/qa/specs/features/api/3_create/repository/files_spec.rb +++ b/qa/qa/specs/features/api/3_create/repository/files_spec.rb @@ -1,7 +1,7 @@ -require 'securerandom' +require "securerandom" module QA - describe 'API basics' do + describe "API basics" do before(:context) do @api_client = Runtime::API::Client.new(:gitlab) end @@ -9,8 +9,8 @@ module QA let(:project_name) { "api-basics-#{SecureRandom.hex(8)}" } let(:sanitized_project_path) { CGI.escape("#{Runtime::User.username}/#{project_name}") } - it 'user creates a project with a file and deletes them afterwards' do - create_project_request = Runtime::API::Request.new(@api_client, '/projects') + it "user creates a project with a file and deletes them afterwards" do + create_project_request = Runtime::API::Request.new(@api_client, "/projects") post create_project_request.url, path: project_name, name: project_name expect_status(201) @@ -19,26 +19,26 @@ module QA ) create_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/README.md") - post create_file_request.url, branch: 'master', content: 'Hello world', commit_message: 'Add README.md' + post create_file_request.url, branch: "master", content: "Hello world", commit_message: "Add README.md" expect_status(201) expect(json_body).to match( - a_hash_including(branch: 'master', file_path: 'README.md') + a_hash_including(branch: "master", file_path: "README.md") ) - get_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/README.md", ref: 'master') + get_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/README.md", ref: "master") get get_file_request.url expect_status(200) expect(json_body).to match( a_hash_including( - ref: 'master', - file_path: 'README.md', file_name: 'README.md', - encoding: 'base64', content: 'SGVsbG8gd29ybGQ=' + ref: "master", + file_path: "README.md", file_name: "README.md", + encoding: "base64", content: "SGVsbG8gd29ybGQ=" ) ) - delete_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/README.md", branch: 'master', commit_message: 'Remove README.md') + delete_file_request = Runtime::API::Request.new(@api_client, "/projects/#{sanitized_project_path}/repository/files/README.md", branch: "master", commit_message: "Remove README.md") delete delete_file_request.url expect_status(204) @@ -54,7 +54,7 @@ module QA expect_status(202) expect(json_body).to match( - a_hash_including(message: '202 Accepted') + a_hash_including(message: "202 Accepted") ) end end 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 8f24a27b26f..220c6bf322a 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 @@ -1,7 +1,7 @@ module QA - context 'Manage', :smoke do - describe 'basic user login' do - it 'user logs in using basic credentials and logs out' do + context "Manage", :smoke do + describe "basic user login" do + it "user logs in using basic credentials and logs out" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb index a397df03bd2..7d3679f7b38 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_gitlab_via_ldap_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true module QA - context 'Manage', :orchestrated, :ldap_no_tls, :ldap_tls do - describe 'LDAP login' do - it 'user logs into GitLab using LDAP credentials' do + context "Manage", :orchestrated, :ldap_no_tls, :ldap_tls do + describe "LDAP login" do + it "user logs into GitLab using LDAP credentials" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb index b1d641b507f..83d2bb7511f 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/log_into_mattermost_via_gitlab_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true module QA - context 'Manage', :orchestrated, :mattermost do - describe 'Mattermost login' do - it 'user logs into Mattermost using GitLab OAuth' do + context "Manage", :orchestrated, :mattermost do + describe "Mattermost login" do + it "user logs into Mattermost using GitLab OAuth" do Runtime::Browser.visit(:gitlab, Page::Main::Login) do Page::Main::Login.act { sign_in_using_credentials } diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb index 87f0e9030d2..102c2f2f129 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_instance_wide_saml_sso_spec.rb @@ -1,16 +1,16 @@ # frozen_string_literal: true module QA - context 'Manage', :orchestrated, :instance_saml do - describe 'Instance wide SAML SSO' do - it 'User logs in to gitlab with SAML SSO' do + context "Manage", :orchestrated, :instance_saml do + describe "Instance wide SAML SSO" do + it "User logs in to gitlab with SAML SSO" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_with_saml } Vendor::SAMLIdp::Page::Login.act { login } - expect(page).to have_content('Welcome to GitLab') + expect(page).to have_content("Welcome to GitLab") end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb index a118176eb8a..125bce542a8 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/login/login_via_oauth_spec.rb @@ -1,15 +1,15 @@ # frozen_string_literal: true module QA - context 'Manage', :orchestrated, :oauth do - describe 'OAuth login' do - it 'User logs in to GitLab with GitHub OAuth' do + context "Manage", :orchestrated, :oauth do + describe "OAuth login" do + it "User logs in to GitLab with GitHub OAuth" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_with_github) Vendor::Github::Page::Login.perform(&:login) - expect(page).to have_content('Welcome to GitLab') + expect(page).to have_content("Welcome to GitLab") 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 185837edacf..363afbff7c2 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 @@ -1,8 +1,8 @@ # frozen_string_literal: true module QA - shared_examples 'registration and login' do - it 'user registers and logs in' do + shared_examples "registration and login" do + it "user registers and logs in" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Resource::User.fabricate_via_browser_ui! @@ -16,15 +16,15 @@ module QA end end - context 'Manage', :skip_signup_disabled do - describe 'standard' do - it_behaves_like 'registration and login' + context "Manage", :skip_signup_disabled do + describe "standard" do + it_behaves_like "registration and login" end end - context 'Manage', :orchestrated, :ldap_no_tls, :skip_signup_disabled do - describe 'while LDAP is enabled' do - it_behaves_like 'registration and login' + context "Manage", :orchestrated, :ldap_no_tls, :skip_signup_disabled do + describe "while LDAP is enabled" do + it_behaves_like "registration and login" end end end 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 4070a225260..e815e95d429 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,17 +1,17 @@ # frozen_string_literal: true module QA - context 'Manage' do - describe 'Add project member' do - it 'user adds project member' do + context "Manage" do + describe "Add project member" do + it "user adds project member" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) user = Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) - project = Resource::Project.fabricate! do |resource| - resource.name = 'add-member-project' - end + project = Resource::Project.fabricate! { |resource| + resource.name = "add-member-project" + } project.visit! Page::Project::Menu.perform(&:click_members_settings) 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 6632c2977ef..b6d0f30626d 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/create_project_spec.rb @@ -1,23 +1,23 @@ # frozen_string_literal: true module QA - context 'Manage', :smoke do - describe 'Project creation' do - it 'user creates a new project' do + context "Manage", :smoke do + describe "Project creation" do + it "user creates a new project" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } - created_project = Resource::Project.fabricate_via_browser_ui! do |project| - project.name = 'awesome-project' - project.description = 'create awesome project test' - end + created_project = Resource::Project.fabricate_via_browser_ui! { |project| + project.name = "awesome-project" + project.description = "create awesome project test" + } expect(page).to have_content(created_project.name) expect(page).to have_content( /Project \S?awesome-project\S+ was successfully created/ ) - expect(page).to have_content('create awesome project test') - expect(page).to have_content('The repository for this project is empty') + expect(page).to have_content("create awesome project test") + expect(page).to have_content("The repository for this project is empty") end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb index a9eafd61a91..8e604ca79ce 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/import_github_repo_spec.rb @@ -2,13 +2,13 @@ module QA # https://gitlab.com/gitlab-org/gitlab-ce/issues/58158 - context 'Manage', :github, :quarantine do - describe 'Project import from GitHub' do + context "Manage", :github, :quarantine do + describe "Project import from GitHub" do let(:imported_project) do Resource::ProjectImportedFromGithub.fabricate! do |project| - project.name = 'imported-project' + project.name = "imported-project" project.personal_access_token = Runtime::Env.github_access_token - project.github_repository_path = 'gitlab-qa/test-project' + project.github_repository_path = "gitlab-qa/test-project" end end @@ -22,7 +22,7 @@ module QA expect_status(202) end - it 'user imports a GitHub repo' do + it "user imports a GitHub repo" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } @@ -44,56 +44,56 @@ module QA end def verify_repository_import - expect(page).to have_content('This test project is used for automated GitHub import by GitLab QA.') + expect(page).to have_content("This test project is used for automated GitHub import by GitLab QA.") expect(page).to have_content(imported_project.name) end def verify_issues_import QA::Support::Retrier.retry_on_exception do Page::Project::Menu.act { click_issues } - expect(page).to have_content('This is a sample issue') + expect(page).to have_content("This is a sample issue") - click_link 'This is a sample issue' + click_link "This is a sample issue" - expect(page).to have_content('We should populate this project with issues, pull requests and wiki pages.') + expect(page).to have_content("We should populate this project with issues, pull requests and wiki pages.") # Comments - comment_text = 'This is a comment from @rymai.' + comment_text = "This is a comment from @rymai." Page::Project::Issue::Show.perform do |issue_page| expect(issue_page).to have_comment(comment_text) end Page::Issuable::Sidebar.perform do |issuable| - expect(issuable).to have_label('enhancement') - expect(issuable).to have_label('help wanted') - expect(issuable).to have_label('good first issue') + expect(issuable).to have_label("enhancement") + expect(issuable).to have_label("help wanted") + expect(issuable).to have_label("good first issue") end end end def verify_merge_requests_import Page::Project::Menu.act { click_merge_requests } - expect(page).to have_content('Improve README.md') + expect(page).to have_content("Improve README.md") - click_link 'Improve README.md' + click_link "Improve README.md" - expect(page).to have_content('This improves the README file a bit.') + expect(page).to have_content("This improves the README file a bit.") # Review comment are not supported yet - expect(page).not_to have_content('Really nice change.') + expect(page).not_to have_content("Really nice change.") # Comments - expect(page).to have_content('Nice work! This is a comment from @rymai.') + expect(page).to have_content("Nice work! This is a comment from @rymai.") # Diff comments - expect(page).to have_content('[Review comment] I like that!') - expect(page).to have_content('[Review comment] Nice blank line.') - expect(page).to have_content('[Single diff comment] Much better without this line!') + expect(page).to have_content("[Review comment] I like that!") + expect(page).to have_content("[Review comment] Nice blank line.") + expect(page).to have_content("[Single diff comment] Much better without this line!") Page::Issuable::Sidebar.perform do |issuable| - expect(issuable).to have_label('bug') - expect(issuable).to have_label('enhancement') + expect(issuable).to have_label("bug") + expect(issuable).to have_label("enhancement") end end @@ -110,7 +110,7 @@ module QA def verify_wiki_import Page::Project::Menu.act { click_wiki } - expect(page).to have_content('Welcome to the test-project wiki!') + expect(page).to have_content("Welcome to the test-project wiki!") end end end diff --git a/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb index e172206eb88..34ca4b2b379 100644 --- a/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb +++ b/qa/qa/specs/features/browser_ui/1_manage/project/view_project_activity_spec.rb @@ -2,23 +2,23 @@ module QA # Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/21 - context 'Manage', :quarantine do - describe 'Project activity' do - it 'user creates an event in the activity page upon Git push' do + context "Manage", :quarantine do + describe "Project activity" do + it "user creates an event in the activity page upon Git push" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - project_push = Resource::Repository::ProjectPush.fabricate! do |push| - push.file_name = 'README.md' - push.file_content = '# This is a test project' - push.commit_message = 'Add README.md' - end + project_push = Resource::Repository::ProjectPush.fabricate! { |push| + push.file_name = "README.md" + push.file_content = "# This is a test project" + push.commit_message = "Add README.md" + } project_push.project.visit! Page::Project::Menu.perform(&:go_to_activity) Page::Project::Activity.perform(&:go_to_push_events) - expect(page).to have_content('pushed new branch master') + expect(page).to have_content("pushed new branch master") end end end 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 fa779bd1f4e..82e174f2d91 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 @@ -1,11 +1,11 @@ # frozen_string_literal: true module QA - context 'Plan' do - describe 'collapse comments in issue discussions' do - let(:issue_title) { 'issue title' } + context "Plan" do + describe "collapse comments in issue discussions" do + let(:issue_title) { "issue title" } - it 'user collapses reply for comments in an issue' do + it "user collapses reply for comments in an issue" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) 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 7145b950b6c..d3e5c9e25e0 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/create_issue_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true module QA - context 'Plan', :smoke do - describe 'Issue creation' do - let(:issue_title) { 'issue title' } + context "Plan", :smoke do + describe "Issue creation" do + let(:issue_title) { "issue title" } def create_issue Runtime::Browser.visit(:gitlab, Page::Main::Login) @@ -14,7 +14,7 @@ module QA end end - it 'user creates an issue' do + it "user creates an issue" do create_issue Page::Project::Menu.act { click_issues } @@ -22,25 +22,25 @@ module QA expect(page).to have_content(issue_title) end - context 'when using attachments in comments', :object_storage do + context "when using attachments in comments", :object_storage do let(:file_to_attach) do - File.absolute_path(File.join('spec', 'fixtures', 'banana_sample.gif')) + File.absolute_path(File.join("spec", "fixtures", "banana_sample.gif")) end - it 'user comments on an issue with an attachment' do + it "user comments on an issue with an attachment" do create_issue Page::Project::Issue::Show.perform do |show| show.select_all_activities_filter - show.comment('See attached banana for scale', attachment: file_to_attach) + show.comment("See attached banana for scale", attachment: file_to_attach) show.refresh image_url = find('a[href$="banana_sample.gif"]')[:href] - found = show.wait(reload: false) do + found = show.wait(reload: false) { show.asset_exists?(image_url) - end + } expect(found).to be_truthy end diff --git a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb index ac34f72bb8f..f742b7f25e2 100644 --- a/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb +++ b/qa/qa/specs/features/browser_ui/2_plan/issue/filter_issue_comments_spec.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true module QA - context 'Plan' do - describe 'filter issue comments activities' do - let(:issue_title) { 'issue title' } + context "Plan" do + describe "filter issue comments activities" do + let(:issue_title) { "issue title" } - it 'user filters comments and activites in an issue' do + it "user filters comments and activites in an issue" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } @@ -17,8 +17,8 @@ module QA Page::Project::Issue::Show.perform do |show_page| show_page.select_comments_only_filter - show_page.comment('/confidential') - show_page.comment('My own comment') + show_page.comment("/confidential") + show_page.comment("My own comment") expect(show_page).not_to have_content("made the issue confidential") expect(show_page).to have_content("My own comment") 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 7e8b42e286f..a6a01b357cd 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 @@ -1,18 +1,18 @@ # frozen_string_literal: true module QA - context 'Plan' do - describe 'issue suggestions' do - let(:issue_title) { 'Issue Lists are awesome' } + context "Plan" do + describe "issue suggestions" do + let(:issue_title) { "Issue Lists are awesome" } - it 'user sees issue suggestions when creating a new issue' do + it "user sees issue suggestions when creating a new issue" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - project = Resource::Project.fabricate! do |resource| - resource.name = 'project-for-issue-suggestions' - resource.description = 'project for issue suggestions' - end + project = Resource::Project.fabricate! { |resource| + resource.name = "project-for-issue-suggestions" + resource.description = "project for issue suggestions" + } Resource::Issue.fabricate! do |issue| issue.title = issue_title 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 c06f13ee204..9d8a5bdc88f 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 @@ -1,41 +1,41 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Merge request creation' do - it 'user creates a new merge request' do + context "Create" do + describe "Merge request creation" do + it "user creates a new merge request" do gitlab_account_username = "@#{Runtime::User.username}" Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } - current_project = Resource::Project.fabricate! do |project| - project.name = 'project-with-merge-request-and-milestone' - end + current_project = Resource::Project.fabricate! { |project| + project.name = "project-with-merge-request-and-milestone" + } - current_milestone = Resource::ProjectMilestone.fabricate! do |milestone| - milestone.title = 'unique-milestone' + current_milestone = Resource::ProjectMilestone.fabricate! { |milestone| + milestone.title = "unique-milestone" milestone.project = current_project - end + } - new_label = Resource::Label.fabricate! do |label| + new_label = Resource::Label.fabricate! { |label| label.project = current_project - label.title = 'qa-mr-test-label' - label.description = 'Merge Request label' - end + label.title = "qa-mr-test-label" + label.description = "Merge Request label" + } Resource::MergeRequest.fabricate! do |merge_request| - merge_request.title = 'This is a merge request with a milestone' - merge_request.description = 'Great feature with milestone' + merge_request.title = "This is a merge request with a milestone" + merge_request.description = "Great feature with milestone" merge_request.project = current_project merge_request.milestone = current_milestone - merge_request.assignee = 'me' + merge_request.assignee = "me" merge_request.labels.push(new_label) end Page::MergeRequest::Show.perform do |merge_request| - expect(merge_request).to have_content('This is a merge request with a milestone') - expect(merge_request).to have_content('Great feature with milestone') + expect(merge_request).to have_content("This is a merge request with a milestone") + expect(merge_request).to have_content("Great feature with milestone") expect(merge_request).to have_content(/Opened [\w\s]+ ago/) expect(merge_request).to have_assignee(gitlab_account_username) expect(merge_request).to have_label(new_label.title) @@ -48,23 +48,23 @@ module QA end end - describe 'creates a merge request', :smoke do - it 'user creates a new merge request' do + describe "creates a merge request", :smoke do + it "user creates a new merge request" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } - current_project = Resource::Project.fabricate! do |project| - project.name = 'project-with-merge-request' - end + current_project = Resource::Project.fabricate! { |project| + project.name = "project-with-merge-request" + } Resource::MergeRequest.fabricate! do |merge_request| - merge_request.title = 'This is a merge request' - merge_request.description = 'Great feature' + merge_request.title = "This is a merge request" + merge_request.description = "Great feature" merge_request.project = current_project end - expect(page).to have_content('This is a merge request') - expect(page).to have_content('Great feature') + expect(page).to have_content("This is a merge request") + expect(page).to have_content("Great feature") expect(page).to have_content(/Opened [\w\s]+ ago/) end end diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb index 6ca7af8a3af..823baf6c496 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/merge_merge_request_from_fork_spec.rb @@ -1,15 +1,15 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Merge request creation from fork' do - it 'user forks a project, submits a merge request and maintainer merges it' do + context "Create" do + describe "Merge request creation from fork" do + it "user forks a project, submits a merge request and maintainer merges it" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - merge_request = Resource::MergeRequestFromFork.fabricate! do |merge_request| - merge_request.fork_branch = 'feature-branch' - end + merge_request = Resource::MergeRequestFromFork.fabricate! { |merge_request| + merge_request.fork_branch = "feature-branch" + } Page::Main::Menu.perform(&:sign_out) Page::Main::Login.perform(&:sign_in_using_credentials) @@ -18,7 +18,7 @@ module QA Page::MergeRequest::Show.perform(&:merge!) - expect(page).to have_content('The changes were merged') + expect(page).to have_content("The changes were merged") 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 3fbcd77dac6..8b3efade663 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 @@ -1,24 +1,24 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Merge request rebasing' do - it 'user rebases source branch of merge request' do + context "Create" do + describe "Merge request rebasing" do + it "user rebases source branch of merge request" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - project = Resource::Project.fabricate! do |project| + project = Resource::Project.fabricate! { |project| project.name = "only-fast-forward" - end + } project.visit! Page::Project::Menu.perform(&:go_to_settings) Page::Project::Settings::MergeRequest.perform(&:enable_ff_only) - merge_request = Resource::MergeRequest.fabricate! do |merge_request| + merge_request = Resource::MergeRequest.fabricate! { |merge_request| merge_request.project = project - merge_request.title = 'Needs rebasing' - end + merge_request.title = "Needs rebasing" + } Resource::Repository::ProjectPush.fabricate! do |push| push.project = project @@ -31,7 +31,7 @@ module QA merge_request.visit! Page::MergeRequest::Show.perform do |merge_request| - expect(merge_request).to have_content('Needs rebasing') + expect(merge_request).to have_content("Needs rebasing") expect(merge_request).not_to be_fast_forward_possible expect(merge_request).not_to have_merge_button diff --git a/qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb b/qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb index f146636c49a..0cf01b155b2 100644 --- a/qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/merge_request/squash_merge_request_spec.rb @@ -2,33 +2,33 @@ module QA # Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/31 - context 'Create' do - describe 'Merge request squashing' do - it 'user squashes commits while merging' do + context "Create" do + describe "Merge request squashing" do + it "user squashes commits while merging" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - project = Resource::Project.fabricate! do |project| + project = Resource::Project.fabricate! { |project| project.name = "squash-before-merge" - end + } - merge_request = Resource::MergeRequest.fabricate! do |merge_request| + merge_request = Resource::MergeRequest.fabricate! { |merge_request| merge_request.project = project - merge_request.title = 'Squashing commits' - end + merge_request.title = "Squashing commits" + } Resource::Repository::ProjectPush.fabricate! do |push| push.project = project - push.commit_message = 'to be squashed' + push.commit_message = "to be squashed" push.branch_name = merge_request.source_branch push.new_branch = false - push.file_name = 'other.txt' + push.file_name = "other.txt" push.file_content = "Test with unicode characters ❤✓€❄" end merge_request.visit! - expect(page).to have_text('to be squashed') + expect(page).to have_text("to be squashed") Page::MergeRequest::Show.perform do |merge_request_page| merge_request_page.mark_to_squash diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb index de5c535c757..0bbbb9a3f07 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_file_template_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'File templates' do + context "Create" do + describe "File templates" do include Runtime::Fixtures def login @@ -13,17 +13,17 @@ module QA before(:all) do login - @project = Resource::Project.fabricate! do |project| - project.name = 'file-template-project' - project.description = 'Add file templates via the Files view' - end + @project = Resource::Project.fabricate! { |project| + project.name = "file-template-project" + project.description = "Add file templates via the Files view" + } # There's no 'New File' dropdown when the project is blank, so we first # add a dummy file so that the dropdown will appear Resource::File.fabricate! do |file| file.project = @project - file.name = 'README.md' - file.content = '# Readme' + file.name = "README.md" + file.content = "# Readme" end Page::Main::Menu.perform(&:sign_out) @@ -31,29 +31,29 @@ module QA templates = [ { - file_name: '.gitignore', - name: 'Android', - api_path: 'gitignores', - api_key: 'Android' + file_name: ".gitignore", + name: "Android", + api_path: "gitignores", + api_key: "Android", }, { - file_name: '.gitlab-ci.yml', - name: 'Julia', - api_path: 'gitlab_ci_ymls', - api_key: 'Julia' + file_name: ".gitlab-ci.yml", + name: "Julia", + api_path: "gitlab_ci_ymls", + api_key: "Julia", }, { - file_name: 'Dockerfile', - name: 'Python', - api_path: 'dockerfiles', - api_key: 'Python' + file_name: "Dockerfile", + name: "Python", + api_path: "dockerfiles", + api_key: "Python", }, { - file_name: 'LICENSE', - name: 'Mozilla Public License 2.0', - api_path: 'licenses', - api_key: 'mpl-2.0' - } + file_name: "LICENSE", + name: "Mozilla Public License 2.0", + api_path: "licenses", + api_key: "mpl-2.0", + }, ] templates.each do |template| @@ -68,15 +68,15 @@ module QA page.select_template template[:file_name], template[:name] end - expect(page).to have_content('Template applied') - expect(page).to have_button('Undo') + expect(page).to have_content("Template applied") + expect(page).to have_button("Undo") expect(page).to have_content(content[0..100]) Page::File::Form.perform(&:commit_changes) - expect(page).to have_content('The file has been successfully created.') + expect(page).to have_content("The file has been successfully created.") expect(page).to have_content(template[:file_name]) - expect(page).to have_content('Add new file') + expect(page).to have_content("Add new file") expect(page).to have_content(content[0..100]) end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_list_delete_branches_spec.rb index 8e181eb28c6..ee9925040c3 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 @@ -1,15 +1,15 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Create, list, and delete branches via web' do - master_branch = 'master' - second_branch = 'second-branch' - third_branch = 'third-branch' - file_1_master = 'file.txt' - file_2_master = 'other-file.txt' - file_second_branch = 'file-2.txt' - file_third_branch = 'file-3.txt' + context "Create" do + describe "Create, list, and delete branches via web" do + master_branch = "master" + second_branch = "second-branch" + third_branch = "third-branch" + file_1_master = "file.txt" + file_2_master = "other-file.txt" + file_second_branch = "file-2.txt" + file_third_branch = "file-3.txt" first_commit_message_of_master_branch = "Add #{file_1_master}" second_commit_message_of_master_branch = "Add #{file_2_master}" commit_message_of_second_branch = "Add #{file_second_branch}" @@ -19,10 +19,10 @@ module QA Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - project = Resource::Project.fabricate! do |proj| - proj.name = 'project-qa-test' - proj.description = 'project for qa test' - end + project = Resource::Project.fabricate! { |proj| + proj.name = "project-qa-test" + proj.description = "project for qa test" + } Git::Repository.perform do |repository| repository.uri = project.repository_http_location.uri @@ -31,11 +31,11 @@ module QA repository.act do clone - configure_identity('GitLab QA', 'root@gitlab.com') - commit_file(file_1_master, 'Test file content', first_commit_message_of_master_branch) + configure_identity("GitLab QA", "root@gitlab.com") + commit_file(file_1_master, "Test file content", first_commit_message_of_master_branch) push_changes checkout(second_branch, new_branch: true) - commit_file(file_second_branch, 'File 2 content', commit_message_of_second_branch) + commit_file(file_second_branch, "File 2 content", commit_message_of_second_branch) push_changes(second_branch) checkout(master_branch) # This second commit on master is needed for the master branch to be ahead @@ -43,12 +43,12 @@ module QA # show the 'merged' badge on it. # Refer to the below issue note: # https://gitlab.com/gitlab-org/gitlab-ce/issues/55524#note_126100848 - commit_file(file_2_master, 'Other test file content', second_commit_message_of_master_branch) + commit_file(file_2_master, "Other test file content", second_commit_message_of_master_branch) push_changes merge(second_branch) push_changes checkout(third_branch, new_branch: true) - commit_file(file_third_branch, 'File 3 content', commit_message_of_third_branch) + commit_file(file_third_branch, "File 3 content", commit_message_of_third_branch) push_changes(third_branch) end end @@ -56,7 +56,7 @@ module QA project.visit! end - it 'branches are correctly listed after CRUD operations' do + it "branches are correctly listed after CRUD operations" do Page::Project::Menu.perform(&:click_repository_branches) expect(page).to have_content(master_branch) @@ -67,7 +67,7 @@ module QA expect(page).to have_content(commit_message_of_third_branch) Page::Project::Branches::Show.perform do |branches| - expect(branches).to have_branch_with_badge(second_branch, 'merged') + expect(branches).to have_branch_with_badge(second_branch, "merged") end Page::Project::Branches::Show.perform do |branches_view| @@ -79,7 +79,7 @@ module QA Page::Project::Branches::Show.perform(&:delete_merged_branches) expect(page).to have_content( - 'Merged branches are being deleted. This can take some time depending on the number of branches. Please refresh the page to see changes.' + "Merged branches are being deleted. This can take some time depending on the number of branches. Please refresh the page to see changes." ) page.refresh diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb index ff879fdeb16..bb2792e317d 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/add_ssh_key_spec.rb @@ -1,17 +1,17 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'SSH keys support' do + context "Create" do + describe "SSH keys support" do let(:key_title) { "key for ssh tests #{Time.now.to_f}" } - it 'user adds and then removes an SSH key', :smoke do + it "user adds and then removes an SSH key", :smoke do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } - key = Resource::SSHKey.fabricate! do |resource| + key = Resource::SSHKey.fabricate! { |resource| resource.title = key_title - end + } expect(page).to have_content("Title: #{key_title}") expect(page).to have_content(key.fingerprint) 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 f2584f55a60..2f9dd8ba399 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 @@ -1,16 +1,16 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Git clone over HTTP', :ldap_no_tls do + context "Create" do + describe "Git clone over HTTP", :ldap_no_tls do before(:all) do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - @project = Resource::Project.fabricate! do |scenario| - scenario.name = 'project-with-code' - scenario.description = 'project for git clone tests' - end + @project = Resource::Project.fabricate! { |scenario| + scenario.name = "project-with-code" + scenario.description = "project for git clone tests" + } @project.visit! Git::Repository.perform do |repository| @@ -19,16 +19,16 @@ module QA repository.act do clone - configure_identity('GitLab QA', 'root@gitlab.com') - commit_file('test.rb', 'class Test; end', 'Add Test class') - commit_file('README.md', '# Test', 'Add Readme') + configure_identity("GitLab QA", "root@gitlab.com") + commit_file("test.rb", "class Test; end", "Add Test class") + commit_file("README.md", "# Test", "Add Readme") push_changes end end @project.wait_for_push_new_branch end - it 'user performs a deep clone' do + it "user performs a deep clone" do Git::Repository.perform do |repository| repository.uri = @project.repository_http_location.uri repository.use_default_credentials @@ -39,7 +39,7 @@ module QA end end - it 'user performs a shallow clone' do + it "user performs a shallow clone" do Git::Repository.perform do |repository| repository.uri = @project.repository_http_location.uri repository.use_default_credentials @@ -47,7 +47,7 @@ module QA repository.shallow_clone expect(repository.commits.size).to eq 1 - expect(repository.commits.first).to include 'Add Readme' + expect(repository.commits.first).to include "Add Readme" end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb index 46346d1b984..86868d6ac7e 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/create_edit_delete_file_via_web_spec.rb @@ -1,16 +1,16 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Files management' do - it 'user creates, edits and deletes a file via the Web' do + context "Create" do + describe "Files management" do + it "user creates, edits and deletes a file via the Web" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } # Create - file_name = 'QA Test - File name' - file_content = 'QA Test - File content' - commit_message_for_create = 'QA Test - Create new file' + file_name = "QA Test - File name" + file_content = "QA Test - File content" + commit_message_for_create = "QA Test - Create new file" Resource::File.fabricate! do |file| file.name = file_name @@ -18,14 +18,14 @@ module QA file.commit_message = commit_message_for_create end - expect(page).to have_content('The file has been successfully created.') + expect(page).to have_content("The file has been successfully created.") expect(page).to have_content(file_name) expect(page).to have_content(file_content) expect(page).to have_content(commit_message_for_create) # Edit - updated_file_content = 'QA Test - Updated file content' - commit_message_for_update = 'QA Test - Update file' + updated_file_content = "QA Test - Updated file content" + commit_message_for_update = "QA Test - Update file" Page::File::Show.act { click_edit } @@ -36,12 +36,12 @@ module QA commit_changes end - expect(page).to have_content('Your changes have been successfully committed.') + expect(page).to have_content("Your changes have been successfully committed.") expect(page).to have_content(updated_file_content) expect(page).to have_content(commit_message_for_update) # Delete - commit_message_for_delete = 'QA Test - Delete file' + commit_message_for_delete = "QA Test - Delete file" Page::File::Show.act do click_delete @@ -49,7 +49,7 @@ module QA click_delete_file end - expect(page).to have_content('The file has been successfully deleted.') + expect(page).to have_content("The file has been successfully deleted.") expect(page).to have_content(commit_message_for_delete) expect(page).to have_no_content(file_name) end 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 d1535d6519d..2525001f0fb 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 @@ -1,27 +1,27 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Push over HTTP using Git protocol version 2', :requires_git_protocol_v2 do - it 'user pushes to the repository' do + context "Create" do + describe "Push over HTTP using Git protocol version 2", :requires_git_protocol_v2 do + it "user pushes to the repository" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) # Create a project to push to - project = Resource::Project.fabricate! do |project| - project.name = 'git-protocol-project' - end + project = Resource::Project.fabricate! { |project| + project.name = "git-protocol-project" + } - file_name = 'README.md' - file_content = 'Test Git protocol v2' - git_protocol = '2' + file_name = "README.md" + file_content = "Test Git protocol v2" + git_protocol = "2" git_protocol_reported = nil # Use Git to clone the project, push a file to it, and then check the # supported Git protocol Git::Repository.perform do |repository| - username = 'GitLab QA' - email = 'root@gitlab.com' + username = "GitLab QA" + email = "root@gitlab.com" repository.uri = project.repository_http_location.uri repository.use_default_credentials @@ -31,7 +31,8 @@ module QA git_protocol_reported = repository.push_with_git_protocol( git_protocol, file_name, - file_content) + file_content + ) end project.visit! 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 48800cc81e5..d3d70ed7252 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 @@ -1,8 +1,8 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Push over SSH using Git protocol version 2', :requires_git_protocol_v2 do + context "Create" do + describe "Push over SSH using Git protocol version 2", :requires_git_protocol_v2 do # Note: If you run this test against GDK make sure you've enabled sshd and # enabled setting the Git protocol by adding `AcceptEnv GIT_PROTOCOL` to # `sshd_config` @@ -36,22 +36,22 @@ module QA end end - it 'user pushes to the repository' do + it "user pushes to the repository" do # Create a project to push to - project = Resource::Project.fabricate! do |project| - project.name = 'git-protocol-project' - end + project = Resource::Project.fabricate! { |project| + project.name = "git-protocol-project" + } - file_name = 'README.md' - file_content = 'Test Git protocol v2' - git_protocol = '2' + file_name = "README.md" + file_content = "Test Git protocol v2" + git_protocol = "2" git_protocol_reported = nil # Use Git to clone the project, push a file to it, and then check the # supported Git protocol Git::Repository.perform do |repository| - username = 'GitLab QA' - email = 'root@gitlab.com' + username = "GitLab QA" + email = "root@gitlab.com" repository.uri = project.repository_ssh_location.uri @@ -63,7 +63,8 @@ module QA git_protocol_reported = repository.push_with_git_protocol( git_protocol, file_name, - file_content) + file_content + ) ensure repository.delete_ssh_key end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_http_private_token_spec.rb index 1f4fb08accc..a3ecb5ba97a 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 @@ -1,9 +1,9 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Git push over HTTP', :ldap_no_tls do - it 'user using a personal access token pushes code to the repository' do + context "Create" do + describe "Git push over HTTP", :ldap_no_tls do + it "user using a personal access token pushes code to the repository" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) @@ -14,19 +14,19 @@ module QA user.password = access_token end - push = Resource::Repository::ProjectPush.fabricate! do |push| + push = Resource::Repository::ProjectPush.fabricate! { |push| push.user = user - push.file_name = 'README.md' - push.file_content = '# This is a test project' - push.commit_message = 'Add README.md' - end + push.file_name = "README.md" + push.file_content = "# This is a test project" + push.commit_message = "Add README.md" + } push.project.visit! Page::Project::Show.perform(&:wait_for_viewers_to_load) - expect(page).to have_content('README.md') - expect(page).to have_content('This is a test project') + expect(page).to have_content("README.md") + expect(page).to have_content("This is a test project") end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb index 99601e3d230..45506e19e62 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_mirroring_over_http_spec.rb @@ -2,23 +2,23 @@ module QA # https://gitlab.com/gitlab-org/quality/staging/issues/40 - context 'Create', :quarantine do - describe 'Push mirror a repository over HTTP' do - it 'configures and syncs a (push) mirrored repository' do + context "Create", :quarantine do + describe "Push mirror a repository over HTTP" do + it "configures and syncs a (push) mirrored repository" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - target_project = Resource::Project.fabricate! do |project| - project.name = 'push-mirror-target-project' - end + target_project = Resource::Project.fabricate! { |project| + project.name = "push-mirror-target-project" + } target_project_uri = target_project.repository_http_location.uri target_project_uri.user = Runtime::User.username - source_project_push = Resource::Repository::ProjectPush.fabricate! do |push| - push.file_name = 'README.md' - push.file_content = '# This is a test project' - push.commit_message = 'Add README.md' - end + source_project_push = Resource::Repository::ProjectPush.fabricate! { |push| + push.file_name = "README.md" + push.file_content = "# This is a test project" + push.commit_message = "Add README.md" + } source_project_push.project.visit! Page::Project::Menu.perform(&:click_repository_settings) @@ -36,8 +36,8 @@ module QA # Check that the target project has the commit from the source target_project.visit! - expect(page).to have_content('README.md') - expect(page).to have_content('This is a test project') + expect(page).to have_content("README.md") + expect(page).to have_content("This is a test project") end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb index 243f0b83b77..291c1015eb3 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_file_size_spec.rb @@ -2,14 +2,14 @@ module QA # Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/37 - context 'Create', :quarantine do - describe 'push after setting the file size limit via admin/application_settings' do + context "Create", :quarantine do + describe "push after setting the file size limit via admin/application_settings" do before(:all) do - push = Resource::Repository::ProjectPush.fabricate! do |p| - p.file_name = 'README.md' - p.file_content = '# This is a test project' - p.commit_message = 'Add README.md' - end + push = Resource::Repository::ProjectPush.fabricate! { |p| + p.file_name = "README.md" + p.file_content = "# This is a test project" + p.commit_message = "Add README.md" + } @project = push.project end @@ -25,23 +25,23 @@ module QA Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - set_file_size_limit('') + set_file_size_limit("") end - it 'push successful when the file size is under the limit' do + it "push successful when the file size is under the limit" do set_file_size_limit(5) expect(page).to have_content("Application settings saved successfully") - push = push_new_file('oversize_file_1.bin', wait_for_push: true) - expect(push.output).not_to have_content 'remote: fatal: pack exceeds maximum allowed size' + push = push_new_file("oversize_file_1.bin", wait_for_push: true) + expect(push.output).not_to have_content "remote: fatal: pack exceeds maximum allowed size" end - it 'push fails when the file size is above the limit' do + it "push fails when the file size is above the limit" do set_file_size_limit(1) expect(page).to have_content("Application settings saved successfully") - push = push_new_file('oversize_file_2.bin', wait_for_push: false) - expect(push.output).to have_content 'remote: fatal: pack exceeds maximum allowed size' + push = push_new_file("oversize_file_2.bin", wait_for_push: false) + expect(push.output).to have_content "remote: fatal: pack exceeds maximum allowed size" end def set_file_size_limit(limit) @@ -63,7 +63,7 @@ module QA p.project = @project p.file_name = file_name p.file_content = SecureRandom.random_bytes(2000000) - p.commit_message = 'Adding a new file' + p.commit_message = "Adding a new file" p.wait_for_push = wait_for_push end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb index 58e6c160a3a..d369152acd0 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_over_http_spec.rb @@ -1,21 +1,21 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Git push over HTTP', :ldap_no_tls do - it 'user pushes code to the repository' do + context "Create" do + describe "Git push over HTTP", :ldap_no_tls do + it "user pushes code to the repository" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - project_push = Resource::Repository::ProjectPush.fabricate! do |push| - push.file_name = 'README.md' - push.file_content = '# This is a test project' - push.commit_message = 'Add README.md' - end + project_push = Resource::Repository::ProjectPush.fabricate! { |push| + push.file_name = "README.md" + push.file_content = "# This is a test project" + push.commit_message = "Add README.md" + } project_push.project.visit! - expect(page).to have_content('README.md') - expect(page).to have_content('This is a test project') + expect(page).to have_content("README.md") + expect(page).to have_content("This is a test project") end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb index 4464fb812b7..b3fb52a63a9 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/push_protected_branch_spec.rb @@ -1,13 +1,13 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Protected branch support', :ldap_no_tls do - let(:branch_name) { 'protected-branch' } - let(:commit_message) { 'Protected push commit message' } + context "Create" do + describe "Protected branch support", :ldap_no_tls do + let(:branch_name) { "protected-branch" } + let(:commit_message) { "Protected push commit message" } let(:project) do Resource::Project.fabricate! do |resource| - resource.name = 'protected-branch-project' + resource.name = "protected-branch-project" end end @@ -20,11 +20,11 @@ module QA # We need to clear localStorage because we're using it for the dropdown, # and capybara doesn't do this for us. # https://github.com/teamcapybara/capybara/issues/1702 - Capybara.execute_script 'localStorage.clear()' + Capybara.execute_script "localStorage.clear()" end - context 'when developers and maintainers are allowed to push to a protected branch' do - it 'user with push rights successfully pushes to the protected branch' do + context "when developers and maintainers are allowed to push to a protected branch" do + it "user with push rights successfully pushes to the protected branch" do create_protected_branch(allow_to_push: true) push = push_new_file(branch_name) @@ -33,16 +33,16 @@ module QA end end - context 'when developers and maintainers are not allowed to push to a protected branch' do - it 'user without push rights fails to push to the protected branch' do + context "when developers and maintainers are not allowed to push to a protected branch" do + it "user without push rights fails to push to the protected branch" do create_protected_branch(allow_to_push: false) push = push_new_file(branch_name) expect(push.output) - .to match(/remote\: GitLab\: You are not allowed to push code to protected branches on this project/) + .to match(/remote\: GitLab\: You are not allowed to push code to protected branches on this project/) expect(push.output) - .to match(/\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/) + .to match(/\[remote rejected\] #{branch_name} -> #{branch_name} \(pre-receive hook declined\)/) end end @@ -58,9 +58,9 @@ module QA def push_new_file(branch) Resource::Repository::ProjectPush.fabricate! do |resource| resource.project = project - resource.file_name = 'new_file.md' - resource.file_content = '# This is a new file' - resource.commit_message = 'Add new_file.md' + resource.file_name = "new_file.md" + resource.file_content = "# This is a new file" + resource.commit_message = "Add new_file.md" resource.branch_name = branch_name resource.new_branch = false resource.wait_for_push = false diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/use_ssh_key_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/use_ssh_key_spec.rb index 7223831d96f..d1dd67444b0 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/use_ssh_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/use_ssh_key_spec.rb @@ -1,32 +1,32 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'SSH key support' do + context "Create" do + describe "SSH key support" do # Note: If you run this test against GDK make sure you've enabled sshd # See: https://gitlab.com/gitlab-org/gitlab-qa/blob/master/docs/run_qa_against_gdk.md let(:key_title) { "key for ssh tests #{Time.now.to_f}" } - it 'user adds an ssh key and pushes code to the repository' do + it "user adds an ssh key and pushes code to the repository" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - key = Resource::SSHKey.fabricate! do |resource| + key = Resource::SSHKey.fabricate! { |resource| resource.title = key_title - end + } - project_push = Resource::Repository::ProjectPush.fabricate! do |push| + project_push = Resource::Repository::ProjectPush.fabricate! { |push| push.ssh_key = key - push.file_name = 'README.md' - push.file_content = '# Test Use SSH Key' - push.commit_message = 'Add README.md' - end + push.file_name = "README.md" + push.file_content = "# Test Use SSH Key" + push.commit_message = "Add README.md" + } project_push.project.visit! - expect(page).to have_content('README.md') - expect(page).to have_content('Test Use SSH Key') + expect(page).to have_content("README.md") + expect(page).to have_content("Test Use SSH Key") Page::Main::Menu.perform(&:go_to_profile_settings) Page::Profile::Menu.perform(&:click_ssh_keys) diff --git a/qa/qa/specs/features/browser_ui/3_create/repository/user_views_raw_diff_patch_requests_spec.rb b/qa/qa/specs/features/browser_ui/3_create/repository/user_views_raw_diff_patch_requests_spec.rb index b862a7bd1ed..01fcc7a9190 100644 --- a/qa/qa/specs/features/browser_ui/3_create/repository/user_views_raw_diff_patch_requests_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/repository/user_views_raw_diff_patch_requests_spec.rb @@ -1,30 +1,30 @@ # frozen_string_literal: true module QA - context 'Create' do + context "Create" do # failure reported: https://gitlab.com/gitlab-org/quality/nightly/issues/42 # also failing in staging until the fix is picked into the next release: # https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24533 - describe 'Commit data', :quarantine do + describe "Commit data", :quarantine do before(:context) do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - project_push = Resource::Repository::ProjectPush.fabricate! do |push| - push.file_name = 'README.md' - push.file_content = '# This is a test project' - push.commit_message = 'Add README.md' - end + project_push = Resource::Repository::ProjectPush.fabricate! { |push| + push.file_name = "README.md" + push.file_content = "# This is a test project" + push.commit_message = "Add README.md" + } @project = project_push.project # first file added has no parent commit, thus no diff data # add second file to repo to enable diff from initial commit - @commit_message = 'Add second file' + @commit_message = "Add second file" Page::Project::Show.perform(&:create_new_file!) Page::File::Form.perform do |f| - f.add_name('second') - f.add_content('second file content') + f.add_name("second") + f.add_content("second file content") f.add_commit_message(@commit_message) f.commit_changes end @@ -38,30 +38,30 @@ module QA end def raw_content - find('pre').text + find("pre").text end - it 'user views raw email patch' do - user = Resource::User.fabricate_via_api! do |user| + it "user views raw email patch" do + user = Resource::User.fabricate_via_api! { |user| user.username = Runtime::User.username - end + } view_commit Page::Project::Commit::Show.perform(&:select_email_patches) expect(page).to have_content("From: #{user.name} <#{user.public_email}>") - expect(page).to have_content('Subject: [PATCH] Add second file') - expect(page).to have_content('diff --git a/second b/second') + expect(page).to have_content("Subject: [PATCH] Add second file") + expect(page).to have_content("diff --git a/second b/second") end - it 'user views raw commit diff' do + it "user views raw commit diff" do view_commit Page::Project::Commit::Show.perform(&:select_plain_diff) - expect(raw_content).to start_with('diff --git a/second b/second') - expect(page).to have_content('+second file content') + expect(raw_content).to start_with("diff --git a/second b/second") + expect(page).to have_content("+second file content") end end end diff --git a/qa/qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb b/qa/qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb index f176ec31abd..82a3a664642 100644 --- a/qa/qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/web_ide/add_file_template_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Web IDE file templates' do + context "Create" do + describe "Web IDE file templates" do include Runtime::Fixtures def login @@ -13,18 +13,18 @@ module QA before(:all) do login - @project = Resource::Project.fabricate! do |project| - project.name = 'file-template-project' - project.description = 'Add file templates via the Web IDE' - end + @project = Resource::Project.fabricate! { |project| + project.name = "file-template-project" + project.description = "Add file templates via the Web IDE" + } @project.visit! # Add a file via the regular Files view because the Web IDE isn't # available unless there is a file present Page::Project::Show.perform(&:create_first_new_file!) Page::File::Form.perform do |page| - page.add_name('dummy') - page.add_content('Enable the Web IDE') + page.add_name("dummy") + page.add_content("Enable the Web IDE") page.commit_changes end @@ -33,29 +33,29 @@ module QA templates = [ { - file_name: '.gitignore', - name: 'Android', - api_path: 'gitignores', - api_key: 'Android' + file_name: ".gitignore", + name: "Android", + api_path: "gitignores", + api_key: "Android", }, { - file_name: '.gitlab-ci.yml', - name: 'Julia', - api_path: 'gitlab_ci_ymls', - api_key: 'Julia' + file_name: ".gitlab-ci.yml", + name: "Julia", + api_path: "gitlab_ci_ymls", + api_key: "Julia", }, { - file_name: 'Dockerfile', - name: 'Python', - api_path: 'dockerfiles', - api_key: 'Python' + file_name: "Dockerfile", + name: "Python", + api_path: "dockerfiles", + api_key: "Python", }, { - file_name: 'LICENSE', - name: 'Mozilla Public License 2.0', - api_path: 'licenses', - api_key: 'mpl-2.0' - } + file_name: "LICENSE", + name: "Mozilla Public License 2.0", + api_path: "licenses", + api_key: "mpl-2.0", + }, ] templates.each do |template| @@ -72,7 +72,7 @@ module QA expect(page.has_file?(template[:file_name])).to be_truthy end - expect(page).to have_button('Undo') + expect(page).to have_button("Undo") expect(page).to have_content(content[0..100]) Page::Project::WebIDE::Edit.perform(&:commit_changes) diff --git a/qa/qa/specs/features/browser_ui/3_create/wiki/create_edit_clone_push_wiki_spec.rb b/qa/qa/specs/features/browser_ui/3_create/wiki/create_edit_clone_push_wiki_spec.rb index 29589ec870a..423d294ff6b 100644 --- a/qa/qa/specs/features/browser_ui/3_create/wiki/create_edit_clone_push_wiki_spec.rb +++ b/qa/qa/specs/features/browser_ui/3_create/wiki/create_edit_clone_push_wiki_spec.rb @@ -1,24 +1,24 @@ # frozen_string_literal: true module QA - context 'Create' do - describe 'Wiki management' do + context "Create" do + describe "Wiki management" do def validate_content(content) - expect(page).to have_content('Wiki was successfully updated') + expect(page).to have_content("Wiki was successfully updated") expect(page).to have_content(/#{content}/) end - it 'user creates, edits, clones, and pushes to the wiki' do + it "user creates, edits, clones, and pushes to the wiki" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - wiki = Resource::Wiki.fabricate! do |resource| - resource.title = 'Home' - resource.content = '# My First Wiki Content' - resource.message = 'Update home' - end + wiki = Resource::Wiki.fabricate! { |resource| + resource.title = "Home" + resource.content = "# My First Wiki Content" + resource.message = "Update home" + } - validate_content('My First Wiki Content') + validate_content("My First Wiki Content") Page::Project::Wiki::Edit.perform(&:go_to_edit_page) Page::Project::Wiki::New.perform do |page| @@ -26,17 +26,17 @@ module QA page.save_changes end - validate_content('My Second Wiki Content') + validate_content("My Second Wiki Content") Resource::Repository::WikiPush.fabricate! do |push| push.wiki = wiki - push.file_name = 'Home.md' - push.file_content = '# My Third Wiki Content' - push.commit_message = 'Update Home.md' + push.file_name = "Home.md" + push.file_content = "# My Third Wiki Content" + push.commit_message = "Update Home.md" end Page::Project::Menu.perform(&:click_wiki) - expect(page).to have_content('My Third Wiki Content') + expect(page).to have_content("My Third Wiki Content") end end end diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb index e444bc7ef1b..c685447e6de 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/add_ci_variable_spec.rb @@ -2,25 +2,25 @@ module QA # Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/30 - context 'Verify', :quarantine do - describe 'CI variable support' do - it 'user adds a CI variable' do + context "Verify", :quarantine do + describe "CI variable support" do + it "user adds a CI variable" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } Resource::CiVariable.fabricate! do |resource| - resource.key = 'VARIABLE_KEY' - resource.value = 'some CI variable' + resource.key = "VARIABLE_KEY" + resource.value = "some CI variable" end Page::Project::Settings::CICD.perform do |settings| settings.expand_ci_variables do |page| - expect(page).to have_field(with: 'VARIABLE_KEY') - expect(page).not_to have_field(with: 'some CI variable') + expect(page).to have_field(with: "VARIABLE_KEY") + expect(page).not_to have_field(with: "some CI variable") page.reveal_variables - expect(page).to have_field(with: 'some CI variable') + expect(page).to have_field(with: "some CI variable") 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 2238d6c382e..316a34e56de 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/pipeline/create_and_process_pipeline_spec.rb @@ -1,22 +1,22 @@ # frozen_string_literal: true module QA - context 'Verify', :orchestrated, :docker do - describe 'Pipeline creation and processing' do + context "Verify", :orchestrated, :docker do + describe "Pipeline creation and processing" do let(:executor) { "qa-runner-#{Time.now.to_i}" } after do Service::Runner.new(executor).remove! end - it 'users creates a pipeline which gets processed' do + it "users creates a pipeline which gets processed" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) - project = Resource::Project.fabricate! do |project| - project.name = 'project-with-pipelines' - project.description = 'Project with CI/CD Pipelines.' - end + project = Resource::Project.fabricate! { |project| + project.name = "project-with-pipelines" + project.description = "Project with CI/CD Pipelines." + } Resource::Runner.fabricate! do |runner| runner.project = project @@ -26,8 +26,8 @@ module QA Resource::Repository::ProjectPush.fabricate! do |push| push.project = project - push.file_name = '.gitlab-ci.yml' - push.commit_message = 'Add .gitlab-ci.yml' + push.file_name = ".gitlab-ci.yml" + push.commit_message = "Add .gitlab-ci.yml" push.file_content = <<~EOF test-success: tags: @@ -60,24 +60,24 @@ module QA EOF end - expect(page).to have_content('Add .gitlab-ci.yml') + expect(page).to have_content("Add .gitlab-ci.yml") Page::Project::Menu.perform(&:click_ci_cd_pipelines) - expect(page).to have_content('All 1') - expect(page).to have_content('Add .gitlab-ci.yml') + expect(page).to have_content("All 1") + expect(page).to have_content("Add .gitlab-ci.yml") - puts 'Waiting for the runner to process the pipeline' + puts "Waiting for the runner to process the pipeline" sleep 15 # Runner should process all jobs within 15 seconds. Page::Project::Pipeline::Index.perform(&:go_to_latest_pipeline) Page::Project::Pipeline::Show.perform do |pipeline| expect(pipeline).to be_running - expect(pipeline).to have_build('test-success', status: :success) - expect(pipeline).to have_build('test-failure', status: :failed) - expect(pipeline).to have_build('test-tags', status: :pending) - expect(pipeline).to have_build('test-artifacts', status: :success) + expect(pipeline).to have_build("test-success", status: :success) + expect(pipeline).to have_build("test-failure", status: :failed) + expect(pipeline).to have_build("test-tags", status: :pending) + expect(pipeline).to have_build("test-artifacts", status: :success) end end end diff --git a/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb index 3af7db751e7..b75c7612aa1 100644 --- a/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb +++ b/qa/qa/specs/features/browser_ui/4_verify/runner/register_runner_spec.rb @@ -1,15 +1,15 @@ # frozen_string_literal: true module QA - context 'Verify', :docker do - describe 'Runner registration' do + context "Verify", :docker do + describe "Runner registration" do let(:executor) { "qa-runner-#{Time.now.to_i}" } after do Service::Runner.new(executor).remove! end - it 'user registers a new specific runner' do + it "user registers a new specific runner" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } diff --git a/qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb b/qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb index aa01e5a618e..db8f0131135 100644 --- a/qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/deploy_key/add_deploy_key_spec.rb @@ -2,20 +2,20 @@ module QA # Failure issue: https://gitlab.com/gitlab-org/quality/staging/issues/26 - context 'Release', :quarantine do - describe 'Deploy key creation' do - it 'user adds a deploy key' do + context "Release", :quarantine do + describe "Deploy key creation" do + it "user adds a deploy key" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) key = Runtime::Key::RSA.new - deploy_key_title = 'deploy key title' + deploy_key_title = "deploy key title" deploy_key_value = key.public_key - deploy_key = Resource::DeployKey.fabricate! do |resource| + deploy_key = Resource::DeployKey.fabricate! { |resource| resource.title = deploy_key_title resource.key = deploy_key_value - end + } expect(deploy_key.fingerprint).to eq key.fingerprint diff --git a/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb b/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb index 3f65eabc756..904a9ebee06 100644 --- a/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/deploy_key/clone_using_deploy_key_spec.rb @@ -1,11 +1,11 @@ # frozen_string_literal: true -require 'digest/sha1' +require "digest/sha1" module QA # Failure issue: https://gitlab.com/gitlab-org/quality/nightly/issues/70 - context 'Release', :docker, :quarantine do - describe 'Git clone using a deploy key' do + context "Release", :docker, :quarantine do + describe "Git clone using a deploy key" do def login Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) @@ -16,9 +16,9 @@ module QA @runner_name = "qa-runner-#{Time.now.to_i}" - @project = Resource::Project.fabricate! do |resource| - resource.name = 'deploy-key-clone-project' - end + @project = Resource::Project.fabricate! { |resource| + resource.name = "deploy-key-clone-project" + } @repository_location = @project.repository_ssh_location @@ -26,7 +26,7 @@ module QA resource.project = @project resource.name = @runner_name resource.tags = %w[qa docker] - resource.image = 'gitlab/gitlab-runner:ubuntu' + resource.image = "gitlab/gitlab-runner:ubuntu" end Page::Main::Menu.perform(&:sign_out) @@ -39,7 +39,7 @@ module QA keys = [ [Runtime::Key::RSA, 8192], [Runtime::Key::ECDSA, 521], - [Runtime::Key::ED25519] + [Runtime::Key::ED25519], ] keys.each do |(key_class, bits)| @@ -63,26 +63,26 @@ module QA end gitlab_ci = <<~YAML - cat-config: - script: - - mkdir -p ~/.ssh - - ssh-keyscan -p #{@repository_location.port} #{@repository_location.host} >> ~/.ssh/known_hosts - - eval $(ssh-agent -s) - - ssh-add -D - - echo "$#{deploy_key_name}" | ssh-add - - - git clone #{@repository_location.git_uri} - - cd #{@project.name} - - git checkout #{deploy_key_name} - - sha1sum .gitlab-ci.yml - tags: - - qa - - docker + cat-config: + script: + - mkdir -p ~/.ssh + - ssh-keyscan -p #{@repository_location.port} #{@repository_location.host} >> ~/.ssh/known_hosts + - eval $(ssh-agent -s) + - ssh-add -D + - echo "$#{deploy_key_name}" | ssh-add - + - git clone #{@repository_location.git_uri} + - cd #{@project.name} + - git checkout #{deploy_key_name} + - sha1sum .gitlab-ci.yml + tags: + - qa + - docker YAML Resource::Repository::ProjectPush.fabricate! do |resource| resource.project = @project - resource.file_name = '.gitlab-ci.yml' - resource.commit_message = 'Add .gitlab-ci.yml' + resource.file_name = ".gitlab-ci.yml" + resource.commit_message = "Add .gitlab-ci.yml" resource.file_content = gitlab_ci resource.branch_name = deploy_key_name resource.new_branch = true diff --git a/qa/qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb b/qa/qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb index 9f34e4218c1..4b58f63dcd8 100644 --- a/qa/qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb +++ b/qa/qa/specs/features/browser_ui/6_release/deploy_token/add_deploy_token_spec.rb @@ -1,19 +1,19 @@ # frozen_string_literal: true module QA - context 'Release' do - describe 'Deploy token creation' do - it 'user adds a deploy token' do + context "Release" do + describe "Deploy token creation" do + it "user adds a deploy token" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } - deploy_token_name = 'deploy token name' + deploy_token_name = "deploy token name" deploy_token_expires_at = Date.today + 7 # 1 Week from now - deploy_token = Resource::DeployToken.fabricate! do |resource| + deploy_token = Resource::DeployToken.fabricate! { |resource| resource.name = deploy_token_name resource.expires_at = deploy_token_expires_at - end + } expect(deploy_token.username.length).to be > 0 expect(deploy_token.password.length).to be > 0 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 2aa386f35ce..fcc13a1c6d0 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 @@ -1,31 +1,31 @@ # frozen_string_literal: true -require 'pathname' +require "pathname" module QA # Transient failure issue: https://gitlab.com/gitlab-org/quality/nightly/issues/68 - context 'Configure' do + context "Configure" do def login Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) end - describe 'Auto DevOps support', :orchestrated, :kubernetes, :quarantine do - context 'when rbac is enabled' do + describe "Auto DevOps support", :orchestrated, :kubernetes, :quarantine do + context "when rbac is enabled" do before(:all) do login - @project = Resource::Project.fabricate! do |p| - p.name = Runtime::Env.auto_devops_project_name || 'project-with-autodevops' - p.description = 'Project with Auto DevOps' - end + @project = Resource::Project.fabricate! { |p| + p.name = Runtime::Env.auto_devops_project_name || "project-with-autodevops" + p.description = "Project with Auto DevOps" + } # Disable code_quality check in Auto DevOps pipeline as it takes # too long and times out the test Resource::CiVariable.fabricate! do |resource| resource.project = @project - resource.key = 'CODE_QUALITY_DISABLED' - resource.value = '1' + resource.key = "CODE_QUALITY_DISABLED" + resource.value = "1" end # Create Auto DevOps compatible repo @@ -33,8 +33,8 @@ module QA push.project = @project push.directory = Pathname .new(__dir__) - .join('../../../../../fixtures/auto_devops_rack') - push.commit_message = 'Create Auto DevOps compatible rack application' + .join("../../../../../fixtures/auto_devops_rack") + push.commit_message = "Create Auto DevOps compatible rack application" end # Create and connect K8s cluster @@ -53,13 +53,13 @@ module QA @cluster&.remove! end - it 'runs auto devops' do + it "runs auto devops" do @project.visit! Page::Project::Menu.perform(&:click_ci_cd_pipelines) Page::Project::Pipeline::Index.perform(&:go_to_latest_pipeline) Page::Project::Pipeline::Show.perform do |pipeline| - pipeline.go_to_job('build') + pipeline.go_to_job("build") end Page::Project::Job::Show.perform do |job| expect(job).to be_successful(timeout: 600) @@ -68,7 +68,7 @@ module QA end Page::Project::Pipeline::Show.perform do |pipeline| - pipeline.go_to_job('test') + pipeline.go_to_job("test") end Page::Project::Job::Show.perform do |job| expect(job).to be_successful(timeout: 600) @@ -77,7 +77,7 @@ module QA end Page::Project::Pipeline::Show.perform do |pipeline| - pipeline.go_to_job('production') + pipeline.go_to_job("production") end Page::Project::Job::Show.perform do |job| expect(job).to be_successful(timeout: 1200) @@ -87,21 +87,21 @@ module QA Page::Project::Menu.perform(&:click_operations_environments) Page::Project::Operations::Environments::Index.perform do |index| - index.go_to_environment('production') + index.go_to_environment("production") end Page::Project::Operations::Environments::Show.perform do |show| show.view_deployment do - expect(page).to have_content('Hello World!') + expect(page).to have_content("Hello World!") end end end - it 'user sets application secret variable and Auto DevOps passes it to container' do + it "user sets application secret variable and Auto DevOps passes it to container" do # Set an application secret CI variable (prefixed with K8S_SECRET_) Resource::CiVariable.fabricate! do |resource| resource.project = @project - resource.key = 'K8S_SECRET_OPTIONAL_MESSAGE' - resource.value = 'You can see this application secret' + resource.key = "K8S_SECRET_OPTIONAL_MESSAGE" + resource.value = "You can see this application secret" end # Our current Auto DevOps implementation won't update the production @@ -110,16 +110,16 @@ module QA # Workaround: push new code and use the resultant pipeline. Resource::Repository::ProjectPush.fabricate! do |push| push.project = @project - push.commit_message = 'Force a Deployment change by pushing new code' - push.file_name = 'new_file.txt' - push.file_content = 'new file contents' + push.commit_message = "Force a Deployment change by pushing new code" + push.file_name = "new_file.txt" + push.file_content = "new file contents" end Page::Project::Menu.perform(&:click_ci_cd_pipelines) Page::Project::Pipeline::Index.perform(&:go_to_latest_pipeline) Page::Project::Pipeline::Show.perform do |pipeline| - pipeline.go_to_job('build') + pipeline.go_to_job("build") end Page::Project::Job::Show.perform do |job| expect(job).to be_successful(timeout: 600) @@ -128,7 +128,7 @@ module QA end Page::Project::Pipeline::Show.perform do |pipeline| - pipeline.go_to_job('test') + pipeline.go_to_job("test") end Page::Project::Job::Show.perform do |job| expect(job).to be_successful(timeout: 600) @@ -137,7 +137,7 @@ module QA end Page::Project::Pipeline::Show.perform do |pipeline| - pipeline.go_to_job('production') + pipeline.go_to_job("production") end Page::Project::Job::Show.perform do |job| expect(job).to be_successful(timeout: 1200) @@ -146,27 +146,27 @@ module QA Page::Project::Menu.perform(&:click_operations_environments) Page::Project::Operations::Environments::Index.perform do |index| - index.go_to_environment('production') + index.go_to_environment("production") end Page::Project::Operations::Environments::Show.perform do |show| show.view_deployment do - expect(page).to have_content('Hello World!') - expect(page).to have_content('You can see this application secret') + expect(page).to have_content("Hello World!") + expect(page).to have_content("You can see this application secret") end end end end end - describe 'Auto DevOps', :smoke do - it 'enables AutoDevOps by default' do + describe "Auto DevOps", :smoke do + it "enables AutoDevOps by default" do login - project = Resource::Project.fabricate! do |p| - p.name = Runtime::Env.auto_devops_project_name || 'project-with-autodevops' - p.description = 'Project with AutoDevOps' - end + project = Resource::Project.fabricate! { |p| + p.name = Runtime::Env.auto_devops_project_name || "project-with-autodevops" + p.description = "Project with AutoDevOps" + } project.visit! @@ -179,15 +179,15 @@ module QA push.project = project push.directory = Pathname .new(__dir__) - .join('../../../../../fixtures/auto_devops_rack') - push.commit_message = 'Create AutoDevOps compatible Project' + .join("../../../../../fixtures/auto_devops_rack") + push.commit_message = "Create AutoDevOps compatible Project" end Page::Project::Menu.perform(&:click_ci_cd_pipelines) Page::Project::Pipeline::Index.perform(&:go_to_latest_pipeline) Page::Project::Pipeline::Show.perform do |pipeline| - expect(pipeline).to have_tag('Auto DevOps') + expect(pipeline).to have_tag("Auto DevOps") end end end diff --git a/qa/qa/specs/features/browser_ui/7_configure/mattermost/create_group_with_mattermost_team_spec.rb b/qa/qa/specs/features/browser_ui/7_configure/mattermost/create_group_with_mattermost_team_spec.rb index 7096864e011..1d2387e2aa9 100644 --- a/qa/qa/specs/features/browser_ui/7_configure/mattermost/create_group_with_mattermost_team_spec.rb +++ b/qa/qa/specs/features/browser_ui/7_configure/mattermost/create_group_with_mattermost_team_spec.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true module QA - context 'Configure', :orchestrated, :mattermost do - describe 'Mattermost support' do - it 'user creates a group with a mattermost team' do + context "Configure", :orchestrated, :mattermost do + describe "Mattermost support" do + it "user creates a group with a mattermost team" do Runtime::Browser.visit(:gitlab, Page::Main::Login) Page::Main::Login.act { sign_in_using_credentials } Page::Main::Menu.act { go_to_groups } diff --git a/qa/qa/specs/features/sanity/framework_spec.rb b/qa/qa/specs/features/sanity/framework_spec.rb index aae0f0ade71..4f38dabf33b 100644 --- a/qa/qa/specs/features/sanity/framework_spec.rb +++ b/qa/qa/specs/features/sanity/framework_spec.rb @@ -1,17 +1,17 @@ # frozen_string_literal: true module QA - context 'Framework sanity checks', :orchestrated, :framework do - describe 'Passing orchestrated example' do - it 'succeeds' do + context "Framework sanity checks", :orchestrated, :framework do + describe "Passing orchestrated example" do + it "succeeds" do Runtime::Browser.visit(:gitlab, Page::Main::Login) - expect(page).to have_text('Open source software to collaborate on code') + expect(page).to have_text("Open source software to collaborate on code") end end - describe 'Failing orchestrated example' do - it 'fails' do + describe "Failing orchestrated example" do + it "fails" do Runtime::Browser.visit(:gitlab, Page::Main::Login) expect(page).to have_text("These Aren't the Texts You're Looking For", wait: 1) diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb index 1bd8101c36d..8e15f4a5011 100644 --- a/qa/qa/specs/runner.rb +++ b/qa/qa/specs/runner.rb @@ -1,11 +1,11 @@ -require 'rspec/core' +require "rspec/core" module QA module Specs class Runner < Scenario::Template attr_accessor :tty, :tags, :options - DEFAULT_TEST_PATH_ARGS = ['--', File.expand_path('./features', __dir__)].freeze + DEFAULT_TEST_PATH_ARGS = ["--", File.expand_path("./features", __dir__)].freeze def initialize @tty = false @@ -15,10 +15,10 @@ module QA def perform args = [] - args.push('--tty') if tty + args.push("--tty") if tty if tags.any? - tags.each { |tag| args.push(['--tag', tag.to_s]) } + tags.each { |tag| args.push(["--tag", tag.to_s]) } else args.push(%w[--tag ~orchestrated]) unless (%w[-t --tag] & options).any? end diff --git a/qa/qa/support/api.rb b/qa/qa/support/api.rb index 8aa7d6812ac..c8eeeb9588e 100644 --- a/qa/qa/support/api.rb +++ b/qa/qa/support/api.rb @@ -6,7 +6,8 @@ module QA method: :post, url: url, payload: payload, - verify_ssl: false) + verify_ssl: false + ) rescue RestClient::ExceptionWithResponse => e e.response end @@ -15,7 +16,8 @@ module QA RestClient::Request.execute( method: :get, url: url, - verify_ssl: false) + verify_ssl: false + ) rescue RestClient::ExceptionWithResponse => e e.response end @@ -24,7 +26,8 @@ module QA RestClient::Request.execute( method: :delete, url: url, - verify_ssl: false) + verify_ssl: false + ) rescue RestClient::ExceptionWithResponse => e e.response end @@ -33,7 +36,8 @@ module QA RestClient::Request.execute( method: :head, url: url, - verify_ssl: false) + verify_ssl: false + ) rescue RestClient::ExceptionWithResponse => e e.response end diff --git a/qa/qa/support/page/logging.rb b/qa/qa/support/page/logging.rb index 69b6332ecce..41cb07f6aa0 100644 --- a/qa/qa/support/page/logging.rb +++ b/qa/qa/support/page/logging.rb @@ -35,9 +35,9 @@ module QA def find_element(name, text: nil, wait: Capybara.default_max_wait_time) msg = ["finding :#{name}"] - msg << %Q(with text "#{text}") if text + msg << %(with text "#{text}") if text msg << "(wait: #{wait})" - log(msg.compact.join(' ')) + log(msg.compact.join(" ")) element = super @@ -63,15 +63,15 @@ module QA end def fill_element(name, content) - masked_content = name.to_s.include?('password') ? '*****' : content + masked_content = name.to_s.include?("password") ? "*****" : content - log(%Q(filling :#{name} with "#{masked_content}")) + log(%(filling :#{name} with "#{masked_content}")) super end def select_element(name, value) - log(%Q(selecting "#{value}" in :#{name})) + log(%(selecting "#{value}" in :#{name})) super end @@ -80,11 +80,11 @@ module QA found = super msg = ["has_element? :#{name}"] - msg << %Q(with text "#{text}") if text + msg << %(with text "#{text}") if text msg << "(wait: #{wait})" msg << "returned: #{found}" - log(msg.compact.join(' ')) + log(msg.compact.join(" ")) found end @@ -100,7 +100,7 @@ module QA def has_text?(text) found = super - log(%Q{has_text?('#{text}') returned #{found}}) + log(%{has_text?('#{text}') returned #{found}}) found end @@ -108,13 +108,13 @@ module QA def has_no_text?(text) found = super - log(%Q{has_no_text?('#{text}') returned #{found}}) + log(%{has_no_text?('#{text}') returned #{found}}) found end def finished_loading? - log('waiting for loading to complete...') + log("waiting for loading to complete...") now = Time.now loaded = super diff --git a/qa/qa/support/retrier.rb b/qa/qa/support/retrier.rb index 8be4e9f5365..4b01850db45 100644 --- a/qa/qa/support/retrier.rb +++ b/qa/qa/support/retrier.rb @@ -15,7 +15,7 @@ module QA yield rescue StandardError, RSpec::Expectations::ExpectationNotMetError sleep sleep_interval - reload_page.refresh if reload_page + reload_page&.refresh attempts += 1 retry if attempts < max_attempts diff --git a/qa/qa/tools/delete_subgroups.rb b/qa/qa/tools/delete_subgroups.rb index c5c48e77ade..e5ec1f065bc 100644 --- a/qa/qa/tools/delete_subgroups.rb +++ b/qa/qa/tools/delete_subgroups.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative '../../qa' +require_relative "../../qa" # This script deletes all subgroups of a group specified by ENV['GROUP_NAME_OR_PATH'] # Required environment variables: PERSONAL_ACCESS_TOKEN and GITLAB_ADDRESS @@ -13,14 +13,14 @@ module QA include Support::Api def initialize - raise ArgumentError, "Please provide GITLAB_ADDRESS" unless ENV['GITLAB_ADDRESS'] - raise ArgumentError, "Please provide PERSONAL_ACCESS_TOKEN" unless ENV['PERSONAL_ACCESS_TOKEN'] + raise ArgumentError, "Please provide GITLAB_ADDRESS" unless ENV["GITLAB_ADDRESS"] + raise ArgumentError, "Please provide PERSONAL_ACCESS_TOKEN" unless ENV["PERSONAL_ACCESS_TOKEN"] - @api_client = Runtime::API::Client.new(ENV['GITLAB_ADDRESS'], personal_access_token: ENV['PERSONAL_ACCESS_TOKEN']) + @api_client = Runtime::API::Client.new(ENV["GITLAB_ADDRESS"], personal_access_token: ENV["PERSONAL_ACCESS_TOKEN"]) end def run - STDOUT.puts 'Running...' + STDOUT.puts "Running..." # Fetch group's id group_id = fetch_group_id @@ -58,7 +58,7 @@ module QA end def fetch_group_id - group_search_response = get Runtime::API::Request.new(@api_client, "/groups", search: ENV['GROUP_NAME_OR_PATH'] || 'gitlab-qa-sandbox-group').url + group_search_response = get Runtime::API::Request.new(@api_client, "/groups", search: ENV["GROUP_NAME_OR_PATH"] || "gitlab-qa-sandbox-group").url JSON.parse(group_search_response.body).first["id"] end end diff --git a/qa/qa/tools/revoke_all_personal_access_tokens.rb b/qa/qa/tools/revoke_all_personal_access_tokens.rb index 7484b633bf6..fbb6a26977c 100644 --- a/qa/qa/tools/revoke_all_personal_access_tokens.rb +++ b/qa/qa/tools/revoke_all_personal_access_tokens.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require_relative '../../qa' -require 'net/protocol.rb' +require_relative "../../qa" +require "net/protocol.rb" # This script revokes all personal access tokens with the name of 'api-test-token' on the host specified by GITLAB_ADDRESS # Required environment variables: GITLAB_USERNAME, GITLAB_PASSWORD and GITLAB_ADDRESS # Run `rake revoke_personal_access_tokens` @@ -12,25 +12,25 @@ module QA def run do_run rescue Net::ReadTimeout - STDOUT.puts 'Net::ReadTimeout during run. Trying again' + STDOUT.puts "Net::ReadTimeout during run. Trying again" run end private def do_run - raise ArgumentError, "Please provide GITLAB_USERNAME" unless ENV['GITLAB_USERNAME'] - raise ArgumentError, "Please provide GITLAB_PASSWORD" unless ENV['GITLAB_PASSWORD'] - raise ArgumentError, "Please provide GITLAB_ADDRESS" unless ENV['GITLAB_ADDRESS'] + raise ArgumentError, "Please provide GITLAB_USERNAME" unless ENV["GITLAB_USERNAME"] + raise ArgumentError, "Please provide GITLAB_PASSWORD" unless ENV["GITLAB_PASSWORD"] + raise ArgumentError, "Please provide GITLAB_ADDRESS" unless ENV["GITLAB_ADDRESS"] - STDOUT.puts 'Running...' + STDOUT.puts "Running..." - Runtime::Browser.visit(ENV['GITLAB_ADDRESS'], Page::Main::Login) + Runtime::Browser.visit(ENV["GITLAB_ADDRESS"], Page::Main::Login) Page::Main::Login.perform(&:sign_in_using_credentials) Page::Main::Menu.perform(&:go_to_profile_settings) Page::Profile::Menu.perform(&:click_access_tokens) - token_name = 'api-test-token' + token_name = "api-test-token" Page::Profile::PersonalAccessTokens.perform do |page| while page.has_token_row_for_name?(token_name) diff --git a/qa/qa/vendor/github/page/login.rb b/qa/qa/vendor/github/page/login.rb index 6d8f9aa7c12..561d45944da 100644 --- a/qa/qa/vendor/github/page/login.rb +++ b/qa/qa/vendor/github/page/login.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'capybara/dsl' +require "capybara/dsl" module QA module Vendor @@ -8,12 +8,12 @@ module QA module Page class Login < Page::Base def login - fill_in 'login', with: QA::Runtime::Env.github_username - fill_in 'password', with: QA::Runtime::Env.github_password - click_on 'Sign in' + fill_in "login", with: QA::Runtime::Env.github_username + fill_in "password", with: QA::Runtime::Env.github_password + click_on "Sign in" unless has_no_text?("Authorize GitLab-OAuth") - click_on 'Authorize gitlab-qa' if has_button?('Authorize gitlab-qa') + click_on "Authorize gitlab-qa" if has_button?("Authorize gitlab-qa") end end end diff --git a/qa/qa/vendor/saml_idp/page/login.rb b/qa/qa/vendor/saml_idp/page/login.rb index 9c1f9904a7a..1189ec9a124 100644 --- a/qa/qa/vendor/saml_idp/page/login.rb +++ b/qa/qa/vendor/saml_idp/page/login.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'capybara/dsl' +require "capybara/dsl" module QA module Vendor @@ -8,9 +8,9 @@ module QA module Page class Login < Page::Base def login - fill_in 'username', with: 'user1' - fill_in 'password', with: 'user1pass' - click_on 'Login' + fill_in "username", with: "user1" + fill_in "password", with: "user1pass" + click_on "Login" end end end |