diff options
Diffstat (limited to 'qa')
238 files changed, 2186 insertions, 2177 deletions
diff --git a/qa/Gemfile b/qa/Gemfile index f29006617ed..96f5db8bf57 100644 --- a/qa/Gemfile +++ b/qa/Gemfile @@ -1,11 +1,11 @@ -source 'https://rubygems.org' +source "https://rubygems.org" -gem 'pry-byebug', '~> 3.5.1', platform: :mri -gem 'capybara', '~> 2.16.1' -gem 'capybara-screenshot', '~> 1.0.18' -gem 'rake', '~> 12.3.0' -gem 'rspec', '~> 3.7' -gem 'selenium-webdriver', '~> 3.12' -gem 'airborne', '~> 0.2.13' -gem 'nokogiri', '~> 1.10.1' -gem 'rspec-retry', '~> 0.6.1' +gem "pry-byebug", "~> 3.5.1", platform: :mri +gem "capybara", "~> 2.16.1" +gem "capybara-screenshot", "~> 1.0.18" +gem "rake", "~> 12.3.0" +gem "rspec", "~> 3.7" +gem "selenium-webdriver", "~> 3.12" +gem "airborne", "~> 0.2.13" +gem "nokogiri", "~> 1.10.1" +gem "rspec-retry", "~> 0.6.1" diff --git a/qa/Rakefile b/qa/Rakefile index 9a7b9c6bb35..e595c1cc214 100644 --- a/qa/Rakefile +++ b/qa/Rakefile @@ -1,5 +1,5 @@ -require_relative 'qa/tools/revoke_all_personal_access_tokens' -require_relative 'qa/tools/delete_subgroups' +require_relative "qa/tools/revoke_all_personal_access_tokens" +require_relative "qa/tools/delete_subgroups" desc "Revokes all personal access tokens" task :revoke_personal_access_tokens do diff --git a/qa/bin/qa b/qa/bin/qa index 6a772e93cee..22f8abb0d0a 100755 --- a/qa/bin/qa +++ b/qa/bin/qa @@ -1,6 +1,6 @@ #!/usr/bin/env ruby -require_relative '../qa' +require_relative "../qa" QA::Scenario .const_get(ARGV.shift) @@ -1,35 +1,35 @@ # frozen_string_literal: true -$: << File.expand_path(File.dirname(__FILE__)) +$: << __dir__ -Encoding.default_external = 'UTF-8' +Encoding.default_external = "UTF-8" module QA ## # GitLab QA runtime classes, mostly singletons. # module Runtime - autoload :Release, 'qa/runtime/release' - autoload :User, 'qa/runtime/user' - autoload :Namespace, 'qa/runtime/namespace' - autoload :Scenario, 'qa/runtime/scenario' - autoload :Browser, 'qa/runtime/browser' - autoload :Env, 'qa/runtime/env' - autoload :Address, 'qa/runtime/address' - autoload :Path, 'qa/runtime/path' - autoload :Fixtures, 'qa/runtime/fixtures' - autoload :Logger, 'qa/runtime/logger' + autoload :Release, "qa/runtime/release" + autoload :User, "qa/runtime/user" + autoload :Namespace, "qa/runtime/namespace" + autoload :Scenario, "qa/runtime/scenario" + autoload :Browser, "qa/runtime/browser" + autoload :Env, "qa/runtime/env" + autoload :Address, "qa/runtime/address" + autoload :Path, "qa/runtime/path" + autoload :Fixtures, "qa/runtime/fixtures" + autoload :Logger, "qa/runtime/logger" module API - autoload :Client, 'qa/runtime/api/client' - autoload :Request, 'qa/runtime/api/request' + autoload :Client, "qa/runtime/api/client" + autoload :Request, "qa/runtime/api/request" end module Key - autoload :Base, 'qa/runtime/key/base' - autoload :RSA, 'qa/runtime/key/rsa' - autoload :ECDSA, 'qa/runtime/key/ecdsa' - autoload :ED25519, 'qa/runtime/key/ed25519' + autoload :Base, "qa/runtime/key/base" + autoload :RSA, "qa/runtime/key/rsa" + autoload :ECDSA, "qa/runtime/key/ecdsa" + autoload :ED25519, "qa/runtime/key/ed25519" end end @@ -37,44 +37,44 @@ module QA # GitLab QA fabrication mechanisms # module Resource - autoload :ApiFabricator, 'qa/resource/api_fabricator' - autoload :Base, 'qa/resource/base' - - autoload :Sandbox, 'qa/resource/sandbox' - autoload :Group, 'qa/resource/group' - autoload :Issue, 'qa/resource/issue' - autoload :Project, 'qa/resource/project' - autoload :Label, 'qa/resource/label' - autoload :MergeRequest, 'qa/resource/merge_request' - autoload :ProjectImportedFromGithub, 'qa/resource/project_imported_from_github' - autoload :MergeRequestFromFork, 'qa/resource/merge_request_from_fork' - autoload :DeployKey, 'qa/resource/deploy_key' - autoload :DeployToken, 'qa/resource/deploy_token' - autoload :Branch, 'qa/resource/branch' - autoload :CiVariable, 'qa/resource/ci_variable' - autoload :Runner, 'qa/resource/runner' - autoload :PersonalAccessToken, 'qa/resource/personal_access_token' - autoload :KubernetesCluster, 'qa/resource/kubernetes_cluster' - autoload :User, 'qa/resource/user' - autoload :ProjectMilestone, 'qa/resource/project_milestone' - autoload :Wiki, 'qa/resource/wiki' - autoload :File, 'qa/resource/file' - autoload :Fork, 'qa/resource/fork' - autoload :SSHKey, 'qa/resource/ssh_key' + autoload :ApiFabricator, "qa/resource/api_fabricator" + autoload :Base, "qa/resource/base" + + autoload :Sandbox, "qa/resource/sandbox" + autoload :Group, "qa/resource/group" + autoload :Issue, "qa/resource/issue" + autoload :Project, "qa/resource/project" + autoload :Label, "qa/resource/label" + autoload :MergeRequest, "qa/resource/merge_request" + autoload :ProjectImportedFromGithub, "qa/resource/project_imported_from_github" + autoload :MergeRequestFromFork, "qa/resource/merge_request_from_fork" + autoload :DeployKey, "qa/resource/deploy_key" + autoload :DeployToken, "qa/resource/deploy_token" + autoload :Branch, "qa/resource/branch" + autoload :CiVariable, "qa/resource/ci_variable" + autoload :Runner, "qa/resource/runner" + autoload :PersonalAccessToken, "qa/resource/personal_access_token" + autoload :KubernetesCluster, "qa/resource/kubernetes_cluster" + autoload :User, "qa/resource/user" + autoload :ProjectMilestone, "qa/resource/project_milestone" + autoload :Wiki, "qa/resource/wiki" + autoload :File, "qa/resource/file" + autoload :Fork, "qa/resource/fork" + autoload :SSHKey, "qa/resource/ssh_key" module Events - autoload :Base, 'qa/resource/events/base' - autoload :Project, 'qa/resource/events/project' + autoload :Base, "qa/resource/events/base" + autoload :Project, "qa/resource/events/project" end module Repository - autoload :Push, 'qa/resource/repository/push' - autoload :ProjectPush, 'qa/resource/repository/project_push' - autoload :WikiPush, 'qa/resource/repository/wiki_push' + autoload :Push, "qa/resource/repository/push" + autoload :ProjectPush, "qa/resource/repository/project_push" + autoload :WikiPush, "qa/resource/repository/wiki_push" end module Settings - autoload :HashedStorage, 'qa/resource/settings/hashed_storage' + autoload :HashedStorage, "qa/resource/settings/hashed_storage" end end @@ -85,34 +85,34 @@ module QA ## # Support files # - autoload :Bootable, 'qa/scenario/bootable' - autoload :Actable, 'qa/scenario/actable' - autoload :Template, 'qa/scenario/template' + autoload :Bootable, "qa/scenario/bootable" + autoload :Actable, "qa/scenario/actable" + autoload :Template, "qa/scenario/template" ## # Test scenario entrypoints. # module Test - autoload :Instance, 'qa/scenario/test/instance' + autoload :Instance, "qa/scenario/test/instance" module Instance - autoload :All, 'qa/scenario/test/instance/all' - autoload :Smoke, 'qa/scenario/test/instance/smoke' + autoload :All, "qa/scenario/test/instance/all" + autoload :Smoke, "qa/scenario/test/instance/smoke" end module Integration - autoload :Github, 'qa/scenario/test/integration/github' - autoload :LDAPNoTLS, 'qa/scenario/test/integration/ldap_no_tls' - autoload :LDAPTLS, 'qa/scenario/test/integration/ldap_tls' - autoload :InstanceSAML, 'qa/scenario/test/integration/instance_saml' - autoload :OAuth, 'qa/scenario/test/integration/oauth' - autoload :Kubernetes, 'qa/scenario/test/integration/kubernetes' - autoload :Mattermost, 'qa/scenario/test/integration/mattermost' - autoload :ObjectStorage, 'qa/scenario/test/integration/object_storage' + autoload :Github, "qa/scenario/test/integration/github" + autoload :LDAPNoTLS, "qa/scenario/test/integration/ldap_no_tls" + autoload :LDAPTLS, "qa/scenario/test/integration/ldap_tls" + autoload :InstanceSAML, "qa/scenario/test/integration/instance_saml" + autoload :OAuth, "qa/scenario/test/integration/oauth" + autoload :Kubernetes, "qa/scenario/test/integration/kubernetes" + autoload :Mattermost, "qa/scenario/test/integration/mattermost" + autoload :ObjectStorage, "qa/scenario/test/integration/object_storage" end module Sanity - autoload :Framework, 'qa/scenario/test/sanity/framework' - autoload :Selectors, 'qa/scenario/test/sanity/selectors' + autoload :Framework, "qa/scenario/test/sanity/framework" + autoload :Selectors, "qa/scenario/test/sanity/selectors" end end end @@ -123,196 +123,196 @@ module QA # Needed to execute click-driven-only black-box tests. # module Page - autoload :Base, 'qa/page/base' - autoload :View, 'qa/page/view' - autoload :Element, 'qa/page/element' - autoload :Validator, 'qa/page/validator' + autoload :Base, "qa/page/base" + autoload :View, "qa/page/view" + autoload :Element, "qa/page/element" + autoload :Validator, "qa/page/validator" module Main - autoload :Login, 'qa/page/main/login' - autoload :Menu, 'qa/page/main/menu' - autoload :OAuth, 'qa/page/main/oauth' - autoload :SignUp, 'qa/page/main/sign_up' + autoload :Login, "qa/page/main/login" + autoload :Menu, "qa/page/main/menu" + autoload :OAuth, "qa/page/main/oauth" + autoload :SignUp, "qa/page/main/sign_up" end module Settings - autoload :Common, 'qa/page/settings/common' + autoload :Common, "qa/page/settings/common" end module Dashboard - autoload :Projects, 'qa/page/dashboard/projects' - autoload :Groups, 'qa/page/dashboard/groups' + autoload :Projects, "qa/page/dashboard/projects" + autoload :Groups, "qa/page/dashboard/groups" end module Group - autoload :New, 'qa/page/group/new' - autoload :Show, 'qa/page/group/show' + autoload :New, "qa/page/group/new" + autoload :Show, "qa/page/group/show" end module File - autoload :Form, 'qa/page/file/form' - autoload :Show, 'qa/page/file/show' + autoload :Form, "qa/page/file/form" + autoload :Show, "qa/page/file/show" module Shared - autoload :CommitMessage, 'qa/page/file/shared/commit_message' + autoload :CommitMessage, "qa/page/file/shared/commit_message" end end module Project - autoload :New, 'qa/page/project/new' - autoload :Show, 'qa/page/project/show' - autoload :Activity, 'qa/page/project/activity' - autoload :Menu, 'qa/page/project/menu' + autoload :New, "qa/page/project/new" + autoload :Show, "qa/page/project/show" + autoload :Activity, "qa/page/project/activity" + autoload :Menu, "qa/page/project/menu" module Branches - autoload :Show, 'qa/page/project/branches/show' + autoload :Show, "qa/page/project/branches/show" end module Commit - autoload :Show, 'qa/page/project/commit/show' + autoload :Show, "qa/page/project/commit/show" end module Import - autoload :Github, 'qa/page/project/import/github' + autoload :Github, "qa/page/project/import/github" end module Pipeline - autoload :Index, 'qa/page/project/pipeline/index' - autoload :Show, 'qa/page/project/pipeline/show' + autoload :Index, "qa/page/project/pipeline/index" + autoload :Show, "qa/page/project/pipeline/show" end module Job - autoload :Show, 'qa/page/project/job/show' + autoload :Show, "qa/page/project/job/show" end module Settings - autoload :Common, 'qa/page/project/settings/common' - autoload :Advanced, 'qa/page/project/settings/advanced' - autoload :Main, 'qa/page/project/settings/main' - autoload :Repository, 'qa/page/project/settings/repository' - autoload :CICD, 'qa/page/project/settings/ci_cd' - autoload :DeployKeys, 'qa/page/project/settings/deploy_keys' - autoload :DeployTokens, 'qa/page/project/settings/deploy_tokens' - autoload :ProtectedBranches, 'qa/page/project/settings/protected_branches' - autoload :CiVariables, 'qa/page/project/settings/ci_variables' - autoload :Runners, 'qa/page/project/settings/runners' - autoload :MergeRequest, 'qa/page/project/settings/merge_request' - autoload :Members, 'qa/page/project/settings/members' - autoload :MirroringRepositories, 'qa/page/project/settings/mirroring_repositories' + autoload :Common, "qa/page/project/settings/common" + autoload :Advanced, "qa/page/project/settings/advanced" + autoload :Main, "qa/page/project/settings/main" + autoload :Repository, "qa/page/project/settings/repository" + autoload :CICD, "qa/page/project/settings/ci_cd" + autoload :DeployKeys, "qa/page/project/settings/deploy_keys" + autoload :DeployTokens, "qa/page/project/settings/deploy_tokens" + autoload :ProtectedBranches, "qa/page/project/settings/protected_branches" + autoload :CiVariables, "qa/page/project/settings/ci_variables" + autoload :Runners, "qa/page/project/settings/runners" + autoload :MergeRequest, "qa/page/project/settings/merge_request" + autoload :Members, "qa/page/project/settings/members" + autoload :MirroringRepositories, "qa/page/project/settings/mirroring_repositories" end module SubMenus - autoload :CiCd, 'qa/page/project/sub_menus/ci_cd' - autoload :Common, 'qa/page/project/sub_menus/common' - autoload :Issues, 'qa/page/project/sub_menus/issues' - autoload :Operations, 'qa/page/project/sub_menus/operations' - autoload :Repository, 'qa/page/project/sub_menus/repository' - autoload :Settings, 'qa/page/project/sub_menus/settings' + autoload :CiCd, "qa/page/project/sub_menus/ci_cd" + autoload :Common, "qa/page/project/sub_menus/common" + autoload :Issues, "qa/page/project/sub_menus/issues" + autoload :Operations, "qa/page/project/sub_menus/operations" + autoload :Repository, "qa/page/project/sub_menus/repository" + autoload :Settings, "qa/page/project/sub_menus/settings" end module Issue - autoload :New, 'qa/page/project/issue/new' - autoload :Show, 'qa/page/project/issue/show' - autoload :Index, 'qa/page/project/issue/index' + autoload :New, "qa/page/project/issue/new" + autoload :Show, "qa/page/project/issue/show" + autoload :Index, "qa/page/project/issue/index" end module Fork - autoload :New, 'qa/page/project/fork/new' + autoload :New, "qa/page/project/fork/new" end module Milestone - autoload :New, 'qa/page/project/milestone/new' - autoload :Index, 'qa/page/project/milestone/index' + autoload :New, "qa/page/project/milestone/new" + autoload :Index, "qa/page/project/milestone/index" end module Operations module Environments - autoload :Index, 'qa/page/project/operations/environments/index' - autoload :Show, 'qa/page/project/operations/environments/show' + autoload :Index, "qa/page/project/operations/environments/index" + autoload :Show, "qa/page/project/operations/environments/show" end module Kubernetes - autoload :Index, 'qa/page/project/operations/kubernetes/index' - autoload :Add, 'qa/page/project/operations/kubernetes/add' - autoload :AddExisting, 'qa/page/project/operations/kubernetes/add_existing' - autoload :Show, 'qa/page/project/operations/kubernetes/show' + autoload :Index, "qa/page/project/operations/kubernetes/index" + autoload :Add, "qa/page/project/operations/kubernetes/add" + autoload :AddExisting, "qa/page/project/operations/kubernetes/add_existing" + autoload :Show, "qa/page/project/operations/kubernetes/show" end end module Wiki - autoload :Edit, 'qa/page/project/wiki/edit' - autoload :New, 'qa/page/project/wiki/new' - autoload :Show, 'qa/page/project/wiki/show' + autoload :Edit, "qa/page/project/wiki/edit" + autoload :New, "qa/page/project/wiki/new" + autoload :Show, "qa/page/project/wiki/show" end module WebIDE - autoload :Edit, 'qa/page/project/web_ide/edit' + autoload :Edit, "qa/page/project/web_ide/edit" end end module Profile - autoload :Menu, 'qa/page/profile/menu' - autoload :PersonalAccessTokens, 'qa/page/profile/personal_access_tokens' - autoload :SSHKeys, 'qa/page/profile/ssh_keys' + autoload :Menu, "qa/page/profile/menu" + autoload :PersonalAccessTokens, "qa/page/profile/personal_access_tokens" + autoload :SSHKeys, "qa/page/profile/ssh_keys" end module Issuable - autoload :Sidebar, 'qa/page/issuable/sidebar' + autoload :Sidebar, "qa/page/issuable/sidebar" end module Alert - autoload :AutoDevopsAlert, 'qa/page/alert/auto_devops_alert' + autoload :AutoDevopsAlert, "qa/page/alert/auto_devops_alert" end module Layout - autoload :Banner, 'qa/page/layout/banner' + autoload :Banner, "qa/page/layout/banner" end module Label - autoload :New, 'qa/page/label/new' - autoload :Index, 'qa/page/label/index' + autoload :New, "qa/page/label/new" + autoload :Index, "qa/page/label/index" end module MergeRequest - autoload :New, 'qa/page/merge_request/new' - autoload :Show, 'qa/page/merge_request/show' + autoload :New, "qa/page/merge_request/new" + autoload :Show, "qa/page/merge_request/show" end module Admin - autoload :Menu, 'qa/page/admin/menu' + autoload :Menu, "qa/page/admin/menu" module Settings - autoload :Repository, 'qa/page/admin/settings/repository' - autoload :General, 'qa/page/admin/settings/general' + autoload :Repository, "qa/page/admin/settings/repository" + autoload :General, "qa/page/admin/settings/general" module Component - autoload :RepositoryStorage, 'qa/page/admin/settings/component/repository_storage' - autoload :AccountAndLimit, 'qa/page/admin/settings/component/account_and_limit' + autoload :RepositoryStorage, "qa/page/admin/settings/component/repository_storage" + autoload :AccountAndLimit, "qa/page/admin/settings/component/account_and_limit" end end end module Mattermost - autoload :Main, 'qa/page/mattermost/main' - autoload :Login, 'qa/page/mattermost/login' + autoload :Main, "qa/page/mattermost/main" + autoload :Login, "qa/page/mattermost/login" end ## # Classes describing components that are used by several pages. # module Component - autoload :ClonePanel, 'qa/page/component/clone_panel' - autoload :LazyLoader, 'qa/page/component/lazy_loader' - autoload :LegacyClonePanel, 'qa/page/component/legacy_clone_panel' - autoload :Dropzone, 'qa/page/component/dropzone' - autoload :GroupsFilter, 'qa/page/component/groups_filter' - autoload :Select2, 'qa/page/component/select2' - autoload :DropdownFilter, 'qa/page/component/dropdown_filter' - autoload :UsersSelect, 'qa/page/component/users_select' - autoload :Note, 'qa/page/component/note' + autoload :ClonePanel, "qa/page/component/clone_panel" + autoload :LazyLoader, "qa/page/component/lazy_loader" + autoload :LegacyClonePanel, "qa/page/component/legacy_clone_panel" + autoload :Dropzone, "qa/page/component/dropzone" + autoload :GroupsFilter, "qa/page/component/groups_filter" + autoload :Select2, "qa/page/component/select2" + autoload :DropdownFilter, "qa/page/component/dropdown_filter" + autoload :UsersSelect, "qa/page/component/users_select" + autoload :Note, "qa/page/component/note" module Issuable - autoload :Common, 'qa/page/component/issuable/common' + autoload :Common, "qa/page/component/issuable/common" end end end @@ -321,8 +321,8 @@ module QA # Classes describing operations on Git repositories. # module Git - autoload :Repository, 'qa/git/repository' - autoload :Location, 'qa/git/location' + autoload :Repository, "qa/git/repository" + autoload :Location, "qa/git/location" end ## @@ -330,18 +330,18 @@ module QA # with these services, like through the shell. # module Service - autoload :Shellout, 'qa/service/shellout' - autoload :KubernetesCluster, 'qa/service/kubernetes_cluster' - autoload :Omnibus, 'qa/service/omnibus' - autoload :Runner, 'qa/service/runner' + autoload :Shellout, "qa/service/shellout" + autoload :KubernetesCluster, "qa/service/kubernetes_cluster" + autoload :Omnibus, "qa/service/omnibus" + autoload :Runner, "qa/service/runner" end ## # Classes that make it possible to execute features tests. # module Specs - autoload :Config, 'qa/specs/config' - autoload :Runner, 'qa/specs/runner' + autoload :Config, "qa/specs/config" + autoload :Runner, "qa/specs/runner" end ## @@ -350,15 +350,15 @@ module QA module Vendor module SAMLIdp module Page - autoload :Base, 'qa/vendor/saml_idp/page/base' - autoload :Login, 'qa/vendor/saml_idp/page/login' + autoload :Base, "qa/vendor/saml_idp/page/base" + autoload :Login, "qa/vendor/saml_idp/page/login" end end module Github module Page - autoload :Base, 'qa/vendor/github/page/base' - autoload :Login, 'qa/vendor/github/page/login' + autoload :Base, "qa/vendor/github/page/base" + autoload :Login, "qa/vendor/github/page/login" end end end @@ -367,11 +367,11 @@ module QA # module Support module Page - autoload :Logging, 'qa/support/page/logging' + autoload :Logging, "qa/support/page/logging" end - autoload :Api, 'qa/support/api' - autoload :Waiter, 'qa/support/waiter' - autoload :Retrier, 'qa/support/retrier' + autoload :Api, "qa/support/api" + autoload :Waiter, "qa/support/waiter" + autoload :Retrier, "qa/support/retrier" end end 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 diff --git a/qa/spec/factory/resource/user_spec.rb b/qa/spec/factory/resource/user_spec.rb index 820c506b715..1cd46d4fabc 100644 --- a/qa/spec/factory/resource/user_spec.rb +++ b/qa/spec/factory/resource/user_spec.rb @@ -4,32 +4,32 @@ describe QA::Resource::User do describe "#fabricate_via_api!" do Response = Struct.new(:code, :body) - it 'fetches an existing user' do + it "fetches an existing user" do existing_users = [ { - id: '0', - name: 'name', - username: 'name', - web_url: '' - } + id: "0", + name: "name", + username: "name", + web_url: "", + }, ] - users_response = Response.new('200', JSON.dump(existing_users)) - single_user_response = Response.new('200', JSON.dump(existing_users.first)) + users_response = Response.new("200", JSON.dump(existing_users)) + single_user_response = Response.new("200", JSON.dump(existing_users.first)) expect(subject).to receive(:api_get_from).with("/users?username=name").and_return(users_response) expect(subject).to receive(:api_get_from).with("/users/0").and_return(single_user_response) - subject.username = 'name' + subject.username = "name" subject.fabricate_via_api! expect(subject.api_response).to eq(existing_users.first) end - it 'tries to create a user if it does not exist' do - expect(subject).to receive(:api_get_from).with("/users?username=foo").and_return(Response.new('200', '[]')) - expect(subject).to receive(:api_post).and_return({ web_url: '' }) + it "tries to create a user if it does not exist" do + expect(subject).to receive(:api_get_from).with("/users?username=foo").and_return(Response.new("200", "[]")) + expect(subject).to receive(:api_post).and_return({web_url: ""}) - subject.username = 'foo' + subject.username = "foo" subject.fabricate_via_api! end end diff --git a/qa/spec/git/location_spec.rb b/qa/spec/git/location_spec.rb index aef906ee836..96ba366e796 100644 --- a/qa/spec/git/location_spec.rb +++ b/qa/spec/git/location_spec.rb @@ -1,53 +1,53 @@ describe QA::Git::Location do - describe '.new' do - context 'when URI starts with ssh://' do - context 'when URI has port' do - it 'parses correctly' do + describe ".new" do + context "when URI starts with ssh://" do + context "when URI has port" do + it "parses correctly" do uri = described_class - .new('ssh://git@qa.test:2222/sandbox/qa/repo.git') + .new("ssh://git@qa.test:2222/sandbox/qa/repo.git") - expect(uri.user).to eq('git') - expect(uri.host).to eq('qa.test') + expect(uri.user).to eq("git") + expect(uri.host).to eq("qa.test") expect(uri.port).to eq(2222) - expect(uri.path).to eq('/sandbox/qa/repo.git') + expect(uri.path).to eq("/sandbox/qa/repo.git") end end - context 'when URI does not have port' do - it 'parses correctly' do + context "when URI does not have port" do + it "parses correctly" do uri = described_class - .new('ssh://git@qa.test/sandbox/qa/repo.git') + .new("ssh://git@qa.test/sandbox/qa/repo.git") - expect(uri.user).to eq('git') - expect(uri.host).to eq('qa.test') + expect(uri.user).to eq("git") + expect(uri.host).to eq("qa.test") expect(uri.port).to eq(22) - expect(uri.path).to eq('/sandbox/qa/repo.git') + expect(uri.path).to eq("/sandbox/qa/repo.git") end end end - context 'when URI does not start with ssh://' do - context 'when host does not have colons' do - it 'parses correctly' do + context "when URI does not start with ssh://" do + context "when host does not have colons" do + it "parses correctly" do uri = described_class - .new('git@qa.test:sandbox/qa/repo.git') + .new("git@qa.test:sandbox/qa/repo.git") - expect(uri.user).to eq('git') - expect(uri.host).to eq('qa.test') + expect(uri.user).to eq("git") + expect(uri.host).to eq("qa.test") expect(uri.port).to eq(22) - expect(uri.path).to eq('/sandbox/qa/repo.git') + expect(uri.path).to eq("/sandbox/qa/repo.git") end end - context 'when host has a colon' do - it 'parses correctly' do + context "when host has a colon" do + it "parses correctly" do uri = described_class - .new('[git@qa:test]:sandbox/qa/repo.git') + .new("[git@qa:test]:sandbox/qa/repo.git") - expect(uri.user).to eq('git') - expect(uri.host).to eq('qa%3Atest') + expect(uri.user).to eq("git") + expect(uri.host).to eq("qa%3Atest") expect(uri.port).to eq(22) - expect(uri.path).to eq('/sandbox/qa/repo.git') + expect(uri.path).to eq("/sandbox/qa/repo.git") end end end diff --git a/qa/spec/git/repository_spec.rb b/qa/spec/git/repository_spec.rb index 62c81050bd9..f76f4a94996 100644 --- a/qa/spec/git/repository_spec.rb +++ b/qa/spec/git/repository_spec.rb @@ -1,13 +1,13 @@ describe QA::Git::Repository do include Helpers::StubENV - shared_context 'git directory' do + shared_context "git directory" do let(:repository) { described_class.new } let(:tmp_git_dir) { Dir.mktmpdir } let(:tmp_netrc_dir) { Dir.mktmpdir } before do - stub_env('GITLAB_USERNAME', 'root') + stub_env("GITLAB_USERNAME", "root") cd_empty_temp_directory set_bad_uri @@ -26,34 +26,34 @@ describe QA::Git::Repository do end def set_bad_uri - repository.uri = 'http://foo/bar.git' + repository.uri = "http://foo/bar.git" end end - context 'with default credentials' do - include_context 'git directory' do + context "with default credentials" do + include_context "git directory" do before do repository.use_default_credentials end end - describe '#clone' do - it 'is unable to resolve host' do + describe "#clone" do + it "is unable to resolve host" do expect(repository.clone).to include("fatal: unable to access 'http://root@foo/bar.git/'") end end - describe '#push_changes' do + describe "#push_changes" do before do `git init` # need a repo to push from end - it 'fails to push changes' do + it "fails to push changes" do expect(repository.push_changes).to include("error: failed to push some refs to 'http://root@foo/bar.git'") end end - describe '#git_protocol=' do + describe "#git_protocol=" do [0, 1, 2].each do |version| it "configures git to use protocol version #{version}" do expect(repository).to receive(:run).with("git config protocol.version #{version}") @@ -61,57 +61,57 @@ describe QA::Git::Repository do end end - it 'raises an error if the version is unsupported' do - expect { repository.git_protocol = 'foo' }.to raise_error(ArgumentError, "Please specify the protocol you would like to use: 0, 1, or 2") + it "raises an error if the version is unsupported" do + expect { repository.git_protocol = "foo" }.to raise_error(ArgumentError, "Please specify the protocol you would like to use: 0, 1, or 2") end end - describe '#fetch_supported_git_protocol' do + describe "#fetch_supported_git_protocol" do it "reports the detected version" do expect(repository).to receive(:run).and_return("packet: git< version 2") - expect(repository.fetch_supported_git_protocol).to eq('2') + expect(repository.fetch_supported_git_protocol).to eq("2") end - it 'reports unknown if version is unknown' do + it "reports unknown if version is unknown" do expect(repository).to receive(:run).and_return("packet: git< version -1") - expect(repository.fetch_supported_git_protocol).to eq('unknown') + expect(repository.fetch_supported_git_protocol).to eq("unknown") end - it 'reports unknown if content does not identify a version' do + it "reports unknown if content does not identify a version" do expect(repository).to receive(:run).and_return("foo") - expect(repository.fetch_supported_git_protocol).to eq('unknown') + expect(repository.fetch_supported_git_protocol).to eq("unknown") end end - describe '#use_default_credentials' do - it 'adds credentials to .netrc' do - expect(File.read(File.join(tmp_netrc_dir, '.netrc'))) + describe "#use_default_credentials" do + it "adds credentials to .netrc" do + expect(File.read(File.join(tmp_netrc_dir, ".netrc"))) .to eq("machine foo login #{QA::Runtime::User.default_username} password #{QA::Runtime::User.default_password}\n") end end end - context 'with specific credentials' do - include_context 'git directory' + context "with specific credentials" do + include_context "git directory" - context 'before setting credentials' do - it 'does not add credentials to .netrc' do + context "before setting credentials" do + it "does not add credentials to .netrc" do expect(repository).not_to receive(:save_netrc_content) end end - describe '#password=' do - it 'raises an error if no username was given' do - expect { repository.password = 'foo' } + describe "#password=" do + it "raises an error if no username was given" do + expect { repository.password = "foo" } .to raise_error(QA::Git::Repository::InvalidCredentialsError, "Please provide a username when setting a password") end - it 'adds credentials to .netrc' do - repository.username = 'user' - repository.password = 'foo' + it "adds credentials to .netrc" do + repository.username = "user" + repository.password = "foo" - expect(File.read(File.join(tmp_netrc_dir, '.netrc'))) + expect(File.read(File.join(tmp_netrc_dir, ".netrc"))) .to eq("machine foo login user password foo\n") end end diff --git a/qa/spec/helpers/stub_env.rb b/qa/spec/helpers/stub_env.rb index 62b4a1df787..9d6eb7cf470 100644 --- a/qa/spec/helpers/stub_env.rb +++ b/qa/spec/helpers/stub_env.rb @@ -13,7 +13,7 @@ module Helpers private - STUBBED_KEY = '__STUBBED__'.freeze + STUBBED_KEY = "__STUBBED__".freeze def add_stubbed_value(key, value) allow(ENV).to receive(:[]).with(key).and_return(value) diff --git a/qa/spec/page/base_spec.rb b/qa/spec/page/base_spec.rb index 32a350f2154..d9b037a9599 100644 --- a/qa/spec/page/base_spec.rb +++ b/qa/spec/page/base_spec.rb @@ -1,88 +1,88 @@ describe QA::Page::Base do - describe 'page helpers' do - it 'exposes helpful page helpers' do + describe "page helpers" do + it "exposes helpful page helpers" do expect(subject).to respond_to :refresh, :wait, :scroll_to end end - describe '.view', 'DSL for defining view partials' do + describe ".view", "DSL for defining view partials" do subject do Class.new(described_class) do - view 'path/to/some/view.html.haml' do - element :something, 'string pattern' # rubocop:disable QA/ElementWithPattern + view "path/to/some/view.html.haml" do + element :something, "string pattern" # rubocop:disable QA/ElementWithPattern element :something_else, /regexp pattern/ # rubocop:disable QA/ElementWithPattern end - view 'path/to/some/_partial.html.haml' do - element :another_element, 'string pattern' # rubocop:disable QA/ElementWithPattern + view "path/to/some/_partial.html.haml" do + element :another_element, "string pattern" # rubocop:disable QA/ElementWithPattern end end end - it 'makes it possible to define page views' do + it "makes it possible to define page views" do expect(subject.views.size).to eq 2 - expect(subject.views).to all(be_an_instance_of QA::Page::View) + expect(subject.views).to all(be_an_instance_of(QA::Page::View)) end - it 'populates views objects with data about elements' do + it "populates views objects with data about elements" do expect(subject.elements.size).to eq 3 - expect(subject.elements).to all(be_an_instance_of QA::Page::Element) + expect(subject.elements).to all(be_an_instance_of(QA::Page::Element)) expect(subject.elements.map(&:name)) .to eq [:something, :something_else, :another_element] end end - describe '.errors' do - let(:view) { double('view') } + describe ".errors" do + let(:view) { double("view") } - context 'when page has views and elements defined' do + context "when page has views and elements defined" do before do allow(described_class).to receive(:views) .and_return([view]) - allow(view).to receive(:errors).and_return(['some error']) + allow(view).to receive(:errors).and_return(["some error"]) end - it 'iterates views composite and returns errors' do - expect(described_class.errors).to eq ['some error'] + it "iterates views composite and returns errors" do + expect(described_class.errors).to eq ["some error"] end end - context 'when page has no views and elements defined' do + context "when page has no views and elements defined" do before do allow(described_class).to receive(:views).and_return([]) end - it 'appends an error about missing views / elements block' do + it "appends an error about missing views / elements block" do expect(described_class.errors) - .to include 'Page class does not have views / elements defined!' + .to include "Page class does not have views / elements defined!" end end end - describe '#wait' do + describe "#wait" do subject { Class.new(described_class).new } - context 'when the condition is true' do - it 'does not refresh' do + context "when the condition is true" do + it "does not refresh" do expect(subject).not_to receive(:refresh) subject.wait(max: 0.01) { true } end - it 'returns true' do + it "returns true" do expect(subject.wait(max: 0.1) { true }).to be_truthy end end - context 'when the condition is false' do - it 'refreshes' do + context "when the condition is false" do + it "refreshes" do expect(subject).to receive(:refresh).at_least(:once) subject.wait(max: 0.01) { false } end - it 'returns false' do + it "returns false" do allow(subject).to receive(:refresh) expect(subject.wait(max: 0.01) { false }).to be_falsey diff --git a/qa/spec/page/element_spec.rb b/qa/spec/page/element_spec.rb index 8598c57ad34..5b485c27b3b 100644 --- a/qa/spec/page/element_spec.rb +++ b/qa/spec/page/element_spec.rb @@ -1,51 +1,51 @@ describe QA::Page::Element do - describe '#selector' do - it 'transforms element name into QA-specific selector' do + describe "#selector" do + it "transforms element name into QA-specific selector" do expect(described_class.new(:sign_in_button).selector) - .to eq 'qa-sign-in-button' + .to eq "qa-sign-in-button" end end - describe '#selector_css' do - it 'transforms element name into QA-specific clickable css selector' do + describe "#selector_css" do + it "transforms element name into QA-specific clickable css selector" do expect(described_class.new(:sign_in_button).selector_css) - .to eq '.qa-sign-in-button' + .to eq ".qa-sign-in-button" end end - context 'when pattern is an expression' do + context "when pattern is an expression" do subject { described_class.new(:something, /button 'Sign in'/) } - it 'matches when there is a match' do + it "matches when there is a match" do expect(subject.matches?("button 'Sign in'")).to be true end - it 'does not match if pattern is not present' do + it "does not match if pattern is not present" do expect(subject.matches?("button 'Sign out'")).to be false end end - context 'when pattern is a string' do - subject { described_class.new(:something, 'button') } + context "when pattern is a string" do + subject { described_class.new(:something, "button") } - it 'matches when there is match' do - expect(subject.matches?('some button in the view')).to be true + it "matches when there is match" do + expect(subject.matches?("some button in the view")).to be true end - it 'does not match if pattern is not present' do - expect(subject.matches?('text_field :name')).to be false + it "does not match if pattern is not present" do + expect(subject.matches?("text_field :name")).to be false end end - context 'when pattern is not provided' do + context "when pattern is not provided" do subject { described_class.new(:some_name) } - it 'matches when QA specific selector is present' do - expect(subject.matches?('some qa-some-name selector')).to be true + it "matches when QA specific selector is present" do + expect(subject.matches?("some qa-some-name selector")).to be true end - it 'does not match if QA selector is not there' do - expect(subject.matches?('some_name selector')).to be false + it "does not match if QA selector is not there" do + expect(subject.matches?("some_name selector")).to be false end end end diff --git a/qa/spec/page/logging_spec.rb b/qa/spec/page/logging_spec.rb index 707a7ff6d98..451dd5f0713 100644 --- a/qa/spec/page/logging_spec.rb +++ b/qa/spec/page/logging_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require 'capybara/dsl' -require 'logger' +require "capybara/dsl" +require "logger" describe QA::Support::Page::Logging do let(:page) { double.as_null_object } @@ -12,22 +12,22 @@ describe QA::Support::Page::Logging do QA::Runtime::Logger.logger = logger allow(Capybara).to receive(:current_session).and_return(page) - allow(page).to receive(:current_url).and_return('http://current-url') + allow(page).to receive(:current_url).and_return("http://current-url") allow(page).to receive(:has_css?).with(any_args).and_return(true) end subject do - Class.new(QA::Page::Base) do + Class.new(QA::Page::Base) { prepend QA::Support::Page::Logging - end.new + }.new end - it 'logs refresh' do + it "logs refresh" do expect { subject.refresh } .to output(%r{refreshing http://current-url}).to_stdout_from_any_process end - it 'logs wait' do + it "logs wait" do expect { subject.wait(max: 0) {} } .to output(/next wait uses reload: true/).to_stdout_from_any_process expect { subject.wait(max: 0) {} } @@ -36,7 +36,7 @@ describe QA::Support::Page::Logging do .to output(/ended wait after .* seconds$/).to_stdout_from_any_process end - it 'logs wait with reload false' do + it "logs wait with reload false" do expect { subject.wait(max: 0, reload: false) {} } .to output(/next wait uses reload: false/).to_stdout_from_any_process expect { subject.wait(max: 0, reload: false) {} } @@ -45,87 +45,87 @@ describe QA::Support::Page::Logging do .to output(/ended wait after .* seconds$/).to_stdout_from_any_process end - it 'logs scroll_to' do + it "logs scroll_to" do expect { subject.scroll_to(:element) } .to output(/scrolling to :element/).to_stdout_from_any_process end - it 'logs asset_exists?' do - expect { subject.asset_exists?('http://asset-url') } + it "logs asset_exists?" do + expect { subject.asset_exists?("http://asset-url") } .to output(%r{asset_exists\? http://asset-url returned false}).to_stdout_from_any_process end - it 'logs find_element' do + it "logs find_element" do expect { subject.find_element(:element) } .to output(/finding :element/).to_stdout_from_any_process expect { subject.find_element(:element) } .to output(/found :element/).to_stdout_from_any_process end - it 'logs find_element with text' do - expect { subject.find_element(:element, text: 'foo') } + it "logs find_element with text" do + expect { subject.find_element(:element, text: "foo") } .to output(/finding :element with text "foo"/).to_stdout_from_any_process - expect { subject.find_element(:element, text: 'foo') } + expect { subject.find_element(:element, text: "foo") } .to output(/found :element/).to_stdout_from_any_process end - it 'logs click_element' do + it "logs click_element" do expect { subject.click_element(:element) } .to output(/clicking :element/).to_stdout_from_any_process end - it 'logs fill_element' do - expect { subject.fill_element(:element, 'foo') } + it "logs fill_element" do + expect { subject.fill_element(:element, "foo") } .to output(/filling :element with "foo"/).to_stdout_from_any_process end - it 'logs has_element?' do + it "logs has_element?" do expect { subject.has_element?(:element) } .to output(/has_element\? :element \(wait: 2\) returned: true/).to_stdout_from_any_process end - it 'logs has_element? with text' do + it "logs has_element? with text" do expect { subject.has_element?(:element, text: "some text") } .to output(/has_element\? :element with text \"some text\" \(wait: 2\) returned: true/).to_stdout_from_any_process end - it 'logs has_no_element?' do + it "logs has_no_element?" do allow(page).to receive(:has_no_css?).and_return(true) expect { subject.has_no_element?(:element) } .to output(/has_no_element\? :element returned true/).to_stdout_from_any_process end - it 'logs has_text?' do + it "logs has_text?" do allow(page).to receive(:has_text?).and_return(true) - expect { subject.has_text? 'foo' } + expect { subject.has_text? "foo" } .to output(/has_text\?\('foo'\) returned true/).to_stdout_from_any_process end - it 'logs has_no_text?' do - allow(page).to receive(:has_no_text?).with('foo').and_return(true) + it "logs has_no_text?" do + allow(page).to receive(:has_no_text?).with("foo").and_return(true) - expect { subject.has_no_text? 'foo' } + expect { subject.has_no_text? "foo" } .to output(/has_no_text\?\('foo'\) returned true/).to_stdout_from_any_process end - it 'logs finished_loading?' do + it "logs finished_loading?" do expect { subject.finished_loading? } .to output(/waiting for loading to complete\.\.\./).to_stdout_from_any_process expect { subject.finished_loading? } .to output(/loading complete after .* seconds$/).to_stdout_from_any_process end - it 'logs within_element' do + it "logs within_element" do expect { subject.within_element(:element) } .to output(/within element :element/).to_stdout_from_any_process expect { subject.within_element(:element) } .to output(/end within element :element/).to_stdout_from_any_process end - context 'all_elements' do - it 'logs the number of elements found' do + context "all_elements" do + it "logs the number of elements found" do allow(page).to receive(:all).and_return([1, 2]) expect { subject.all_elements(:element) } @@ -134,7 +134,7 @@ describe QA::Support::Page::Logging do .to output(/found 2 :element/).to_stdout_from_any_process end - it 'logs 0 if no elements are found' do + it "logs 0 if no elements are found" do allow(page).to receive(:all).and_return([]) expect { subject.all_elements(:element) } diff --git a/qa/spec/page/validator_spec.rb b/qa/spec/page/validator_spec.rb index 0ae6e66d767..7c243fd638b 100644 --- a/qa/spec/page/validator_spec.rb +++ b/qa/spec/page/validator_spec.rb @@ -1,33 +1,33 @@ describe QA::Page::Validator do - describe '#constants' do + describe "#constants" do subject do described_class.new(QA::Page::Project) end - it 'returns all constants that are module children' do + it "returns all constants that are module children" do expect(subject.constants) .to include QA::Page::Project::New, QA::Page::Project::Settings end end - describe '#descendants' do + describe "#descendants" do subject do described_class.new(QA::Page::Project) end - it 'recursively returns all descendants that are page objects' do + it "recursively returns all descendants that are page objects" do expect(subject.descendants) .to include QA::Page::Project::New, QA::Page::Project::Settings::Repository end - it 'does not return modules that aggregate page objects' do + it "does not return modules that aggregate page objects" do expect(subject.descendants) .not_to include QA::Page::Project::Settings end end - context 'when checking validation errors' do - let(:view) { spy('view') } + context "when checking validation errors" do + let(:view) { spy("view") } before do allow(QA::Page::Admin::Settings::Repository) @@ -38,38 +38,38 @@ describe QA::Page::Validator do described_class.new(QA::Page::Admin) end - context 'when there are no validation errors' do + context "when there are no validation errors" do before do allow(view).to receive(:errors).and_return([]) end - describe '#errors' do - it 'does not return errors' do + describe "#errors" do + it "does not return errors" do expect(subject.errors).to be_empty end end - describe '#validate!' do - it 'does not raise error' do + describe "#validate!" do + it "does not raise error" do expect { subject.validate! }.not_to raise_error end end end - context 'when there are validation errors' do + context "when there are validation errors" do before do allow(view).to receive(:errors) - .and_return(['some error', 'another error']) + .and_return(["some error", "another error"]) end - describe '#errors' do - it 'returns errors' do + describe "#errors" do + it "returns errors" do expect(subject.errors.count).to eq 2 end end - describe '#validate!' do - it 'raises validation error' do + describe "#validate!" do + it "raises validation error" do expect { subject.validate! } .to raise_error described_class::ValidationError end diff --git a/qa/spec/page/view_spec.rb b/qa/spec/page/view_spec.rb index d7b3ccd316d..ac33de53a42 100644 --- a/qa/spec/page/view_spec.rb +++ b/qa/spec/page/view_spec.rb @@ -1,69 +1,69 @@ describe QA::Page::View do let(:element) do - double('element', name: :something, pattern: /some element/) + double("element", name: :something, pattern: /some element/) end - subject { described_class.new('some/file.html', [element]) } + subject { described_class.new("some/file.html", [element]) } - describe '.evaluate' do - it 'evaluates a block and returns a DSL object' do - results = described_class.evaluate do + describe ".evaluate" do + it "evaluates a block and returns a DSL object" do + results = described_class.evaluate { element :something element :something_else - end + } expect(results.elements.size).to eq 2 end end - describe '#pathname' do - it 'returns an absolute and clean path to the view' do - expect(subject.pathname.to_s).not_to include 'qa/page/' - expect(subject.pathname.to_s).to include 'some/file.html' + describe "#pathname" do + it "returns an absolute and clean path to the view" do + expect(subject.pathname.to_s).not_to include "qa/page/" + expect(subject.pathname.to_s).to include "some/file.html" end end - describe '#errors' do - context 'when view partial is present' do + describe "#errors" do + context "when view partial is present" do before do allow(subject.pathname).to receive(:readable?) .and_return(true) end - context 'when pattern is found' do + context "when pattern is found" do before do allow(::File).to receive(:foreach) - .and_yield('some element').once + .and_yield("some element").once allow(element).to receive(:matches?) - .with('some element').and_return(true) + .with("some element").and_return(true) end - it 'walks through the view and asserts on elements existence' do + it "walks through the view and asserts on elements existence" do expect(subject.errors).to be_empty end end - context 'when pattern has not been found' do + context "when pattern has not been found" do before do allow(::File).to receive(:foreach) - .and_yield('some element').once + .and_yield("some element").once allow(element).to receive(:matches?) - .with('some element').and_return(false) + .with("some element").and_return(false) end - it 'returns an array of errors related to missing elements' do + it "returns an array of errors related to missing elements" do expect(subject.errors).not_to be_empty expect(subject.errors.first) - .to match %r(Missing element `.*` in `.*/some/file.html` view) + .to match %r{Missing element `.*` in `.*/some/file.html` view} end end end - context 'when view partial has not been found' do - it 'returns an error when it is not able to find the partial' do + context "when view partial has not been found" do + it "returns an error when it is not able to find the partial" do expect(subject.errors).to be_one expect(subject.errors.first) - .to match %r(Missing view partial `.*/some/file.html`!) + .to match %r{Missing view partial `.*/some/file.html`!} end end end diff --git a/qa/spec/resource/api_fabricator_spec.rb b/qa/spec/resource/api_fabricator_spec.rb index a5ed4422f6e..03066fd0dc9 100644 --- a/qa/spec/resource/api_fabricator_spec.rb +++ b/qa/spec/resource/api_fabricator_spec.rb @@ -4,7 +4,7 @@ describe QA::Resource::ApiFabricator do let(:resource_without_api_support) do Class.new do def self.name - 'FooBarResource' + "FooBarResource" end end end @@ -12,105 +12,105 @@ describe QA::Resource::ApiFabricator do let(:resource_with_api_support) do Class.new do def self.name - 'FooBarResource' + "FooBarResource" end def api_get_path - '/foo' + "/foo" end def api_post_path - '/bar' + "/bar" end def api_post_body - { name: 'John Doe' } + {name: "John Doe"} end end end before do - allow(subject).to receive(:current_url).and_return('') + allow(subject).to receive(:current_url).and_return("") end subject { resource.tap { |f| f.include(described_class) }.new } - describe '#api_support?' do - let(:api_client) { spy('Runtime::API::Client') } - let(:api_client_instance) { double('API Client') } + describe "#api_support?" do + let(:api_client) { spy("Runtime::API::Client") } + let(:api_client_instance) { double("API Client") } - context 'when resource does not support fabrication via the API' do + context "when resource does not support fabrication via the API" do let(:resource) { resource_without_api_support } - it 'returns false' do + it "returns false" do expect(subject).not_to be_api_support end end - context 'when resource supports fabrication via the API' do + context "when resource supports fabrication via the API" do let(:resource) { resource_with_api_support } - it 'returns false' do + it "returns false" do expect(subject).to be_api_support end end end - describe '#fabricate_via_api!' do - let(:api_client) { spy('Runtime::API::Client') } - let(:api_client_instance) { double('API Client') } + describe "#fabricate_via_api!" do + let(:api_client) { spy("Runtime::API::Client") } + let(:api_client_instance) { double("API Client") } before do - stub_const('QA::Runtime::API::Client', api_client) + stub_const("QA::Runtime::API::Client", api_client) allow(api_client).to receive(:new).and_return(api_client_instance) - allow(api_client_instance).to receive(:personal_access_token).and_return('foo') + allow(api_client_instance).to receive(:personal_access_token).and_return("foo") end - context 'when resource does not support fabrication via the API' do + context "when resource does not support fabrication via the API" do let(:resource) { resource_without_api_support } - it 'raises a NotImplementedError exception' do + it "raises a NotImplementedError exception" do expect { subject.fabricate_via_api! }.to raise_error(NotImplementedError, "Resource FooBarResource does not support fabrication via the API!") end end - context 'when resource supports fabrication via the API' do + context "when resource supports fabrication via the API" do let(:resource) { resource_with_api_support } - let(:api_request) { spy('Runtime::API::Request') } - let(:resource_web_url) { 'http://example.org/api/v4/foo' } - let(:response) { { id: 1, name: 'John Doe', web_url: resource_web_url } } - let(:raw_post) { double('Raw POST response', code: 201, body: response.to_json) } + let(:api_request) { spy("Runtime::API::Request") } + let(:resource_web_url) { "http://example.org/api/v4/foo" } + let(:response) { {id: 1, name: "John Doe", web_url: resource_web_url} } + let(:raw_post) { double("Raw POST response", code: 201, body: response.to_json) } before do - stub_const('QA::Runtime::API::Request', api_request) + stub_const("QA::Runtime::API::Request", api_request) allow(api_request).to receive(:new).and_return(double(url: resource_web_url)) end - context 'when creating a resource' do + context "when creating a resource" do before do allow(subject).to receive(:post).with(resource_web_url, subject.api_post_body).and_return(raw_post) end - it 'returns the resource URL' do + it "returns the resource URL" do expect(api_request).to receive(:new).with(api_client_instance, subject.api_post_path).and_return(double(url: resource_web_url)) expect(subject).to receive(:post).with(resource_web_url, subject.api_post_body).and_return(raw_post) expect(subject.fabricate_via_api!).to eq(resource_web_url) end - it 'populates api_resource with the resource' do + it "populates api_resource with the resource" do subject.fabricate_via_api! expect(subject.api_resource).to eq(response) end - context 'when the POST fails' do - let(:post_response) { { error: "Name already taken." } } - let(:raw_post) { double('Raw POST response', code: 400, body: post_response.to_json) } + context "when the POST fails" do + let(:post_response) { {error: "Name already taken."} } + let(:raw_post) { double("Raw POST response", code: 400, body: post_response.to_json) } - it 'raises a ResourceFabricationFailedError exception' do + it "raises a ResourceFabricationFailedError exception" do expect(api_request).to receive(:new).with(api_client_instance, subject.api_post_path).and_return(double(url: resource_web_url)) expect(subject).to receive(:post).with(resource_web_url, subject.api_post_body).and_return(raw_post) @@ -120,36 +120,36 @@ describe QA::Resource::ApiFabricator do end end - context '#transform_api_resource' do + context "#transform_api_resource" do let(:resource) do Class.new do def self.name - 'FooBarResource' + "FooBarResource" end def api_get_path - '/foo' + "/foo" end def api_post_path - '/bar' + "/bar" end def api_post_body - { name: 'John Doe' } + {name: "John Doe"} end def transform_api_resource(resource) - resource[:new] = 'foobar' + resource[:new] = "foobar" resource end end end - let(:response) { { existing: 'foo', web_url: resource_web_url } } - let(:transformed_resource) { { existing: 'foo', new: 'foobar', web_url: resource_web_url } } + let(:response) { {existing: "foo", web_url: resource_web_url} } + let(:transformed_resource) { {existing: "foo", new: "foobar", web_url: resource_web_url} } - it 'transforms the resource' do + it "transforms the resource" do expect(subject).to receive(:post).with(resource_web_url, subject.api_post_body).and_return(raw_post) expect(subject).to receive(:transform_api_resource).with(response).and_return(transformed_resource) diff --git a/qa/spec/resource/base_spec.rb b/qa/spec/resource/base_spec.rb index 4a6b76c869f..2b72b90f499 100644 --- a/qa/spec/resource/base_spec.rb +++ b/qa/spec/resource/base_spec.rb @@ -3,14 +3,14 @@ describe QA::Resource::Base do include Helpers::StubENV - let(:resource) { spy('resource') } - let(:location) { 'http://location' } + let(:resource) { spy("resource") } + let(:location) { "http://location" } - shared_context 'fabrication context' do + shared_context "fabrication context" do subject do Class.new(described_class) do def self.name - 'MyResource' + "MyResource" end end end @@ -21,10 +21,10 @@ describe QA::Resource::Base do end end - shared_examples 'fabrication method' do |fabrication_method_called, actual_fabrication_method = nil| + shared_examples "fabrication method" do |fabrication_method_called, actual_fabrication_method = nil| let(:fabrication_method_used) { actual_fabrication_method || fabrication_method_called } - it 'yields resource before calling resource method' do + it "yields resource before calling resource method" do expect(resource).to receive(:something!).ordered expect(resource).to receive(fabrication_method_used).ordered.and_return(location) @@ -33,30 +33,30 @@ describe QA::Resource::Base do end end - it 'does not log the resource and build method when QA_DEBUG=false' do - stub_env('QA_DEBUG', 'false') + it "does not log the resource and build method when QA_DEBUG=false" do + stub_env("QA_DEBUG", "false") expect(resource).to receive(fabrication_method_used).and_return(location) - expect { subject.public_send(fabrication_method_called, 'something', resource: resource) } + expect { subject.public_send(fabrication_method_called, "something", resource: resource) } .not_to output.to_stdout end end - describe '.fabricate!' do - context 'when resource does not support fabrication via the API' do + describe ".fabricate!" do + context "when resource does not support fabrication via the API" do before do expect(described_class).to receive(:fabricate_via_api!).and_raise(NotImplementedError) end - it 'calls .fabricate_via_browser_ui!' do + it "calls .fabricate_via_browser_ui!" do expect(described_class).to receive(:fabricate_via_browser_ui!) described_class.fabricate! end end - context 'when resource supports fabrication via the API' do - it 'calls .fabricate_via_browser_ui!' do + context "when resource supports fabrication via the API" do + it "calls .fabricate_via_browser_ui!" do expect(described_class).to receive(:fabricate_via_api!) described_class.fabricate! @@ -64,12 +64,12 @@ describe QA::Resource::Base do end end - describe '.fabricate_via_api!' do - include_context 'fabrication context' + describe ".fabricate_via_api!" do + include_context "fabrication context" - it_behaves_like 'fabrication method', :fabricate_via_api! + it_behaves_like "fabrication method", :fabricate_via_api! - it 'instantiates the resource, calls resource method returns the resource' do + it "instantiates the resource, calls resource method returns the resource" do expect(resource).to receive(:fabricate_via_api!).and_return(location) result = subject.fabricate_via_api!(resource: resource, parents: []) @@ -77,57 +77,57 @@ describe QA::Resource::Base do expect(result).to eq(resource) end - it 'logs the resource and build method when QA_DEBUG=true' do - stub_env('QA_DEBUG', 'true') + it "logs the resource and build method when QA_DEBUG=true" do + stub_env("QA_DEBUG", "true") expect(resource).to receive(:fabricate_via_api!).and_return(location) - expect { subject.fabricate_via_api!('something', resource: resource, parents: []) } + expect { subject.fabricate_via_api!("something", resource: resource, parents: []) } .to output(/==> Built a MyResource via api in [\d\.\-e]+ seconds+/) .to_stdout end end - describe '.fabricate_via_browser_ui!' do - include_context 'fabrication context' + describe ".fabricate_via_browser_ui!" do + include_context "fabrication context" - it_behaves_like 'fabrication method', :fabricate_via_browser_ui!, :fabricate! + it_behaves_like "fabrication method", :fabricate_via_browser_ui!, :fabricate! - it 'instantiates the resource and calls resource method' do - subject.fabricate_via_browser_ui!('something', resource: resource, parents: []) + it "instantiates the resource and calls resource method" do + subject.fabricate_via_browser_ui!("something", resource: resource, parents: []) - expect(resource).to have_received(:fabricate!).with('something') + expect(resource).to have_received(:fabricate!).with("something") end - it 'returns fabrication resource' do - result = subject.fabricate_via_browser_ui!('something', resource: resource, parents: []) + it "returns fabrication resource" do + result = subject.fabricate_via_browser_ui!("something", resource: resource, parents: []) expect(result).to eq(resource) end - it 'logs the resource and build method when QA_DEBUG=true' do - stub_env('QA_DEBUG', 'true') + it "logs the resource and build method when QA_DEBUG=true" do + stub_env("QA_DEBUG", "true") - expect { subject.fabricate_via_browser_ui!('something', resource: resource, parents: []) } + expect { subject.fabricate_via_browser_ui!("something", resource: resource, parents: []) } .to output(/==> Built a MyResource via browser_ui in [\d\.\-e]+ seconds+/) .to_stdout end end - shared_context 'simple resource' do + shared_context "simple resource" do subject do Class.new(QA::Resource::Base) do attribute :test do - 'block' + "block" end attribute :no_block def fabricate! - 'any' + "any" end def self.current_url - 'http://stub' + "http://stub" end end end @@ -135,78 +135,78 @@ describe QA::Resource::Base do let(:resource) { subject.new } end - describe '.attribute' do - include_context 'simple resource' + describe ".attribute" do + include_context "simple resource" - context 'when the attribute is populated via a block' do - it 'returns value from the block' do + context "when the attribute is populated via a block" do + it "returns value from the block" do result = subject.fabricate!(resource: resource) expect(result).to be_a(described_class) - expect(result.test).to eq('block') + expect(result.test).to eq("block") end end - context 'when the attribute is populated via the api' do - let(:api_resource) { { no_block: 'api' } } + context "when the attribute is populated via the api" do + let(:api_resource) { {no_block: "api"} } before do expect(resource).to receive(:api_resource).and_return(api_resource) end - it 'returns value from api' do + it "returns value from api" do result = subject.fabricate!(resource: resource) expect(result).to be_a(described_class) - expect(result.no_block).to eq('api') + expect(result.no_block).to eq("api") end - context 'when the attribute also has a block' do - let(:api_resource) { { test: 'api_with_block' } } + context "when the attribute also has a block" do + let(:api_resource) { {test: "api_with_block"} } before do allow(QA::Runtime::Logger).to receive(:info) end - it 'returns value from api and emits an INFO log entry' do + it "returns value from api and emits an INFO log entry" do result = subject.fabricate!(resource: resource) expect(result).to be_a(described_class) - expect(result.test).to eq('api_with_block') + expect(result.test).to eq("api_with_block") expect(QA::Runtime::Logger) .to have_received(:info).with(/api_with_block/) end end end - context 'when the attribute is populated via direct assignment' do + context "when the attribute is populated via direct assignment" do before do - resource.test = 'value' + resource.test = "value" end - it 'returns value from the assignment' do + it "returns value from the assignment" do result = subject.fabricate!(resource: resource) expect(result).to be_a(described_class) - expect(result.test).to eq('value') + expect(result.test).to eq("value") end - context 'when the api also has such response' do + context "when the api also has such response" do before do - allow(resource).to receive(:api_resource).and_return({ test: 'api' }) + allow(resource).to receive(:api_resource).and_return({test: "api"}) end - it 'returns value from the assignment' do + it "returns value from the assignment" do result = subject.fabricate!(resource: resource) expect(result).to be_a(described_class) - expect(result.test).to eq('value') + expect(result.test).to eq("value") end end end - context 'when the attribute has no value' do - it 'raises an error because no values could be found' do + context "when the attribute has no value" do + it "raises an error because no values could be found" do result = subject.fabricate!(resource: resource) expect { result.no_block } @@ -214,61 +214,61 @@ describe QA::Resource::Base do end end - context 'when multiple resources have the same attribute name' do + context "when multiple resources have the same attribute name" do let(:base) do Class.new(QA::Resource::Base) do def fabricate! - 'any' + "any" end def self.current_url - 'http://stub' + "http://stub" end end end let(:first_resource) do Class.new(base) do attribute :test do - 'first block' + "first block" end end end let(:second_resource) do Class.new(base) do attribute :test do - 'second block' + "second block" end end end - it 'has unique attribute values' do + it "has unique attribute values" do first_result = first_resource.fabricate!(resource: first_resource.new) second_result = second_resource.fabricate!(resource: second_resource.new) - expect(first_result.test).to eq 'first block' - expect(second_result.test).to eq 'second block' + expect(first_result.test).to eq "first block" + expect(second_result.test).to eq "second block" end end end - describe '#web_url' do - include_context 'simple resource' + describe "#web_url" do + include_context "simple resource" - it 'sets #web_url to #current_url after fabrication' do + it "sets #web_url to #current_url after fabrication" do subject.fabricate!(resource: resource) expect(resource.web_url).to eq(subject.current_url) end end - describe '#visit!' do - include_context 'simple resource' + describe "#visit!" do + include_context "simple resource" before do allow(resource).to receive(:visit) end - it 'calls #visit with the underlying #web_url' do + it "calls #visit with the underlying #web_url" do resource.web_url = subject.current_url resource.visit! diff --git a/qa/spec/resource/events/base_spec.rb b/qa/spec/resource/events/base_spec.rb index 9cdf4785092..bebf67e40c9 100644 --- a/qa/spec/resource/events/base_spec.rb +++ b/qa/spec/resource/events/base_spec.rb @@ -4,7 +4,7 @@ describe QA::Resource::Events::Base do let(:resource) do Class.new(QA::Resource::Base) do def api_get_path - '/foo' + "/foo" end end end @@ -12,18 +12,18 @@ describe QA::Resource::Events::Base do subject { resource.tap { |f| f.include(described_class) }.new } describe "#events" do - it 'fetches all events when called without parameters' do - allow(subject).to receive(:parse_body).and_return('returned') + it "fetches all events when called without parameters" do + allow(subject).to receive(:parse_body).and_return("returned") - expect(subject).to receive(:api_get_from).with('/foo/events') - expect(subject.events).to eq('returned') + expect(subject).to receive(:api_get_from).with("/foo/events") + expect(subject.events).to eq("returned") end - it 'fetches events with a specified action type' do - allow(subject).to receive(:parse_body).and_return('returned') + it "fetches events with a specified action type" do + allow(subject).to receive(:parse_body).and_return("returned") - expect(subject).to receive(:api_get_from).with('/foo/events?action=pushed') - expect(subject.events(action: 'pushed')).to eq('returned') + expect(subject).to receive(:api_get_from).with("/foo/events?action=pushed") + expect(subject.events(action: "pushed")).to eq("returned") end end end diff --git a/qa/spec/resource/events/project_spec.rb b/qa/spec/resource/events/project_spec.rb index b3efdb518f3..0f96b2a1d31 100644 --- a/qa/spec/resource/events/project_spec.rb +++ b/qa/spec/resource/events/project_spec.rb @@ -4,7 +4,7 @@ describe QA::Resource::Events::Project do let(:resource) do Class.new(QA::Resource::Base) do def api_get_path - '/foo' + "/foo" end end end @@ -13,21 +13,21 @@ describe QA::Resource::Events::Project do { "action_name": "pushed", "push_data": { - "commit_title": "foo commit" - } + "commit_title": "foo commit", + }, }, { "action_name": "pushed", "push_data": { - "ref": "master" - } + "ref": "master", + }, }, { "action_name": "pushed", "push_data": { - "ref": "another-branch" - } - } + "ref": "another-branch", + }, + }, ] end @@ -39,31 +39,31 @@ describe QA::Resource::Events::Project do subject { resource.tap { |f| f.include(described_class) }.new } describe "#wait_for_push" do - it 'waits for a push with a specified commit message' do - expect(subject).to receive(:api_get_from).with('/foo/events?action=pushed') - expect { subject.wait_for_push('foo commit') }.not_to raise_error + it "waits for a push with a specified commit message" do + expect(subject).to receive(:api_get_from).with("/foo/events?action=pushed") + expect { subject.wait_for_push("foo commit") }.not_to raise_error end - it 'raises an error if a push with the specified commit message is not found' do - expect(subject).to receive(:api_get_from).with('/foo/events?action=pushed').at_least(:once) - expect { subject.wait_for_push('bar') }.to raise_error(QA::Resource::Events::EventNotFoundError) + it "raises an error if a push with the specified commit message is not found" do + expect(subject).to receive(:api_get_from).with("/foo/events?action=pushed").at_least(:once) + expect { subject.wait_for_push("bar") }.to raise_error(QA::Resource::Events::EventNotFoundError) end end describe "#wait_for_push_new_branch" do - it 'waits for a push to master if no branch is given' do - expect(subject).to receive(:api_get_from).with('/foo/events?action=pushed') + it "waits for a push to master if no branch is given" do + expect(subject).to receive(:api_get_from).with("/foo/events?action=pushed") expect { subject.wait_for_push_new_branch }.not_to raise_error end - it 'waits for a push to the given branch' do - expect(subject).to receive(:api_get_from).with('/foo/events?action=pushed') - expect { subject.wait_for_push_new_branch('another-branch') }.not_to raise_error + it "waits for a push to the given branch" do + expect(subject).to receive(:api_get_from).with("/foo/events?action=pushed") + expect { subject.wait_for_push_new_branch("another-branch") }.not_to raise_error end - it 'raises an error if a push with the specified branch is not found' do - expect(subject).to receive(:api_get_from).with('/foo/events?action=pushed').at_least(:once) - expect { subject.wait_for_push_new_branch('bar') }.to raise_error(QA::Resource::Events::EventNotFoundError) + it "raises an error if a push with the specified branch is not found" do + expect(subject).to receive(:api_get_from).with("/foo/events?action=pushed").at_least(:once) + expect { subject.wait_for_push_new_branch("bar") }.to raise_error(QA::Resource::Events::EventNotFoundError) end end end diff --git a/qa/spec/resource/repository/push_spec.rb b/qa/spec/resource/repository/push_spec.rb index bf3ebce0cfe..dab0a00cc85 100644 --- a/qa/spec/resource/repository/push_spec.rb +++ b/qa/spec/resource/repository/push_spec.rb @@ -1,25 +1,25 @@ # frozen_string_literal: true describe QA::Resource::Repository::Push do - describe '.files=' do + describe ".files=" do let(:files) do [ { - name: 'file.txt', - content: 'foo' - } + name: "file.txt", + content: "foo", + }, ] end - it 'raises an error if files is not an array' do - expect { subject.files = '' }.to raise_error(ArgumentError) + it "raises an error if files is not an array" do + expect { subject.files = "" }.to raise_error(ArgumentError) end - it 'raises an error if files is an empty array' do + it "raises an error if files is an empty array" do expect { subject.files = [] }.to raise_error(ArgumentError) end - it 'does not raise if files is an array' do + it "does not raise if files is an array" do expect { subject.files = files }.not_to raise_error end end diff --git a/qa/spec/resource/user_spec.rb b/qa/spec/resource/user_spec.rb index d612dfc530e..dec08629701 100644 --- a/qa/spec/resource/user_spec.rb +++ b/qa/spec/resource/user_spec.rb @@ -6,88 +6,88 @@ describe QA::Resource::User do name: "GitLab QA", username: "gitlab-qa", web_url: "https://staging.gitlab.com/gitlab-qa", - public_email: "1614863-gitlab-qa@users.noreply.staging.gitlab.com" + public_email: "1614863-gitlab-qa@users.noreply.staging.gitlab.com", } end - describe '#username' do - it 'generates a default username' do + describe "#username" do + it "generates a default username" do expect(subject.username).to match(/qa-user-\w+/) end - it 'is possible to set the username' do - subject.username = 'johndoe' + it "is possible to set the username" do + subject.username = "johndoe" - expect(subject.username).to eq('johndoe') + expect(subject.username).to eq("johndoe") end end - describe '#password' do - it 'generates a default password' do - expect(subject.password).to eq('password') + describe "#password" do + it "generates a default password" do + expect(subject.password).to eq("password") end - it 'is possible to set the password' do - subject.password = 'secret' + it "is possible to set the password" do + subject.password = "secret" - expect(subject.password).to eq('secret') + expect(subject.password).to eq("secret") end end - describe '#name' do - it 'defaults to the username' do + describe "#name" do + it "defaults to the username" do expect(subject.name).to eq(subject.username) end - it 'retrieves the name from the api_resource if present' do + it "retrieves the name from the api_resource if present" do subject.__send__(:api_resource=, api_resource) expect(subject.name).to eq(api_resource[:name]) end - it 'is possible to set the name' do - subject.name = 'John Doe' + it "is possible to set the name" do + subject.name = "John Doe" - expect(subject.name).to eq('John Doe') + expect(subject.name).to eq("John Doe") end end - describe '#email' do - it 'defaults to the <username>@example.com' do + describe "#email" do + it "defaults to the <username>@example.com" do expect(subject.email).to eq("#{subject.username}@example.com") end - it 'is possible to set the email' do - subject.email = 'johndoe@example.org' + it "is possible to set the email" do + subject.email = "johndoe@example.org" - expect(subject.email).to eq('johndoe@example.org') + expect(subject.email).to eq("johndoe@example.org") end end - describe '#public_email' do - it 'defaults to QA::Runtime::User.default_email' do + describe "#public_email" do + it "defaults to QA::Runtime::User.default_email" do expect(subject.public_email).to eq(QA::Runtime::User.default_email) end - it 'retrieves the public_email from the api_resource if present' do + it "retrieves the public_email from the api_resource if present" do subject.__send__(:api_resource=, api_resource) expect(subject.public_email).to eq(api_resource[:public_email]) end - it 'defaults to QA::Runtime::User.default_email if the public_email from the api_resource is blank' do - subject.__send__(:api_resource=, api_resource.merge(public_email: '')) + it "defaults to QA::Runtime::User.default_email if the public_email from the api_resource is blank" do + subject.__send__(:api_resource=, api_resource.merge(public_email: "")) expect(subject.public_email).to eq(QA::Runtime::User.default_email) end end - describe '#credentials_given?' do - it 'returns false when username and email have not been overridden' do + describe "#credentials_given?" do + it "returns false when username and email have not been overridden" do expect(subject).not_to be_credentials_given end - it 'returns false even after username and email have been called' do + it "returns false even after username and email have been called" do # Call #username and #password to ensure this doesn't set their respective # instance variable. subject.username @@ -96,21 +96,21 @@ describe QA::Resource::User do expect(subject).not_to be_credentials_given end - it 'returns false if only the username has been overridden' do - subject.username = 'johndoe' + it "returns false if only the username has been overridden" do + subject.username = "johndoe" expect(subject).not_to be_credentials_given end - it 'returns false if only the password has been overridden' do - subject.password = 'secret' + it "returns false if only the password has been overridden" do + subject.password = "secret" expect(subject).not_to be_credentials_given end - it 'returns true if both the username and password have been overridden' do - subject.username = 'johndoe' - subject.password = 'secret' + it "returns true if both the username and password have been overridden" do + subject.username = "johndoe" + subject.password = "secret" expect(subject).to be_credentials_given end diff --git a/qa/spec/runtime/api/client_spec.rb b/qa/spec/runtime/api/client_spec.rb index af43facc73d..3a0a01a74b1 100644 --- a/qa/spec/runtime/api/client_spec.rb +++ b/qa/spec/runtime/api/client_spec.rb @@ -1,38 +1,38 @@ describe QA::Runtime::API::Client do include Helpers::StubENV - describe 'initialization' do - it 'defaults to :gitlab address' do + describe "initialization" do + it "defaults to :gitlab address" do expect(described_class.new.address).to eq :gitlab end - it 'uses specified address' do - client = described_class.new('http:///example.com') + it "uses specified address" do + client = described_class.new("http:///example.com") - expect(client.address).to eq 'http:///example.com' + expect(client.address).to eq "http:///example.com" end end - describe '#personal_access_token' do - context 'when QA::Runtime::Env.personal_access_token is present' do + describe "#personal_access_token" do + context "when QA::Runtime::Env.personal_access_token is present" do before do - allow(QA::Runtime::Env).to receive(:personal_access_token).and_return('a_token') + allow(QA::Runtime::Env).to receive(:personal_access_token).and_return("a_token") end - it 'returns specified token from env' do - expect(described_class.new.personal_access_token).to eq 'a_token' + it "returns specified token from env" do + expect(described_class.new.personal_access_token).to eq "a_token" end end - context 'when QA::Runtime::Env.personal_access_token is nil' do + context "when QA::Runtime::Env.personal_access_token is nil" do before do allow(QA::Runtime::Env).to receive(:personal_access_token).and_return(nil) end - it 'returns a created token' do - expect(subject).to receive(:create_personal_access_token).and_return('created_token') + it "returns a created token" do + expect(subject).to receive(:create_personal_access_token).and_return("created_token") - expect(subject.personal_access_token).to eq 'created_token' + expect(subject.personal_access_token).to eq "created_token" end end end diff --git a/qa/spec/runtime/api/request_spec.rb b/qa/spec/runtime/api/request_spec.rb index 08233e3c1d6..48b024b8733 100644 --- a/qa/spec/runtime/api/request_spec.rb +++ b/qa/spec/runtime/api/request_spec.rb @@ -1,50 +1,50 @@ describe QA::Runtime::API::Request do - let(:client) { QA::Runtime::API::Client.new('http://example.com') } - let(:request) { described_class.new(client, '/users') } + let(:client) { QA::Runtime::API::Client.new("http://example.com") } + let(:request) { described_class.new(client, "/users") } before do - allow(client).to receive(:personal_access_token).and_return('a_token') + allow(client).to receive(:personal_access_token).and_return("a_token") end - describe '#url' do - it 'returns the full API request url' do - expect(request.url).to eq 'http://example.com/api/v4/users?private_token=a_token' + describe "#url" do + it "returns the full API request url" do + expect(request.url).to eq "http://example.com/api/v4/users?private_token=a_token" end - context 'when oauth_access_token is passed in the query string' do - let(:request) { described_class.new(client, '/users', { oauth_access_token: 'foo' }) } + context "when oauth_access_token is passed in the query string" do + let(:request) { described_class.new(client, "/users", {oauth_access_token: "foo"}) } - it 'does not adds a private_token query string' do - expect(request.url).to eq 'http://example.com/api/v4/users?oauth_access_token=foo' + it "does not adds a private_token query string" do + expect(request.url).to eq "http://example.com/api/v4/users?oauth_access_token=foo" end end end - describe '#request_path' do - it 'prepends the api path' do - expect(request.request_path('/users')).to eq '/api/v4/users' + describe "#request_path" do + it "prepends the api path" do + expect(request.request_path("/users")).to eq "/api/v4/users" end - it 'adds the personal access token' do - expect(request.request_path('/users', private_token: 'token')) - .to eq '/api/v4/users?private_token=token' + it "adds the personal access token" do + expect(request.request_path("/users", private_token: "token")) + .to eq "/api/v4/users?private_token=token" end - it 'adds the oauth access token' do - expect(request.request_path('/users', access_token: 'otoken')) - .to eq '/api/v4/users?access_token=otoken' + it "adds the oauth access token" do + expect(request.request_path("/users", access_token: "otoken")) + .to eq "/api/v4/users?access_token=otoken" end - it 'respects query parameters' do - expect(request.request_path('/users?page=1')).to eq '/api/v4/users?page=1' - expect(request.request_path('/users', private_token: 'token', foo: 'bar/baz')) - .to eq '/api/v4/users?private_token=token&foo=bar%2Fbaz' - expect(request.request_path('/users?page=1', private_token: 'token', foo: 'bar/baz')) - .to eq '/api/v4/users?page=1&private_token=token&foo=bar%2Fbaz' + it "respects query parameters" do + expect(request.request_path("/users?page=1")).to eq "/api/v4/users?page=1" + expect(request.request_path("/users", private_token: "token", foo: "bar/baz")) + .to eq "/api/v4/users?private_token=token&foo=bar%2Fbaz" + expect(request.request_path("/users?page=1", private_token: "token", foo: "bar/baz")) + .to eq "/api/v4/users?page=1&private_token=token&foo=bar%2Fbaz" end - it 'uses a different api version' do - expect(request.request_path('/users', version: 'other_version')).to eq '/api/other_version/users' + it "uses a different api version" do + expect(request.request_path("/users", version: "other_version")).to eq "/api/other_version/users" end end end diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb index fc51f45c3a1..60def583fb1 100644 --- a/qa/spec/runtime/env_spec.rb +++ b/qa/spec/runtime/env_spec.rb @@ -3,36 +3,36 @@ describe QA::Runtime::Env do include Helpers::StubENV - shared_examples 'boolean method' do |**kwargs| - it_behaves_like 'boolean method with parameter', kwargs + shared_examples "boolean method" do |**kwargs| + it_behaves_like "boolean method with parameter", kwargs end - shared_examples 'boolean method with parameter' do |method:, param: nil, env_key:, default:| - context 'when there is an env variable set' do - it 'returns false when falsey values specified' do - stub_env(env_key, 'false') + shared_examples "boolean method with parameter" do |method:, param: nil, env_key:, default:| + context "when there is an env variable set" do + it "returns false when falsey values specified" do + stub_env(env_key, "false") expect(described_class.public_send(method, *param)).to be_falsey - stub_env(env_key, 'no') + stub_env(env_key, "no") expect(described_class.public_send(method, *param)).to be_falsey - stub_env(env_key, '0') + stub_env(env_key, "0") expect(described_class.public_send(method, *param)).to be_falsey end - it 'returns true when anything else specified' do - stub_env(env_key, 'true') + it "returns true when anything else specified" do + stub_env(env_key, "true") expect(described_class.public_send(method, *param)).to be_truthy - stub_env(env_key, '1') + stub_env(env_key, "1") expect(described_class.public_send(method, *param)).to be_truthy - stub_env(env_key, 'anything') + stub_env(env_key, "anything") expect(described_class.public_send(method, *param)).to be_truthy end end - context 'when there is no env variable set' do + context "when there is no env variable set" do it "returns the default, #{default}" do stub_env(env_key, nil) expect(described_class.public_send(method, *param)).to be(default) @@ -40,229 +40,229 @@ describe QA::Runtime::Env do end end - describe '.signup_disabled?' do - it_behaves_like 'boolean method', + describe ".signup_disabled?" do + it_behaves_like "boolean method", method: :signup_disabled?, - env_key: 'SIGNUP_DISABLED', + env_key: "SIGNUP_DISABLED", default: false end - describe '.debug?' do - it_behaves_like 'boolean method', + describe ".debug?" do + it_behaves_like "boolean method", method: :debug?, - env_key: 'QA_DEBUG', + env_key: "QA_DEBUG", default: false end - describe '.chrome_headless?' do - it_behaves_like 'boolean method', + describe ".chrome_headless?" do + it_behaves_like "boolean method", method: :chrome_headless?, - env_key: 'CHROME_HEADLESS', + env_key: "CHROME_HEADLESS", default: true end - describe '.running_in_ci?' do - context 'when there is an env variable set' do - it 'returns true if CI' do - stub_env('CI', 'anything') + describe ".running_in_ci?" do + context "when there is an env variable set" do + it "returns true if CI" do + stub_env("CI", "anything") expect(described_class.running_in_ci?).to be_truthy end - it 'returns true if CI_SERVER' do - stub_env('CI_SERVER', 'anything') + it "returns true if CI_SERVER" do + stub_env("CI_SERVER", "anything") expect(described_class.running_in_ci?).to be_truthy end end - context 'when there is no env variable set' do - it 'returns true' do - stub_env('CI', nil) - stub_env('CI_SERVER', nil) + context "when there is no env variable set" do + it "returns true" do + stub_env("CI", nil) + stub_env("CI_SERVER", nil) expect(described_class.running_in_ci?).to be_falsey end end end - describe '.personal_access_token' do + describe ".personal_access_token" do around do |example| described_class.instance_variable_set(:@personal_access_token, nil) example.run described_class.instance_variable_set(:@personal_access_token, nil) end - context 'when PERSONAL_ACCESS_TOKEN is set' do + context "when PERSONAL_ACCESS_TOKEN is set" do before do - stub_env('PERSONAL_ACCESS_TOKEN', 'a_token') + stub_env("PERSONAL_ACCESS_TOKEN", "a_token") end - it 'returns specified token from env' do - expect(described_class.personal_access_token).to eq 'a_token' + it "returns specified token from env" do + expect(described_class.personal_access_token).to eq "a_token" end end - context 'when @personal_access_token is set' do + context "when @personal_access_token is set" do before do - described_class.personal_access_token = 'another_token' + described_class.personal_access_token = "another_token" end - it 'returns the instance variable value' do - expect(described_class.personal_access_token).to eq 'another_token' + it "returns the instance variable value" do + expect(described_class.personal_access_token).to eq "another_token" end end end - describe '.personal_access_token=' do + describe ".personal_access_token=" do around do |example| described_class.instance_variable_set(:@personal_access_token, nil) example.run described_class.instance_variable_set(:@personal_access_token, nil) end - it 'saves the token' do - described_class.personal_access_token = 'a_token' + it "saves the token" do + described_class.personal_access_token = "a_token" - expect(described_class.personal_access_token).to eq 'a_token' + expect(described_class.personal_access_token).to eq "a_token" end end - describe '.forker?' do + describe ".forker?" do before do - stub_env('GITLAB_FORKER_USERNAME', nil) - stub_env('GITLAB_FORKER_PASSWORD', nil) + stub_env("GITLAB_FORKER_USERNAME", nil) + stub_env("GITLAB_FORKER_PASSWORD", nil) end - it 'returns false if no forker credentials are defined' do + it "returns false if no forker credentials are defined" do expect(described_class).not_to be_forker end - it 'returns false if only forker username is defined' do - stub_env('GITLAB_FORKER_USERNAME', 'foo') + it "returns false if only forker username is defined" do + stub_env("GITLAB_FORKER_USERNAME", "foo") expect(described_class).not_to be_forker end - it 'returns false if only forker password is defined' do - stub_env('GITLAB_FORKER_PASSWORD', 'bar') + it "returns false if only forker password is defined" do + stub_env("GITLAB_FORKER_PASSWORD", "bar") expect(described_class).not_to be_forker end - it 'returns true if forker username and password are defined' do - stub_env('GITLAB_FORKER_USERNAME', 'foo') - stub_env('GITLAB_FORKER_PASSWORD', 'bar') + it "returns true if forker username and password are defined" do + stub_env("GITLAB_FORKER_USERNAME", "foo") + stub_env("GITLAB_FORKER_PASSWORD", "bar") expect(described_class).to be_forker end end - describe '.github_access_token' do + describe ".github_access_token" do it 'returns "" if GITHUB_ACCESS_TOKEN is not defined' do - stub_env('GITHUB_ACCESS_TOKEN', nil) + stub_env("GITHUB_ACCESS_TOKEN", nil) - expect(described_class.github_access_token).to eq('') + expect(described_class.github_access_token).to eq("") end - it 'returns stripped string if GITHUB_ACCESS_TOKEN is defined' do - stub_env('GITHUB_ACCESS_TOKEN', ' abc123 ') - expect(described_class.github_access_token).to eq('abc123') + it "returns stripped string if GITHUB_ACCESS_TOKEN is defined" do + stub_env("GITHUB_ACCESS_TOKEN", " abc123 ") + expect(described_class.github_access_token).to eq("abc123") end end - describe '.require_github_access_token!' do - it 'raises ArgumentError if GITHUB_ACCESS_TOKEN is not defined' do - stub_env('GITHUB_ACCESS_TOKEN', nil) + describe ".require_github_access_token!" do + it "raises ArgumentError if GITHUB_ACCESS_TOKEN is not defined" do + stub_env("GITHUB_ACCESS_TOKEN", nil) expect { described_class.require_github_access_token! }.to raise_error(ArgumentError) end - it 'does not raise if GITHUB_ACCESS_TOKEN is defined' do - stub_env('GITHUB_ACCESS_TOKEN', ' abc123 ') + it "does not raise if GITHUB_ACCESS_TOKEN is defined" do + stub_env("GITHUB_ACCESS_TOKEN", " abc123 ") expect { described_class.require_github_access_token! }.not_to raise_error end end - describe '.log_destination' do - it 'returns $stdout if QA_LOG_PATH is not defined' do - stub_env('QA_LOG_PATH', nil) + describe ".log_destination" do + it "returns $stdout if QA_LOG_PATH is not defined" do + stub_env("QA_LOG_PATH", nil) expect(described_class.log_destination).to eq($stdout) end - it 'returns the path if QA_LOG_PATH is defined' do - stub_env('QA_LOG_PATH', 'path/to_file') + it "returns the path if QA_LOG_PATH is defined" do + stub_env("QA_LOG_PATH", "path/to_file") - expect(described_class.log_destination).to eq('path/to_file') + expect(described_class.log_destination).to eq("path/to_file") end end - describe '.can_test?' do - it_behaves_like 'boolean method with parameter', + describe ".can_test?" do + it_behaves_like "boolean method with parameter", method: :can_test?, param: :git_protocol_v2, - env_key: 'QA_CAN_TEST_GIT_PROTOCOL_V2', + env_key: "QA_CAN_TEST_GIT_PROTOCOL_V2", default: true - it 'raises ArgumentError if feature is unknown' do + it "raises ArgumentError if feature is unknown" do expect { described_class.can_test? :foo }.to raise_error(ArgumentError, 'Unknown feature "foo"') end end - describe 'remote grid credentials' do - it 'is blank if username is empty' do - stub_env('QA_REMOTE_GRID_USERNAME', nil) + describe "remote grid credentials" do + it "is blank if username is empty" do + stub_env("QA_REMOTE_GRID_USERNAME", nil) - expect(described_class.send(:remote_grid_credentials)).to eq('') + expect(described_class.send(:remote_grid_credentials)).to eq("") end - it 'throws ArgumentError if GRID_ACCESS_KEY is not specified with USERNAME' do - stub_env('QA_REMOTE_GRID_USERNAME', 'foo') + it "throws ArgumentError if GRID_ACCESS_KEY is not specified with USERNAME" do + stub_env("QA_REMOTE_GRID_USERNAME", "foo") expect { described_class.send(:remote_grid_credentials) }.to raise_error(ArgumentError, 'Please provide an access key for user "foo"') end - it 'returns a user:key@ combination when all args are satiated' do - stub_env('QA_REMOTE_GRID_USERNAME', 'foo') - stub_env('QA_REMOTE_GRID_ACCESS_KEY', 'bar') + it "returns a user:key@ combination when all args are satiated" do + stub_env("QA_REMOTE_GRID_USERNAME", "foo") + stub_env("QA_REMOTE_GRID_ACCESS_KEY", "bar") - expect(described_class.send(:remote_grid_credentials)).to eq('foo:bar@') + expect(described_class.send(:remote_grid_credentials)).to eq("foo:bar@") end end - describe '.remote_grid_protocol' do - it 'defaults protocol to http' do - stub_env('QA_REMOTE_GRID_PROTOCOL', nil) - expect(described_class.remote_grid_protocol).to eq('http') + describe ".remote_grid_protocol" do + it "defaults protocol to http" do + stub_env("QA_REMOTE_GRID_PROTOCOL", nil) + expect(described_class.remote_grid_protocol).to eq("http") end end - describe '.remote_grid' do - it 'is falsey if QA_REMOTE_GRID is not set' do + describe ".remote_grid" do + it "is falsey if QA_REMOTE_GRID is not set" do expect(described_class.remote_grid).to be_falsey end - it 'accepts https protocol' do - stub_env('QA_REMOTE_GRID', 'localhost:4444') - stub_env('QA_REMOTE_GRID_PROTOCOL', 'https') + it "accepts https protocol" do + stub_env("QA_REMOTE_GRID", "localhost:4444") + stub_env("QA_REMOTE_GRID_PROTOCOL", "https") - expect(described_class.remote_grid).to eq('https://localhost:4444/wd/hub') + expect(described_class.remote_grid).to eq("https://localhost:4444/wd/hub") end - context 'with credentials' do - it 'has a grid of http://user:key@grid/wd/hub' do - stub_env('QA_REMOTE_GRID_USERNAME', 'foo') - stub_env('QA_REMOTE_GRID_ACCESS_KEY', 'bar') - stub_env('QA_REMOTE_GRID', 'localhost:4444') + context "with credentials" do + it "has a grid of http://user:key@grid/wd/hub" do + stub_env("QA_REMOTE_GRID_USERNAME", "foo") + stub_env("QA_REMOTE_GRID_ACCESS_KEY", "bar") + stub_env("QA_REMOTE_GRID", "localhost:4444") - expect(described_class.remote_grid).to eq('http://foo:bar@localhost:4444/wd/hub') + expect(described_class.remote_grid).to eq("http://foo:bar@localhost:4444/wd/hub") end end - context 'without credentials' do - it 'has a grid of http://grid/wd/hub' do - stub_env('QA_REMOTE_GRID', 'localhost:4444') + context "without credentials" do + it "has a grid of http://grid/wd/hub" do + stub_env("QA_REMOTE_GRID", "localhost:4444") - expect(described_class.remote_grid).to eq('http://localhost:4444/wd/hub') + expect(described_class.remote_grid).to eq("http://localhost:4444/wd/hub") end end end diff --git a/qa/spec/runtime/key/ecdsa_spec.rb b/qa/spec/runtime/key/ecdsa_spec.rb index 8951e82b9bb..fb4f044de79 100644 --- a/qa/spec/runtime/key/ecdsa_spec.rb +++ b/qa/spec/runtime/key/ecdsa_spec.rb @@ -1,5 +1,5 @@ describe QA::Runtime::Key::ECDSA do - describe '#public_key' do + describe "#public_key" do [256, 384, 521].each do |bits| it "generates a public #{bits}-bits ECDSA key" do subject = described_class.new(bits).public_key @@ -9,8 +9,8 @@ describe QA::Runtime::Key::ECDSA do end end - describe '#new' do - it 'does not support arbitrary bits' do + describe "#new" do + it "does not support arbitrary bits" do expect { described_class.new(123) } .to raise_error(QA::Service::Shellout::CommandError) end diff --git a/qa/spec/runtime/key/ed25519_spec.rb b/qa/spec/runtime/key/ed25519_spec.rb index 4844e7affdf..8b8e445d543 100644 --- a/qa/spec/runtime/key/ed25519_spec.rb +++ b/qa/spec/runtime/key/ed25519_spec.rb @@ -1,8 +1,8 @@ describe QA::Runtime::Key::ED25519 do - describe '#public_key' do + describe "#public_key" do subject { described_class.new.public_key } - it 'generates a public ED25519 key' do + it "generates a public ED25519 key" do expect(subject).to match(%r{\Assh\-ed25519 AAAA[0-9A-Za-z+/]}) end end diff --git a/qa/spec/runtime/key/rsa_spec.rb b/qa/spec/runtime/key/rsa_spec.rb index fbcc7ffdcb4..85ff0f32657 100644 --- a/qa/spec/runtime/key/rsa_spec.rb +++ b/qa/spec/runtime/key/rsa_spec.rb @@ -1,8 +1,8 @@ describe QA::Runtime::Key::RSA do - describe '#public_key' do + describe "#public_key" do subject { described_class.new.public_key } - it 'generates a public RSA key' do + it "generates a public RSA key" do expect(subject).to match(%r{\Assh\-rsa AAAA[0-9A-Za-z+/]+={0,3}}) end end diff --git a/qa/spec/runtime/logger_spec.rb b/qa/spec/runtime/logger_spec.rb index 44be3381bff..db82279fd73 100644 --- a/qa/spec/runtime/logger_spec.rb +++ b/qa/spec/runtime/logger_spec.rb @@ -7,27 +7,27 @@ describe QA::Runtime::Logger do described_class.logger = logger end - it 'logs debug' do - expect { described_class.debug('test') }.to output(/DEBUG -- : test/).to_stdout_from_any_process + it "logs debug" do + expect { described_class.debug("test") }.to output(/DEBUG -- : test/).to_stdout_from_any_process end - it 'logs info' do - expect { described_class.info('test') }.to output(/INFO -- : test/).to_stdout_from_any_process + it "logs info" do + expect { described_class.info("test") }.to output(/INFO -- : test/).to_stdout_from_any_process end - it 'logs warn' do - expect { described_class.warn('test') }.to output(/WARN -- : test/).to_stdout_from_any_process + it "logs warn" do + expect { described_class.warn("test") }.to output(/WARN -- : test/).to_stdout_from_any_process end - it 'logs error' do - expect { described_class.error('test') }.to output(/ERROR -- : test/).to_stdout_from_any_process + it "logs error" do + expect { described_class.error("test") }.to output(/ERROR -- : test/).to_stdout_from_any_process end - it 'logs fatal' do - expect { described_class.fatal('test') }.to output(/FATAL -- : test/).to_stdout_from_any_process + it "logs fatal" do + expect { described_class.fatal("test") }.to output(/FATAL -- : test/).to_stdout_from_any_process end - it 'logs unknown' do - expect { described_class.unknown('test') }.to output(/ANY -- : test/).to_stdout_from_any_process + it "logs unknown" do + expect { described_class.unknown("test") }.to output(/ANY -- : test/).to_stdout_from_any_process end end diff --git a/qa/spec/runtime/release_spec.rb b/qa/spec/runtime/release_spec.rb index e6b5a8dc315..f5d2c29bfb3 100644 --- a/qa/spec/runtime/release_spec.rb +++ b/qa/spec/runtime/release_spec.rb @@ -1,26 +1,26 @@ describe QA::Runtime::Release do - context 'when release version has extension strategy' do - let(:strategy) { spy('strategy') } + context "when release version has extension strategy" do + let(:strategy) { spy("strategy") } before do - stub_const('QA::CE::Strategy', strategy) - stub_const('QA::EE::Strategy', strategy) + stub_const("QA::CE::Strategy", strategy) + stub_const("QA::EE::Strategy", strategy) end - describe '#version' do - it 'return either CE or EE version' do + describe "#version" do + it "return either CE or EE version" do expect(subject.version).to eq(:CE).or eq(:EE) end end - describe '#strategy' do - it 'return the strategy constant' do + describe "#strategy" do + it "return the strategy constant" do expect(subject.strategy).to eq strategy end end - describe 'delegated class methods' do - it 'delegates all calls to strategy class' do + describe "delegated class methods" do + it "delegates all calls to strategy class" do described_class.some_method(1, 2) expect(strategy).to have_received(:some_method) @@ -29,20 +29,20 @@ describe QA::Runtime::Release do end end - context 'when release version does not have extension strategy' do + context "when release version does not have extension strategy" do before do allow_any_instance_of(described_class) - .to receive(:version).and_return('something') + .to receive(:version).and_return("something") end - describe '#strategy' do - it 'raises error' do + describe "#strategy" do + it "raises error" do expect { subject.strategy }.to raise_error(LoadError) end end - describe 'delegated class methods' do - it 'raises error' do + describe "delegated class methods" do + it "raises error" do expect { described_class.some_method(2, 3) }.to raise_error(LoadError) end end diff --git a/qa/spec/runtime/scenario_spec.rb b/qa/spec/runtime/scenario_spec.rb index 7009192bcc0..531a2ffd62c 100644 --- a/qa/spec/runtime/scenario_spec.rb +++ b/qa/spec/runtime/scenario_spec.rb @@ -3,23 +3,23 @@ describe QA::Runtime::Scenario do Module.new.extend(described_class) end - it 'makes it possible to define global scenario attributes' do - subject.define(:my_attribute, 'some-value') - subject.define(:another_attribute, 'another-value') + it "makes it possible to define global scenario attributes" do + subject.define(:my_attribute, "some-value") + subject.define(:another_attribute, "another-value") - expect(subject.my_attribute).to eq 'some-value' - expect(subject.another_attribute).to eq 'another-value' + expect(subject.my_attribute).to eq "some-value" + expect(subject.another_attribute).to eq "another-value" expect(subject.attributes) - .to eq(my_attribute: 'some-value', another_attribute: 'another-value') + .to eq(my_attribute: "some-value", another_attribute: "another-value") end - it 'raises error when attribute is not known' do + it "raises error when attribute is not known" do expect { subject.invalid_accessor } .to raise_error ArgumentError, /invalid_accessor/ end - it 'raises error when attribute is empty' do - subject.define(:empty_attribute, '') + it "raises error when attribute is empty" do + subject.define(:empty_attribute, "") expect { subject.empty_attribute } .to raise_error ArgumentError, /empty_attribute/ diff --git a/qa/spec/scenario/actable_spec.rb b/qa/spec/scenario/actable_spec.rb index 422763910e4..c19bdf85415 100644 --- a/qa/spec/scenario/actable_spec.rb +++ b/qa/spec/scenario/actable_spec.rb @@ -11,37 +11,37 @@ describe QA::Scenario::Actable do end end - describe '.act' do - it 'provides means to run steps' do + describe ".act" do + it "provides means to run steps" do result = subject.act { do_something } - expect(result).to eq 'some' + expect(result).to eq "some" end - it 'supports passing variables' do - result = subject.act('thing') do |variable| + it "supports passing variables" do + result = subject.act("thing") { |variable| do_something(variable) - end + } - expect(result).to eq 'something' + expect(result).to eq "something" end - it 'returns value from the last method' do - result = subject.act { 'test' } + it "returns value from the last method" do + result = subject.act { "test" } - expect(result).to eq 'test' + expect(result).to eq "test" end end - describe '.perform' do - it 'makes it possible to pass binding' do - variable = 'something' + describe ".perform" do + it "makes it possible to pass binding" do + variable = "something" - result = subject.perform do |object| + result = subject.perform { |object| object.something = variable - end + } - expect(result).to eq 'something' + expect(result).to eq "something" end end end diff --git a/qa/spec/scenario/bootable_spec.rb b/qa/spec/scenario/bootable_spec.rb index 273aac7677e..c172cf61282 100644 --- a/qa/spec/scenario/bootable_spec.rb +++ b/qa/spec/scenario/bootable_spec.rb @@ -4,20 +4,20 @@ describe QA::Scenario::Bootable do .include(described_class) end - it 'makes it possible to define the scenario attribute' do + it "makes it possible to define the scenario attribute" do subject.class_eval do - attribute :something, '--something SOMETHING', 'Some attribute' - attribute :another, '--another ANOTHER', 'Some other attribute' + attribute :something, "--something SOMETHING", "Some attribute" + attribute :another, "--another ANOTHER", "Some other attribute" end expect(subject).to receive(:perform) - .with(something: 'test', another: 'other') + .with(something: "test", another: "other") subject.launch!(%w[--another other --something test]) end - it 'does not require attributes to be defined' do - expect(subject).to receive(:perform).with('some', 'argv') + it "does not require attributes to be defined" do + expect(subject).to receive(:perform).with("some", "argv") subject.launch!(%w[some argv]) end diff --git a/qa/spec/scenario/test/instance/all_spec.rb b/qa/spec/scenario/test/instance/all_spec.rb index 9311d1d8199..a91f5e4d441 100644 --- a/qa/spec/scenario/test/instance/all_spec.rb +++ b/qa/spec/scenario/test/instance/all_spec.rb @@ -1,3 +1,3 @@ describe QA::Scenario::Test::Instance::All do - it_behaves_like 'a QA scenario class' + it_behaves_like "a QA scenario class" end diff --git a/qa/spec/scenario/test/instance/smoke_spec.rb b/qa/spec/scenario/test/instance/smoke_spec.rb index b5db9783af3..c3ba8e3e66a 100644 --- a/qa/spec/scenario/test/instance/smoke_spec.rb +++ b/qa/spec/scenario/test/instance/smoke_spec.rb @@ -1,5 +1,5 @@ describe QA::Scenario::Test::Instance::Smoke do - it_behaves_like 'a QA scenario class' do + it_behaves_like "a QA scenario class" do let(:tags) { [:smoke] } end end diff --git a/qa/spec/scenario/test/integration/github_spec.rb b/qa/spec/scenario/test/integration/github_spec.rb index c2aeb1ded1d..8982654ab6f 100644 --- a/qa/spec/scenario/test/integration/github_spec.rb +++ b/qa/spec/scenario/test/integration/github_spec.rb @@ -1,18 +1,18 @@ # frozen_string_literal: true describe QA::Scenario::Test::Integration::Github do - context '#perform' do - let(:env) { spy('Runtime::Env') } + context "#perform" do + let(:env) { spy("Runtime::Env") } before do - stub_const('QA::Runtime::Env', env) + stub_const("QA::Runtime::Env", env) end - it_behaves_like 'a QA scenario class' do + it_behaves_like "a QA scenario class" do let(:tags) { [:github] } - it 'requires a GitHub access token' do - subject.perform('gitlab_address') + it "requires a GitHub access token" do + subject.perform("gitlab_address") expect(env).to have_received(:require_github_access_token!) end diff --git a/qa/spec/scenario/test/integration/instance_saml_spec.rb b/qa/spec/scenario/test/integration/instance_saml_spec.rb index cb8a6a630cc..487f8e3bfa3 100644 --- a/qa/spec/scenario/test/integration/instance_saml_spec.rb +++ b/qa/spec/scenario/test/integration/instance_saml_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true describe QA::Scenario::Test::Integration::InstanceSAML do - context '#perform' do - it_behaves_like 'a QA scenario class' do + context "#perform" do + it_behaves_like "a QA scenario class" do let(:tags) { [:instance_saml] } end end diff --git a/qa/spec/scenario/test/integration/kubernetes_spec.rb b/qa/spec/scenario/test/integration/kubernetes_spec.rb index cb43994b229..10546bd68cd 100644 --- a/qa/spec/scenario/test/integration/kubernetes_spec.rb +++ b/qa/spec/scenario/test/integration/kubernetes_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true describe QA::Scenario::Test::Integration::Kubernetes do - context '#perform' do - it_behaves_like 'a QA scenario class' do + context "#perform" do + it_behaves_like "a QA scenario class" do let(:tags) { [:kubernetes] } end end diff --git a/qa/spec/scenario/test/integration/ldap_spec.rb b/qa/spec/scenario/test/integration/ldap_spec.rb index b6d798bf504..ac1169285c3 100644 --- a/qa/spec/scenario/test/integration/ldap_spec.rb +++ b/qa/spec/scenario/test/integration/ldap_spec.rb @@ -1,16 +1,16 @@ # frozen_string_literal: true describe QA::Scenario::Test::Integration::LDAPNoTLS do - context '#perform' do - it_behaves_like 'a QA scenario class' do + context "#perform" do + it_behaves_like "a QA scenario class" do let(:tags) { [:ldap_no_tls] } end end end describe QA::Scenario::Test::Integration::LDAPTLS do - context '#perform' do - it_behaves_like 'a QA scenario class' do + context "#perform" do + it_behaves_like "a QA scenario class" do let(:tags) { [:ldap_tls] } end end diff --git a/qa/spec/scenario/test/integration/mattermost_spec.rb b/qa/spec/scenario/test/integration/mattermost_spec.rb index 59caf2ba2cd..9e61804b26c 100644 --- a/qa/spec/scenario/test/integration/mattermost_spec.rb +++ b/qa/spec/scenario/test/integration/mattermost_spec.rb @@ -1,17 +1,17 @@ # frozen_string_literal: true describe QA::Scenario::Test::Integration::Mattermost do - context '#perform' do - it_behaves_like 'a QA scenario class' do + context "#perform" do + it_behaves_like "a QA scenario class" do let(:args) { %w[gitlab_address mattermost_address] } let(:tags) { [:mattermost] } - let(:options) { ['path1']} + let(:options) { ["path1"]} - it 'requires a GitHub access token' do + it "requires a GitHub access token" do subject.perform(*args) expect(attributes).to have_received(:define) - .with(:mattermost_address, 'mattermost_address') + .with(:mattermost_address, "mattermost_address") end end end diff --git a/qa/spec/scenario/test/integration/oauth_spec.rb b/qa/spec/scenario/test/integration/oauth_spec.rb index c1c320be576..82a6e0f9eb9 100644 --- a/qa/spec/scenario/test/integration/oauth_spec.rb +++ b/qa/spec/scenario/test/integration/oauth_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true describe QA::Scenario::Test::Integration::OAuth do - context '#perform' do - it_behaves_like 'a QA scenario class' do + context "#perform" do + it_behaves_like "a QA scenario class" do let(:tags) { [:oauth] } end end diff --git a/qa/spec/scenario/test/integration/object_storage_spec.rb b/qa/spec/scenario/test/integration/object_storage_spec.rb index 2b7188223e0..79f432ef2d9 100644 --- a/qa/spec/scenario/test/integration/object_storage_spec.rb +++ b/qa/spec/scenario/test/integration/object_storage_spec.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true describe QA::Scenario::Test::Integration::ObjectStorage do - context '#perform' do - it_behaves_like 'a QA scenario class' do + context "#perform" do + it_behaves_like "a QA scenario class" do let(:tags) { [:object_storage] } end end diff --git a/qa/spec/scenario/test/sanity/framework_spec.rb b/qa/spec/scenario/test/sanity/framework_spec.rb index 44ac780556e..d09c8107a84 100644 --- a/qa/spec/scenario/test/sanity/framework_spec.rb +++ b/qa/spec/scenario/test/sanity/framework_spec.rb @@ -1,5 +1,5 @@ describe QA::Scenario::Test::Sanity::Framework do - it_behaves_like 'a QA scenario class' do + it_behaves_like "a QA scenario class" do let(:tags) { [:framework] } end end diff --git a/qa/spec/scenario/test/sanity/selectors_spec.rb b/qa/spec/scenario/test/sanity/selectors_spec.rb index 45d21d54955..20f79e1a260 100644 --- a/qa/spec/scenario/test/sanity/selectors_spec.rb +++ b/qa/spec/scenario/test/sanity/selectors_spec.rb @@ -1,16 +1,16 @@ describe QA::Scenario::Test::Sanity::Selectors do - let(:validator) { spy('validator') } + let(:validator) { spy("validator") } before do - stub_const('QA::Page::Validator', validator) + stub_const("QA::Page::Validator", validator) end - context 'when there are errors detected' do + context "when there are errors detected" do before do - allow(validator).to receive(:errors).and_return(['some error']) + allow(validator).to receive(:errors).and_return(["some error"]) end - it 'outputs information about errors' do + it "outputs information about errors" do expect { described_class.perform } .to output(/some error/).to_stderr @@ -20,18 +20,18 @@ describe QA::Scenario::Test::Sanity::Selectors do end end - context 'when there are no errors detected' do + context "when there are no errors detected" do before do allow(validator).to receive(:errors).and_return([]) end - it 'processes pages module' do + it "processes pages module" do described_class.perform expect(validator).to have_received(:new).with(QA::Page) end - it 'triggers validation' do + it "triggers validation" do described_class.perform expect(validator).to have_received(:validate!).at_least(:once) diff --git a/qa/spec/shared_examples/scenario_shared_examples.rb b/qa/spec/shared_examples/scenario_shared_examples.rb index 5fd55d7d96b..dd3a7688ec8 100644 --- a/qa/spec/shared_examples/scenario_shared_examples.rb +++ b/qa/spec/shared_examples/scenario_shared_examples.rb @@ -1,46 +1,46 @@ # frozen_string_literal: true -shared_examples 'a QA scenario class' do - let(:attributes) { spy('Runtime::Scenario') } - let(:release) { spy('Runtime::Release') } - let(:runner) { spy('Specs::Runner') } +shared_examples "a QA scenario class" do + let(:attributes) { spy("Runtime::Scenario") } + let(:release) { spy("Runtime::Release") } + let(:runner) { spy("Specs::Runner") } - let(:args) { ['gitlab_address'] } + let(:args) { ["gitlab_address"] } let(:tags) { [] } let(:options) { %w[path1 path2] } before do - stub_const('QA::Runtime::Release', release) - stub_const('QA::Runtime::Scenario', attributes) - stub_const('QA::Specs::Runner', runner) + stub_const("QA::Runtime::Release", release) + stub_const("QA::Runtime::Scenario", attributes) + stub_const("QA::Specs::Runner", runner) allow(runner).to receive(:perform).and_yield(runner) end - it 'responds to perform' do + it "responds to perform" do expect(subject).to respond_to(:perform) end - it 'sets an address of the subject' do + it "sets an address of the subject" do subject.perform(*args) - expect(attributes).to have_received(:define).with(:gitlab_address, 'gitlab_address') + expect(attributes).to have_received(:define).with(:gitlab_address, "gitlab_address") end - it 'performs before hooks' do + it "performs before hooks" do subject.perform(*args) expect(release).to have_received(:perform_before_hooks) end - it 'sets tags on runner' do + it "sets tags on runner" do subject.perform(*args) expect(runner).to have_received(:tags=).with(tags) end - context 'specifying RSpec options' do - it 'sets options on runner' do + context "specifying RSpec options" do + it "sets options on runner" do subject.perform(*args, *options) expect(runner).to have_received(:options=).with(options) diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb index cbdd6e881b1..83ce4fa7378 100644 --- a/qa/spec/spec_helper.rb +++ b/qa/spec/spec_helper.rb @@ -1,13 +1,13 @@ -require_relative '../qa' -require 'rspec/retry' +require_relative "../qa" +require "rspec/retry" %w[helpers shared_examples].each do |d| - Dir[::File.join(__dir__, d, '**', '*.rb')].each { |f| require f } + Dir[::File.join(__dir__, d, "**", "*.rb")].each { |f| require f } end RSpec.configure do |config| config.before(:context) do - if self.class.metadata.keys.include?(:quarantine) + if self.class.metadata.key?(:quarantine) skip_or_run_quarantined_tests(self.class.metadata.keys, config.inclusion_filter.rules.keys) end end @@ -40,7 +40,7 @@ RSpec.configure do |config| config.display_try_failure_messages = true config.around do |example| - retry_times = example.metadata.keys.include?(:quarantine) ? 1 : 3 + retry_times = example.metadata.key?(:quarantine) ? 1 : 3 example.run_with_retry retry: retry_times end end @@ -63,7 +63,7 @@ def skip_or_run_quarantined_tests(metadata_keys, filter_keys) if filter_keys.include?(:quarantine) skip("Only running tests tagged with :quarantine and any of #{included_filters}") unless quarantine_and_optional_other_tag?(metadata_keys, included_filters) else - skip('In quarantine') if metadata_keys.include?(:quarantine) + skip("In quarantine") if metadata_keys.include?(:quarantine) end end diff --git a/qa/spec/spec_helper_spec.rb b/qa/spec/spec_helper_spec.rb index 27ec1ec80fe..dfa3a8450de 100644 --- a/qa/spec/spec_helper_spec.rb +++ b/qa/spec/spec_helper_spec.rb @@ -1,29 +1,29 @@ # frozen_string_literal: true -describe 'rspec config tests' do +describe "rspec config tests" do let(:group) do RSpec.describe do - shared_examples 'passing tests' do - example 'not in quarantine' do + shared_examples "passing tests" do + example "not in quarantine" do end - example 'in quarantine', :quarantine do + example "in quarantine", :quarantine do end end - context 'default' do - it_behaves_like 'passing tests' + context "default" do + it_behaves_like "passing tests" end - context 'foo', :foo do - it_behaves_like 'passing tests' + context "foo", :foo do + it_behaves_like "passing tests" end - context 'quarantine', :quarantine do - it_behaves_like 'passing tests' + context "quarantine", :quarantine do + it_behaves_like "passing tests" end - context 'bar quarantine', :bar, :quarantine do - it_behaves_like 'passing tests' + context "bar quarantine", :bar, :quarantine do + it_behaves_like "passing tests" end end end @@ -34,23 +34,23 @@ describe 'rspec config tests' do @expectations = [1, 2, 3] end - example 'not in quarantine' do + example "not in quarantine" do expect(@expectations.shift).to be(3) end - example 'in quarantine', :quarantine do + example "in quarantine", :quarantine do expect(@expectations.shift).to be(3) end end end - context 'with no tags focussed' do + context "with no tags focussed" do before do group.run end - context 'in a context tagged :foo' do - it 'skips tests in quarantine' do + context "in a context tagged :foo" do + it "skips tests in quarantine" do context = group.children.find { |c| c.description == "foo" } examples = context.descendant_filtered_examples expect(examples.count).to eq(2) @@ -60,12 +60,12 @@ describe 'rspec config tests' do ex = examples.find { |e| e.description == "in quarantine" } expect(ex.execution_result.status).to eq(:pending) - expect(ex.execution_result.pending_message).to eq('In quarantine') + expect(ex.execution_result.pending_message).to eq("In quarantine") end end - context 'in an untagged context' do - it 'skips tests in quarantine' do + context "in an untagged context" do + it "skips tests in quarantine" do context = group.children.find { |c| c.description == "default" } examples = context.descendant_filtered_examples expect(examples.count).to eq(2) @@ -75,12 +75,12 @@ describe 'rspec config tests' do ex = examples.find { |e| e.description == "in quarantine" } expect(ex.execution_result.status).to eq(:pending) - expect(ex.execution_result.pending_message).to eq('In quarantine') + expect(ex.execution_result.pending_message).to eq("In quarantine") end end - context 'in a context tagged :quarantine' do - it 'skips all tests' do + context "in a context tagged :quarantine" do + it "skips all tests" do context = group.children.find { |c| c.description == "quarantine" } examples = context.descendant_filtered_examples expect(examples.count).to eq(2) @@ -90,12 +90,12 @@ describe 'rspec config tests' do ex = examples.find { |e| e.description == "in quarantine" } expect(ex.execution_result.status).to eq(:pending) - expect(ex.execution_result.pending_message).to eq('In quarantine') + expect(ex.execution_result.pending_message).to eq("In quarantine") end end end - context 'with :quarantine focussed' do + context "with :quarantine focussed" do before do RSpec.configure do |config| config.inclusion_filter = :quarantine @@ -109,8 +109,8 @@ describe 'rspec config tests' do end end - context 'in an untagged context' do - it 'only runs quarantined tests' do + context "in an untagged context" do + it "only runs quarantined tests" do context = group.children.find { |c| c.description == "default" } examples = context.descendant_filtered_examples expect(examples.count).to be(1) @@ -120,8 +120,8 @@ describe 'rspec config tests' do end end - context 'in a context tagged :foo' do - it 'only runs quarantined tests' do + context "in a context tagged :foo" do + it "only runs quarantined tests" do context = group.children.find { |c| c.description == "foo" } examples = context.descendant_filtered_examples expect(examples.count).to be(1) @@ -131,8 +131,8 @@ describe 'rspec config tests' do end end - context 'in a context tagged :quarantine' do - it 'runs all tests' do + context "in a context tagged :quarantine" do + it "runs all tests" do context = group.children.find { |c| c.description == "quarantine" } examples = context.descendant_filtered_examples expect(examples.count).to be(2) @@ -146,7 +146,7 @@ describe 'rspec config tests' do end end - context 'with a non-quarantine tag (:foo) focussed' do + context "with a non-quarantine tag (:foo) focussed" do before do RSpec.configure do |config| config.inclusion_filter = :foo @@ -160,15 +160,15 @@ describe 'rspec config tests' do end end - context 'in an untagged context' do - it 'runs no tests' do + context "in an untagged context" do + it "runs no tests" do context = group.children.find { |c| c.description == "default" } expect(context.descendant_filtered_examples.count).to eq(0) end end - context 'in a context tagged :foo' do - it 'skips quarantined tests' do + context "in a context tagged :foo" do + it "skips quarantined tests" do context = group.children.find { |c| c.description == "foo" } examples = context.descendant_filtered_examples expect(examples.count).to be(2) @@ -178,22 +178,22 @@ describe 'rspec config tests' do ex = examples.find { |e| e.description == "in quarantine" } expect(ex.execution_result.status).to eq(:pending) - expect(ex.execution_result.pending_message).to eq('In quarantine') + expect(ex.execution_result.pending_message).to eq("In quarantine") end end - context 'in a context tagged :quarantine' do - it 'runs no tests' do + context "in a context tagged :quarantine" do + it "runs no tests" do context = group.children.find { |c| c.description == "quarantine" } expect(context.descendant_filtered_examples.count).to eq(0) end end end - context 'with :quarantine and a non-quarantine tag (:foo) focussed' do + context "with :quarantine and a non-quarantine tag (:foo) focussed" do before do RSpec.configure do |config| - config.inclusion_filter = { quarantine: true, foo: true } + config.inclusion_filter = {quarantine: true, foo: true} end group.run @@ -204,8 +204,8 @@ describe 'rspec config tests' do end end - context 'in an untagged context' do - it 'ignores untagged tests and skips tests even if in quarantine' do + context "in an untagged context" do + it "ignores untagged tests and skips tests even if in quarantine" do context = group.children.find { |c| c.description == "default" } examples = context.descendant_filtered_examples expect(examples.count).to eq(1) @@ -215,8 +215,8 @@ describe 'rspec config tests' do end end - context 'in a context tagged :foo' do - it 'only runs quarantined tests' do + context "in a context tagged :foo" do + it "only runs quarantined tests" do context = group.children.find { |c| c.description == "foo" } examples = context.descendant_filtered_examples expect(examples.count).to be(2) @@ -229,8 +229,8 @@ describe 'rspec config tests' do end end - context 'in a context tagged :quarantine' do - it 'skips all tests' do + context "in a context tagged :quarantine" do + it "skips all tests" do context = group.children.find { |c| c.description == "quarantine" } examples = context.descendant_filtered_examples expect(examples.count).to be(2) @@ -243,8 +243,8 @@ describe 'rspec config tests' do end end - context 'in a context tagged :bar and :quarantine' do - it 'skips all tests' do + context "in a context tagged :bar and :quarantine" do + it "skips all tests" do context = group.children.find { |c| c.description == "quarantine" } examples = context.descendant_filtered_examples expect(examples.count).to be(2) @@ -258,10 +258,10 @@ describe 'rspec config tests' do end end - context 'with :quarantine and multiple non-quarantine tags focussed' do + context "with :quarantine and multiple non-quarantine tags focussed" do before do RSpec.configure do |config| - config.inclusion_filter = { bar: true, foo: true, quarantine: true } + config.inclusion_filter = {bar: true, foo: true, quarantine: true} end group.run @@ -272,8 +272,8 @@ describe 'rspec config tests' do end end - context 'in a context tagged :foo' do - it 'only runs quarantined tests' do + context "in a context tagged :foo" do + it "only runs quarantined tests" do context = group.children.find { |c| c.description == "foo" } examples = context.descendant_filtered_examples expect(examples.count).to be(2) @@ -283,28 +283,28 @@ describe 'rspec config tests' do ex = examples.find { |e| e.description == "not in quarantine" } expect(ex.execution_result.status).to eq(:pending) - expect(ex.execution_result.pending_message).to eq('Only running tests tagged with :quarantine and any of [:bar, :foo]') + expect(ex.execution_result.pending_message).to eq("Only running tests tagged with :quarantine and any of [:bar, :foo]") end end - context 'in a context tagged :quarantine' do - it 'skips all tests' do + context "in a context tagged :quarantine" do + it "skips all tests" do context = group.children.find { |c| c.description == "quarantine" } examples = context.descendant_filtered_examples expect(examples.count).to be(2) ex = examples.find { |e| e.description == "in quarantine" } expect(ex.execution_result.status).to eq(:pending) - expect(ex.execution_result.pending_message).to eq('Only running tests tagged with :quarantine and any of [:bar, :foo]') + expect(ex.execution_result.pending_message).to eq("Only running tests tagged with :quarantine and any of [:bar, :foo]") ex = examples.find { |e| e.description == "not in quarantine" } expect(ex.execution_result.status).to eq(:pending) - expect(ex.execution_result.pending_message).to eq('Only running tests tagged with :quarantine and any of [:bar, :foo]') + expect(ex.execution_result.pending_message).to eq("Only running tests tagged with :quarantine and any of [:bar, :foo]") end end - context 'in a context tagged :bar and :quarantine' do - it 'runs all tests' do + context "in a context tagged :bar and :quarantine" do + it "runs all tests" do context = group.children.find { |c| c.description == "bar quarantine" } examples = context.descendant_filtered_examples expect(examples.count).to be(2) @@ -318,20 +318,20 @@ describe 'rspec config tests' do end end - context 'rspec retry' do - context 'in an untagged context' do + context "rspec retry" do + context "in an untagged context" do before do group_2.run end - it 'should run example :retry times' do + it "should run example :retry times" do examples = group_2.descendant_filtered_examples - ex = examples.find { |e| e.description == 'not in quarantine' } + ex = examples.find { |e| e.description == "not in quarantine" } expect(ex.execution_result.status).to eq(:passed) end end - context 'with :quarantine focussed' do + context "with :quarantine focussed" do before do RSpec.configure do |config| config.inclusion_filter = :quarantine @@ -345,9 +345,9 @@ describe 'rspec config tests' do end end - it 'should run example once only' do + it "should run example once only" do examples = group_2.descendant_filtered_examples - ex = examples.find { |e| e.description == 'in quarantine' } + ex = examples.find { |e| e.description == "in quarantine" } expect(ex.execution_result.status).to eq(:failed) end end diff --git a/qa/spec/specs/runner_spec.rb b/qa/spec/specs/runner_spec.rb index 741821ddf8c..9b1b7a04e24 100644 --- a/qa/spec/specs/runner_spec.rb +++ b/qa/spec/specs/runner_spec.rb @@ -1,32 +1,32 @@ # frozen_string_literal: true describe QA::Specs::Runner do - context '#perform' do + context "#perform" do before do allow(QA::Runtime::Browser).to receive(:configure!) end - it 'excludes the orchestrated tag by default' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', *described_class::DEFAULT_TEST_PATH_ARGS]) + it "excludes the orchestrated tag by default" do + expect_rspec_runner_arguments(["--tag", "~orchestrated", *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end - context 'when tty is set' do + context "when tty is set" do subject { described_class.new.tap { |runner| runner.tty = true } } - it 'sets the `--tty` flag' do - expect_rspec_runner_arguments(['--tty', '--tag', '~orchestrated', *described_class::DEFAULT_TEST_PATH_ARGS]) + it "sets the `--tty` flag" do + expect_rspec_runner_arguments(["--tty", "--tag", "~orchestrated", *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end end - context 'when tags are set' do + context "when tags are set" do subject { described_class.new.tap { |runner| runner.tags = %i[orchestrated github] } } - it 'focuses on the given tags' do - expect_rspec_runner_arguments(['--tag', 'orchestrated', '--tag', 'github', *described_class::DEFAULT_TEST_PATH_ARGS]) + it "focuses on the given tags" do + expect_rspec_runner_arguments(["--tag", "orchestrated", "--tag", "github", *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end @@ -35,8 +35,8 @@ describe QA::Specs::Runner do context 'when "--tag smoke" is set as options' do subject { described_class.new.tap { |runner| runner.options = %w[--tag smoke] } } - it 'focuses on the given tag without excluded the orchestrated tag' do - expect_rspec_runner_arguments(['--tag', 'smoke', *described_class::DEFAULT_TEST_PATH_ARGS]) + it "focuses on the given tag without excluded the orchestrated tag" do + expect_rspec_runner_arguments(["--tag", "smoke", *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end @@ -45,8 +45,8 @@ describe QA::Specs::Runner do context 'when "qa/specs/features/foo" is set as options' do subject { described_class.new.tap { |runner| runner.options = %w[qa/specs/features/foo] } } - it 'passes the given tests path and excludes the orchestrated tag' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', 'qa/specs/features/foo']) + it "passes the given tests path and excludes the orchestrated tag" do + expect_rspec_runner_arguments(["--tag", "~orchestrated", "qa/specs/features/foo"]) subject.perform end @@ -55,36 +55,36 @@ describe QA::Specs::Runner do context 'when "-- qa/specs/features/foo" is set as options' do subject { described_class.new.tap { |runner| runner.options = %w[-- qa/specs/features/foo] } } - it 'passes the given tests path and excludes the orchestrated tag' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--', 'qa/specs/features/foo']) + it "passes the given tests path and excludes the orchestrated tag" do + expect_rspec_runner_arguments(["--tag", "~orchestrated", "--", "qa/specs/features/foo"]) subject.perform end end - context 'when SIGNUP_DISABLED is true' do + context "when SIGNUP_DISABLED is true" do before do allow(QA::Runtime::Env).to receive(:signup_disabled?).and_return(true) end subject { described_class.new } - it 'it includes default args and excludes the skip_signup_disabled tag' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~skip_signup_disabled', *described_class::DEFAULT_TEST_PATH_ARGS]) + it "it includes default args and excludes the skip_signup_disabled tag" do + expect_rspec_runner_arguments(["--tag", "~orchestrated", "--tag", "~skip_signup_disabled", *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end end - context 'when git protocol v2 is not supported' do + context "when git protocol v2 is not supported" do before do allow(QA::Runtime::Env).to receive(:can_test?).with(:git_protocol_v2).and_return(false) end subject { described_class.new } - it 'it includes default args and excludes the requires_git_protocol_v2 tag' do - expect_rspec_runner_arguments(['--tag', '~orchestrated', '--tag', '~requires_git_protocol_v2', *described_class::DEFAULT_TEST_PATH_ARGS]) + it "it includes default args and excludes the requires_git_protocol_v2 tag" do + expect_rspec_runner_arguments(["--tag", "~orchestrated", "--tag", "~requires_git_protocol_v2", *described_class::DEFAULT_TEST_PATH_ARGS]) subject.perform end diff --git a/qa/spec/support/waiter_spec.rb b/qa/spec/support/waiter_spec.rb index 8283b65e1be..ed912d78a39 100644 --- a/qa/spec/support/waiter_spec.rb +++ b/qa/spec/support/waiter_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require 'logger' +require "logger" describe QA::Support::Waiter do before do @@ -9,28 +9,28 @@ describe QA::Support::Waiter do QA::Runtime::Logger.logger = logger end - describe '.wait' do - context 'when the condition is true' do - it 'logs the start' do + describe ".wait" do + context "when the condition is true" do + it "logs the start" do expect { subject.wait(max: 0) {} } - .to output(/with wait: max 0; interval 0.1/).to_stdout_from_any_process + .to output(/with wait: max 0; interval 0.1/).to_stdout_from_any_process end - it 'logs the end' do + it "logs the end" do expect { subject.wait(max: 0) {} } - .to output(/ended wait after .* seconds$/).to_stdout_from_any_process + .to output(/ended wait after .* seconds$/).to_stdout_from_any_process end end - context 'when the condition is false' do - it 'logs the start' do + context "when the condition is false" do + it "logs the start" do expect { subject.wait(max: 0) { false } } - .to output(/with wait: max 0; interval 0.1/).to_stdout_from_any_process + .to output(/with wait: max 0; interval 0.1/).to_stdout_from_any_process end - it 'logs the end' do + it "logs the end" do expect { subject.wait(max: 0) { false } } - .to output(/ended wait after .* seconds$/).to_stdout_from_any_process + .to output(/ended wait after .* seconds$/).to_stdout_from_any_process end end end |