summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2018-05-30 13:19:53 +0200
committerRémy Coutable <remy@rymai.me>2018-05-30 13:33:08 +0200
commit47e0517adf17e830838f87030b1b0fd453f9a2c7 (patch)
tree4c34504b74d8c4e8eeccb69f3fa957b2b94e330e
parentae3cb6d7c9137bc778db2dc71fd7afa7eb83c590 (diff)
downloadgitlab-ce-qa-94.tar.gz
Extract more Runtime classes, Scenario::Taggable and Specs::Runner to gitlab-qaqa-94
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r--qa/Gemfile5
-rw-r--r--qa/Gemfile.lock2
-rw-r--r--qa/README.md29
-rw-r--r--qa/qa.rb191
-rw-r--r--qa/qa/page/mattermost/main.rb2
-rw-r--r--qa/qa/runtime/address.rb20
-rw-r--r--qa/qa/runtime/api.rb4
-rw-r--r--qa/qa/runtime/browser.rb132
-rw-r--r--qa/qa/runtime/env.rb9
-rw-r--r--qa/qa/runtime/key/base.rb4
-rw-r--r--qa/qa/scenario/taggable.rb13
-rw-r--r--qa/qa/scenario/test/instance.rb6
-rw-r--r--qa/qa/scenario/test/integration/mattermost.rb2
-rw-r--r--qa/qa/service/omnibus.rb2
-rw-r--r--qa/qa/service/runner.rb8
-rw-r--r--qa/qa/specs/runner.rb30
-rw-r--r--qa/spec/runtime/env_spec.rb55
-rw-r--r--qa/spec/runtime/key/ecdsa_spec.rb2
-rw-r--r--qa/spec/runtime/scenario_spec.rb27
-rw-r--r--qa/spec/scenario/test/instance_spec.rb6
20 files changed, 131 insertions, 418 deletions
diff --git a/qa/Gemfile b/qa/Gemfile
index f12cdd39230..32472ca42a1 100644
--- a/qa/Gemfile
+++ b/qa/Gemfile
@@ -3,12 +3,9 @@ source 'https://rubygems.org'
if ENV['GITLAB_QA_SOURCE']
gem 'gitlab-qa', ENV.fetch('GITLAB_QA_PROTOCOL', 'path') => ENV['GITLAB_QA_SOURCE']
else
- gem 'gitlab-qa', '~> 1.0'
+ gem 'gitlab-qa', '~> 0.5'
end
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.8.0'
gem 'airborne', '~> 0.2.13'
diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock
index 9aded2aa093..37abda918ce 100644
--- a/qa/Gemfile.lock
+++ b/qa/Gemfile.lock
@@ -33,6 +33,7 @@ GEM
domain_name (0.5.20170404)
unf (>= 0.0.5, < 1.0.0)
ffi (1.9.18)
+ gitlab-qa (0.5.0)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (0.9.1)
@@ -97,6 +98,7 @@ DEPENDENCIES
airborne (~> 0.2.13)
capybara (~> 2.16.1)
capybara-screenshot (~> 1.0.18)
+ gitlab-qa (~> 0.5)
pry-byebug (~> 3.5.1)
rake (~> 12.3.0)
rspec (~> 3.7)
diff --git a/qa/README.md b/qa/README.md
index 78b2d1dd3a7..5b08c2ab47c 100644
--- a/qa/README.md
+++ b/qa/README.md
@@ -32,30 +32,26 @@ using `package-and-qa` manual action, to test if everything works fine.
You can use GitLab QA to exercise tests on any live instance! For example, the
following call would login to a local [GDK] instance and run all specs in
-`qa/specs/features`:
+`scenarios`:
```
bin/qa Test::Instance http://localhost:3000
```
-### Writing tests
-
-1. [Using page objects](qa/page/README.md)
-
### Running specific tests
You can also supply specific tests to run as another parameter. For example, to
run the repository-related specs, you can execute:
```
-bin/qa Test::Instance http://localhost qa/specs/features/repository/
+bin/qa Test::Instance http://localhost:3000 -- scenarios/repository/
```
Since the arguments would be passed to `rspec`, you could use all `rspec`
options there. For example, passing `--backtrace` and also line number:
```
-bin/qa Test::Instance http://localhost qa/specs/features/login/standard_spec.rb:3 --backtrace
+bin/qa Test::Instance http://localhost:3000 -- scenarios/login/standard_spec.rb:3 --backtrace
```
### Running Geo integrations test against live servers
@@ -100,6 +96,25 @@ GITLAB_USER_TYPE=ldap GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password \
All [supported environment variables are here](https://gitlab.com/gitlab-org/gitlab-qa#supported-environment-variables).
+### Writing tests
+
+1. [Using page objects](qa/page/README.md)
+1. Using a local `gitlab-qa`:
+
+ ```
+ # Install the gems using the `Gemfile.dev` file
+ $ env BUNDLE_GEMFILE=Gemfile.dev GITLAB_QA_SOURCE=~/Code/GitLab/gitlab-qa GITLAB_QA_PROTOCOL=path \
+ bundle install
+
+ # Run the spec suite
+ $ env BUNDLE_GEMFILE=Gemfile.dev GITLAB_QA_SOURCE=~/Code/GitLab/gitlab-qa GITLAB_QA_PROTOCOL=path \
+ bundle exec rspec
+
+ # Run a specific scenario
+ $ env BUNDLE_GEMFILE=Gemfile.dev GITLAB_QA_SOURCE=~/Code/GitLab/gitlab-qa GITLAB_QA_PROTOCOL=path \
+ bin/qa Test::Instance http://localhost:3000 -- scenarios/api/users_spec.rb
+ ```
+
### Building a Docker image to test
Once you have made changes to the CE/EE repositories, you may want to build a
diff --git a/qa/qa.rb b/qa/qa.rb
index 475adc15e02..e6b8717c0c5 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -3,27 +3,6 @@ $:.unshift(lib) unless $:.include?(lib)
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, File.expand_path('qa/runtime/env', __dir__)
- autoload :Address, 'qa/runtime/address'
- autoload :API, 'qa/runtime/api'
-
- 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'
- end
- end
-
- ##
# GitLab QA fabrication mechanisms
#
module Factory
@@ -50,29 +29,11 @@ module QA
end
##
- # GitLab QA Scenarios
+ # Classes describing operations on Git repositories.
#
- module Scenario
- ##
- # Support files
- #
- autoload :Taggable, 'qa/scenario/taggable'
-
- ##
- # Test scenario entrypoints.
- #
- module Test
- autoload :Instance, 'qa/scenario/test/instance'
-
- module Integration
- autoload :LDAP, 'qa/scenario/test/integration/ldap'
- autoload :Mattermost, 'qa/scenario/test/integration/mattermost'
- end
-
- module Sanity
- autoload :Selectors, 'qa/scenario/test/sanity/selectors'
- end
- end
+ module Git
+ autoload :Location, 'qa/git/location'
+ autoload :Repository, 'qa/git/repository'
end
##
@@ -81,101 +42,133 @@ module QA
# Needed to execute click-driven-only black-box tests.
#
module Page
+ module Admin
+ module Settings
+ autoload :Main, 'qa/page/admin/settings/main'
+ autoload :RepositoryStorage, 'qa/page/admin/settings/repository_storage'
+ end
+ end
+
+ ##
+ # Classes describing components that are used by several pages.
+ #
+ module Component
+ autoload :Dropzone, 'qa/page/component/dropzone'
+ end
+
+ module Dashboard
+ autoload :Groups, 'qa/page/dashboard/groups'
+ autoload :Projects, 'qa/page/dashboard/projects'
+ end
+
+ module Group
+ autoload :New, 'qa/page/group/new'
+ autoload :Show, 'qa/page/group/show'
+ end
+
module Main
autoload :Login, 'qa/page/main/login'
autoload :OAuth, 'qa/page/main/oauth'
end
- module Settings
- autoload :Common, 'qa/page/settings/common'
+ module Mattermost
+ autoload :Login, 'qa/page/mattermost/login'
+ autoload :Main, 'qa/page/mattermost/main'
end
module Menu
- autoload :Main, 'qa/page/menu/main'
- autoload :Side, 'qa/page/menu/side'
autoload :Admin, 'qa/page/menu/admin'
+ autoload :Main, 'qa/page/menu/main'
autoload :Profile, 'qa/page/menu/profile'
+ autoload :Side, 'qa/page/menu/side'
end
- module Dashboard
- autoload :Projects, 'qa/page/dashboard/projects'
- autoload :Groups, 'qa/page/dashboard/groups'
+ module MergeRequest
+ autoload :New, 'qa/page/merge_request/new'
+ autoload :Show, 'qa/page/merge_request/show'
end
- module Group
- autoload :New, 'qa/page/group/new'
- autoload :Show, 'qa/page/group/show'
+ module Profile
+ autoload :PersonalAccessTokens, 'qa/page/profile/personal_access_tokens'
end
module Project
+ autoload :Activity, 'qa/page/project/activity'
autoload :New, 'qa/page/project/new'
autoload :Show, 'qa/page/project/show'
- autoload :Activity, 'qa/page/project/activity'
- module Pipeline
- autoload :Index, 'qa/page/project/pipeline/index'
- autoload :Show, 'qa/page/project/pipeline/show'
+ module Issue
+ autoload :Index, 'qa/page/project/issue/index'
+ autoload :New, 'qa/page/project/issue/new'
+ autoload :Show, 'qa/page/project/issue/show'
end
module Job
autoload :Show, 'qa/page/project/job/show'
end
+ module Pipeline
+ autoload :Index, 'qa/page/project/pipeline/index'
+ autoload :Show, 'qa/page/project/pipeline/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 :Common, 'qa/page/project/settings/common'
autoload :DeployKeys, 'qa/page/project/settings/deploy_keys'
+ autoload :Main, 'qa/page/project/settings/main'
+ autoload :MergeRequest, 'qa/page/project/settings/merge_request'
autoload :ProtectedBranches, 'qa/page/project/settings/protected_branches'
- autoload :SecretVariables, 'qa/page/project/settings/secret_variables'
+ autoload :Repository, 'qa/page/project/settings/repository'
autoload :Runners, 'qa/page/project/settings/runners'
- autoload :MergeRequest, 'qa/page/project/settings/merge_request'
- 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 :SecretVariables, 'qa/page/project/settings/secret_variables'
end
end
- module Profile
- autoload :PersonalAccessTokens, 'qa/page/profile/personal_access_tokens'
- end
-
- module MergeRequest
- autoload :New, 'qa/page/merge_request/new'
- autoload :Show, 'qa/page/merge_request/show'
- end
-
- module Admin
- module Settings
- autoload :RepositoryStorage, 'qa/page/admin/settings/repository_storage'
- autoload :Main, 'qa/page/admin/settings/main'
- end
+ module Settings
+ autoload :Common, 'qa/page/settings/common'
end
+ end
- module Mattermost
- autoload :Main, 'qa/page/mattermost/main'
- autoload :Login, 'qa/page/mattermost/login'
- end
+ ##
+ # GitLab QA runtime classes, mostly singletons.
+ #
+ module Runtime
+ autoload :API, 'qa/runtime/api'
+ autoload :Env, 'qa/runtime/env'
+ autoload :Namespace, 'qa/runtime/namespace'
+ autoload :Release, 'qa/runtime/release'
+ autoload :Scenario, 'qa/runtime/scenario'
+ autoload :User, 'qa/runtime/user'
- ##
- # Classes describing components that are used by several pages.
- #
- module Component
- autoload :Dropzone, 'qa/page/component/dropzone'
+ module Key
+ autoload :Base, 'qa/runtime/key/base'
+ autoload :ECDSA, 'qa/runtime/key/ecdsa'
+ autoload :ED25519, 'qa/runtime/key/ed25519'
+ autoload :RSA, 'qa/runtime/key/rsa'
end
end
##
- # Classes describing operations on Git repositories.
+ # GitLab QA Scenarios
#
- module Git
- autoload :Repository, 'qa/git/repository'
- autoload :Location, 'qa/git/location'
+ module Scenario
+ ##
+ # Test scenario entrypoints.
+ #
+ module Test
+ autoload :Instance, 'qa/scenario/test/instance'
+
+ module Integration
+ autoload :LDAP, 'qa/scenario/test/integration/ldap'
+ autoload :Mattermost, 'qa/scenario/test/integration/mattermost'
+ end
+
+ module Sanity
+ autoload :Selectors, 'qa/scenario/test/sanity/selectors'
+ end
+ end
end
##
@@ -186,14 +179,6 @@ module QA
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'
- end
end
QA::Runtime::Release.extend_autoloads!
diff --git a/qa/qa/page/mattermost/main.rb b/qa/qa/page/mattermost/main.rb
index 1c3343dbd77..e2d4ecb495c 100644
--- a/qa/qa/page/mattermost/main.rb
+++ b/qa/qa/page/mattermost/main.rb
@@ -10,7 +10,7 @@ module QA
view 'app/views/projects/mattermosts/new.html.haml'
def initialize
- visit(Runtime::Scenario.mattermost_address)
+ visit(Gitlab::QA::Framework::Runtime::Scenario.mattermost_address)
end
end
end
diff --git a/qa/qa/runtime/address.rb b/qa/qa/runtime/address.rb
deleted file mode 100644
index ffad3974b02..00000000000
--- a/qa/qa/runtime/address.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-module QA
- module Runtime
- class Address
- attr_reader :address
-
- def initialize(instance, page = nil)
- @instance = instance
- @address = host + (page.is_a?(String) ? page : page&.path)
- end
-
- def host
- if @instance.is_a?(Symbol)
- Runtime::Scenario.send("#{@instance}_address")
- else
- @instance.to_s
- end
- end
- end
- end
-end
diff --git a/qa/qa/runtime/api.rb b/qa/qa/runtime/api.rb
index e2a096b971d..224471116cb 100644
--- a/qa/qa/runtime/api.rb
+++ b/qa/qa/runtime/api.rb
@@ -27,7 +27,7 @@ module QA
private
def create_personal_access_token
- Runtime::Browser.visit(@address, Page::Main::Login) do
+ Gitlab::QA::Framework::Runtime::Browser.visit(@address, Page::Main::Login) do
Page::Main::Login.act { sign_in_using_credentials }
Factory::Resource::PersonalAccessToken.fabricate!.access_token
end
@@ -40,7 +40,7 @@ module QA
def initialize(api_client, path, personal_access_token: nil)
personal_access_token ||= api_client.personal_access_token
request_path = request_path(path, personal_access_token: personal_access_token)
- @session_address = Runtime::Address.new(api_client.address, request_path)
+ @session_address = Gitlab::QA::Framework::Runtime::Address.new(api_client.address, request_path)
end
def url
diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb
deleted file mode 100644
index da5b88bc1c2..00000000000
--- a/qa/qa/runtime/browser.rb
+++ /dev/null
@@ -1,132 +0,0 @@
-require 'rspec/core'
-require 'capybara/rspec'
-require 'capybara-screenshot/rspec'
-require 'selenium-webdriver'
-
-module QA
- module Runtime
- class Browser
- include Gitlab::QA::Framework::Scenario::Actable
-
- def initialize
- self.class.configure!
- end
-
- ##
- # Visit a page that belongs to a GitLab instance under given address.
- #
- # Example:
- #
- # visit(:gitlab, Page::Main::Login)
- # visit('http://gitlab.example/users/sign_in')
- #
- # In case of an address that is a symbol we will try to guess address
- # based on `Runtime::Scenario#something_address`.
- #
- def visit(address, page = nil, &block)
- Browser::Session.new(address, page).perform(&block)
- end
-
- def self.visit(address, page = nil, &block)
- new.visit(address, page, &block)
- end
-
- def self.configure!
- return if Capybara.drivers.include?(:chrome)
-
- Capybara.register_driver :chrome do |app|
- capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
- # This enables access to logs with `page.driver.manage.get_log(:browser)`
- loggingPrefs: {
- browser: "ALL",
- client: "ALL",
- driver: "ALL",
- server: "ALL"
- }
- )
-
- options = Selenium::WebDriver::Chrome::Options.new
- options.add_argument("window-size=1240,1680")
-
- # Chrome won't work properly in a Docker container in sandbox mode
- options.add_argument("no-sandbox")
-
- # Run headless by default unless CHROME_HEADLESS is false
- if QA::Runtime::Env.chrome_headless?
- options.add_argument("headless")
-
- # Chrome documentation says this flag is needed for now
- # https://developers.google.com/web/updates/2017/04/headless-chrome#cli
- options.add_argument("disable-gpu")
- end
-
- # Disable /dev/shm use in CI. See https://gitlab.com/gitlab-org/gitlab-ee/issues/4252
- options.add_argument("disable-dev-shm-usage") if QA::Runtime::Env.running_in_ci?
-
- Capybara::Selenium::Driver.new(
- app,
- browser: :chrome,
- desired_capabilities: capabilities,
- options: options
- )
- end
-
- # Keep only the screenshots generated from the last failing test suite
- Capybara::Screenshot.prune_strategy = :keep_last_run
-
- # From https://github.com/mattheworiordan/capybara-screenshot/issues/84#issuecomment-41219326
- Capybara::Screenshot.register_driver(:chrome) do |driver, path|
- driver.browser.save_screenshot(path)
- end
-
- Capybara.configure do |config|
- config.default_driver = :chrome
- config.javascript_driver = :chrome
- config.default_max_wait_time = 10
- # https://github.com/mattheworiordan/capybara-screenshot/issues/164
- config.save_path = File.expand_path('../../tmp', __dir__)
- end
- end
-
- class Session
- include Capybara::DSL
-
- def initialize(instance, page = nil)
- @session_address = Runtime::Address.new(instance, page)
- end
-
- def url
- @session_address.address
- end
-
- def perform(&block)
- visit(url)
-
- yield if block_given?
- rescue
- raise if block.nil?
-
- # RSpec examples will take care of screenshots on their own
- #
- unless block.binding.receiver.is_a?(RSpec::Core::ExampleGroup)
- screenshot_and_save_page
- end
-
- raise
- ensure
- clear! if block_given?
- end
-
- ##
- # Selenium allows to reset session cookies for current domain only.
- #
- # See gitlab-org/gitlab-qa#102
- #
- def clear!
- visit(url)
- reset_session!
- end
- end
- end
- end
-end
diff --git a/qa/qa/runtime/env.rb b/qa/qa/runtime/env.rb
index fe432edfa2a..c96330392f3 100644
--- a/qa/qa/runtime/env.rb
+++ b/qa/qa/runtime/env.rb
@@ -3,15 +3,6 @@ module QA
module Env
extend self
- # set to 'false' to have Chrome run visibly instead of headless
- def chrome_headless?
- (ENV['CHROME_HEADLESS'] =~ /^(false|no|0)$/i) != 0
- end
-
- def running_in_ci?
- ENV['CI'] || ENV['CI_SERVER']
- end
-
# specifies token that can be used for the api
def personal_access_token
ENV['PERSONAL_ACCESS_TOKEN']
diff --git a/qa/qa/runtime/key/base.rb b/qa/qa/runtime/key/base.rb
index a32bf75ce45..ead70f8c978 100644
--- a/qa/qa/runtime/key/base.rb
+++ b/qa/qa/runtime/key/base.rb
@@ -19,9 +19,9 @@ module QA
private
def ssh_keygen(name, bits, path)
- cmd = %Q[ssh-keygen -t #{name} -b #{bits} -f #{path} -N\n]
+ cmd = %Q[ssh-keygen -t #{name} -b #{bits} -f #{path} -N '']
- Gitlab::QA::Framework::Docker::Shellout.new(cmd).execute!
+ Gitlab::QA::Framework::Utils::Shellout.new(cmd).execute!
end
def populate_key_data(path)
diff --git a/qa/qa/scenario/taggable.rb b/qa/qa/scenario/taggable.rb
deleted file mode 100644
index 89f01409a44..00000000000
--- a/qa/qa/scenario/taggable.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module QA
- module Scenario
- module Taggable
- def tags(*tags)
- @tags = tags # rubocop:disable Gitlab/ModuleWithInstanceVariables
- end
-
- def focus
- @tags.to_a # rubocop:disable Gitlab/ModuleWithInstanceVariables
- end
- end
- end
-end
diff --git a/qa/qa/scenario/test/instance.rb b/qa/qa/scenario/test/instance.rb
index 6f399c2a62a..32c0d8947b7 100644
--- a/qa/qa/scenario/test/instance.rb
+++ b/qa/qa/scenario/test/instance.rb
@@ -7,19 +7,19 @@ module QA
#
class Instance
include Gitlab::QA::Framework::Scenario::Template
- extend Taggable
+ include Gitlab::QA::Framework::Scenario::Taggable
tags :core
def perform(address, *rspec_options)
- Runtime::Scenario.define(:gitlab_address, address)
+ Gitlab::QA::Framework::Runtime::Scenario.define(:gitlab_address, address)
##
# Perform before hooks, which are different for CE and EE
#
Runtime::Release.perform_before_hooks
- Specs::Runner.perform do |specs|
+ Gitlab::QA::Framework::Scenario::Runner.perform do |specs|
specs.tty = true
specs.tags = self.class.focus
specs.options =
diff --git a/qa/qa/scenario/test/integration/mattermost.rb b/qa/qa/scenario/test/integration/mattermost.rb
index 13bfad28b0b..6281e20ae6c 100644
--- a/qa/qa/scenario/test/integration/mattermost.rb
+++ b/qa/qa/scenario/test/integration/mattermost.rb
@@ -10,7 +10,7 @@ module QA
tags :core, :mattermost
def perform(address, mattermost, *rspec_options)
- Runtime::Scenario.define(:mattermost_address, mattermost)
+ Gitlab::QA::Framework::Runtime::Scenario.define(:mattermost_address, mattermost)
super(address, *rspec_options)
end
diff --git a/qa/qa/service/omnibus.rb b/qa/qa/service/omnibus.rb
index 830c524f723..4c35d2f8cfb 100644
--- a/qa/qa/service/omnibus.rb
+++ b/qa/qa/service/omnibus.rb
@@ -15,7 +15,7 @@ module QA
"docker exec #{@name} bash -c '#{input} | gitlab-ctl #{command}'"
end
- Gitlab::QA::Framework::Docker::Shellout.new(cmd).execute!
+ Gitlab::QA::Framework::Utils::Shellout.new(cmd).execute!
end
end
end
diff --git a/qa/qa/service/runner.rb b/qa/qa/service/runner.rb
index bf6eb9a7da0..d9a25f8a096 100644
--- a/qa/qa/service/runner.rb
+++ b/qa/qa/service/runner.rb
@@ -10,12 +10,12 @@ module QA
def initialize(name)
@image = 'gitlab/gitlab-runner:alpine'
@name = name || "qa-runner-#{SecureRandom.hex(4)}"
- @network = Runtime::Scenario.attributes[:network] || 'test'
+ @network = Gitlab::QA::Framework::Runtime::Scenario.attributes[:network] || 'test'
@tags = %w[qa test]
end
def network
- Gitlab::QA::Framework::Docker::Shellout.new("docker network inspect #{@network}").execute!
+ Gitlab::QA::Framework::Utils::Shellout.new("docker network inspect #{@network}").execute!
rescue CommandError
'bridge'
else
@@ -23,7 +23,7 @@ module QA
end
def pull
- Gitlab::QA::Framework::Docker::Shellout.new("docker pull #{@image}").execute!
+ Gitlab::QA::Framework::Utils::Shellout.new("docker pull #{@image}").execute!
end
def register!
@@ -41,7 +41,7 @@ module QA
end
def remove!
- Gitlab::QA::Framework::Docker::Shellout.new("docker rm -f #{@name}").execute!
+ Gitlab::QA::Framework::Utils::Shellout.new("docker rm -f #{@name}").execute!
end
end
end
diff --git a/qa/qa/specs/runner.rb b/qa/qa/specs/runner.rb
deleted file mode 100644
index e09e9101ec6..00000000000
--- a/qa/qa/specs/runner.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require 'rspec/core'
-
-module QA
- module Specs
- class Runner
- include Gitlab::QA::Framework::Scenario::Template
-
- attr_accessor :tty, :tags, :options
-
- def initialize
- @tty = false
- @tags = []
- @options = [File.expand_path('../../features', __dir__)]
- end
-
- def perform
- args = []
- args.push('--tty') if tty
- tags.to_a.each { |tag| args.push(['-t', tag.to_s]) }
- args.push(options)
-
- Runtime::Browser.configure!
-
- RSpec::Core::Runner.run(args.flatten, $stderr, $stdout).tap do |status|
- abort if status.nonzero?
- end
- end
- end
- end
-end
diff --git a/qa/spec/runtime/env_spec.rb b/qa/spec/runtime/env_spec.rb
index 2b6365dbc41..a45103ab2d0 100644
--- a/qa/spec/runtime/env_spec.rb
+++ b/qa/spec/runtime/env_spec.rb
@@ -1,61 +1,6 @@
describe QA::Runtime::Env do
include Support::StubENV
- describe '.chrome_headless?' do
- context 'when there is an env variable set' do
- it 'returns false when falsey values specified' do
- stub_env('CHROME_HEADLESS', 'false')
- expect(described_class.chrome_headless?).to be_falsey
-
- stub_env('CHROME_HEADLESS', 'no')
- expect(described_class.chrome_headless?).to be_falsey
-
- stub_env('CHROME_HEADLESS', '0')
- expect(described_class.chrome_headless?).to be_falsey
- end
-
- it 'returns true when anything else specified' do
- stub_env('CHROME_HEADLESS', 'true')
- expect(described_class.chrome_headless?).to be_truthy
-
- stub_env('CHROME_HEADLESS', '1')
- expect(described_class.chrome_headless?).to be_truthy
-
- stub_env('CHROME_HEADLESS', 'anything')
- expect(described_class.chrome_headless?).to be_truthy
- end
- end
-
- context 'when there is no env variable set' do
- it 'returns the default, true' do
- stub_env('CHROME_HEADLESS', nil)
- expect(described_class.chrome_headless?).to be_truthy
- end
- end
- 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')
- expect(described_class.running_in_ci?).to be_truthy
- end
-
- 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)
- expect(described_class.running_in_ci?).to be_falsey
- end
- end
- end
-
describe '.user_type' do
it 'returns standard if not defined' do
expect(described_class.user_type).to eq('standard')
diff --git a/qa/spec/runtime/key/ecdsa_spec.rb b/qa/spec/runtime/key/ecdsa_spec.rb
index e19ea7b8018..95a79ed59c9 100644
--- a/qa/spec/runtime/key/ecdsa_spec.rb
+++ b/qa/spec/runtime/key/ecdsa_spec.rb
@@ -12,7 +12,7 @@ describe QA::Runtime::Key::ECDSA do
describe '#new' do
it 'does not support arbitrary bits' do
expect { described_class.new(123) }
- .to raise_error(Gitlab::QA::Framework::Docker::Shellout::StatusError)
+ .to raise_error(Gitlab::QA::Framework::Utils::Shellout::StatusError)
end
end
end
diff --git a/qa/spec/runtime/scenario_spec.rb b/qa/spec/runtime/scenario_spec.rb
deleted file mode 100644
index 7009192bcc0..00000000000
--- a/qa/spec/runtime/scenario_spec.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-describe QA::Runtime::Scenario do
- subject 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')
-
- 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')
- end
-
- 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, '')
-
- expect { subject.empty_attribute }
- .to raise_error ArgumentError, /empty_attribute/
- end
-end
diff --git a/qa/spec/scenario/test/instance_spec.rb b/qa/spec/scenario/test/instance_spec.rb
index 92d68f9f7d9..dd2e934582f 100644
--- a/qa/spec/scenario/test/instance_spec.rb
+++ b/qa/spec/scenario/test/instance_spec.rb
@@ -8,12 +8,12 @@ describe QA::Scenario::Test::Instance do
context '#perform' do
let(:arguments) { spy('Runtime::Scenario') }
let(:release) { spy('Runtime::Release') }
- let(:runner) { spy('Specs::Runner') }
+ let(:runner) { spy('Scenario::Runner') }
before do
stub_const('QA::Runtime::Release', release)
- stub_const('QA::Runtime::Scenario', arguments)
- stub_const('QA::Specs::Runner', runner)
+ stub_const('Gitlab::QA::Framework::Runtime::Scenario', arguments)
+ stub_const('Gitlab::QA::Framework::Scenario::Runner', runner)
allow(runner).to receive(:perform).and_yield(runner)
end