diff options
author | blackst0ne <blackst0ne.ru@gmail.com> | 2018-05-14 10:55:41 +0300 |
---|---|---|
committer | blackst0ne <blackst0ne.ru@gmail.com> | 2018-05-14 10:55:41 +0300 |
commit | 5d8cd87c5006f467e7c7985ce38d42b51c0bbb66 (patch) | |
tree | c0d460e2e26ce08df1dfa8fd530420a194c7a187 /features/support | |
parent | 5f4dc699434ad86f611897fd6f9f5ca0de8826b5 (diff) |
Remove /features
Diffstat (limited to 'features/support')
-rw-r--r-- | features/support/capybara.rb | 50 | ||||
-rw-r--r-- | features/support/db_cleaner.rb | 11 | ||||
-rw-r--r-- | features/support/env.rb | 60 | ||||
-rw-r--r-- | features/support/gitaly.rb | 3 | ||||
-rw-r--r-- | features/support/login_helpers.rb | 19 | ||||
-rw-r--r-- | features/support/rerun.rb | 16 |
6 files changed, 0 insertions, 159 deletions
diff --git a/features/support/capybara.rb b/features/support/capybara.rb deleted file mode 100644 index 8879c9ab650..00000000000 --- a/features/support/capybara.rb +++ /dev/null @@ -1,50 +0,0 @@ -require 'capybara-screenshot/spinach' - -# Give CI some extra time -timeout = (ENV['CI'] || ENV['CI_SERVER']) ? 60 : 30 - -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,1400") - - # Chrome won't work properly in a Docker container in sandbox mode - options.add_argument("no-sandbox") - - # Run headless by default unless CHROME_HEADLESS specified - options.add_argument("headless") unless ENV['CHROME_HEADLESS'] =~ /^(false|no|0)$/i - - # Disable /dev/shm use in CI. See https://gitlab.com/gitlab-org/gitlab-ee/issues/4252 - options.add_argument("disable-dev-shm-usage") if ENV['CI'] || ENV['CI_SERVER'] - - Capybara::Selenium::Driver.new( - app, - browser: :chrome, - desired_capabilities: capabilities, - options: options - ) -end - -Capybara.javascript_driver = :chrome -Capybara.default_max_wait_time = timeout -Capybara.ignore_hidden_elements = false - -# 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 - -Spinach.hooks.before_run do - TestEnv.eager_load_driver_server -end diff --git a/features/support/db_cleaner.rb b/features/support/db_cleaner.rb deleted file mode 100644 index 31c922d23c3..00000000000 --- a/features/support/db_cleaner.rb +++ /dev/null @@ -1,11 +0,0 @@ -require 'database_cleaner' - -DatabaseCleaner[:active_record].strategy = :deletion - -Spinach.hooks.before_scenario do - DatabaseCleaner.start -end - -Spinach.hooks.after_scenario do - DatabaseCleaner.clean -end diff --git a/features/support/env.rb b/features/support/env.rb deleted file mode 100644 index 8fa2fcb6e3e..00000000000 --- a/features/support/env.rb +++ /dev/null @@ -1,60 +0,0 @@ -require './spec/simplecov_env' -SimpleCovEnv.start! - -ENV['RAILS_ENV'] = 'test' -require './config/environment' -require 'rspec/expectations' - -if ENV['CI'] - require 'knapsack' - Knapsack::Adapters::SpinachAdapter.bind -end - -WebMock.enable! - -%w(select2_helper test_env repo_helpers wait_for_requests project_forks_helper).each do |f| - require Rails.root.join('spec', 'support', 'helpers', f) -end - -%w(sidekiq webmock).each do |f| - require Rails.root.join('spec', 'support', f) -end - -Dir["#{Rails.root}/features/steps/shared/*.rb"].each { |file| require file } - -Spinach.hooks.before_run do - include RSpec::Mocks::ExampleMethods - include ActiveJob::TestHelper - include FactoryBot::Syntax::Methods - include GitlabRoutingHelper - - RSpec::Mocks.setup - TestEnv.init(mailer: false) - - # skip pre-receive hook check so we can use - # web editor and merge - TestEnv.disable_pre_receive -end - -Spinach.hooks.after_scenario do |scenario_data, step_definitions| - if scenario_data.tags.include?('javascript') - include WaitForRequests - block_and_wait_for_requests_complete - end -end - -module StdoutReporterWithScenarioLocation - # Override the standard reporter to show filename and line number next to each - # scenario for easy, focused re-runs - def before_scenario_run(scenario, step_definitions = nil) - @max_step_name_length = scenario.steps.map(&:name).map(&:length).max if scenario.steps.any? # rubocop:disable Gitlab/ModuleWithInstanceVariables - name = scenario.name - - # This number has no significance, it's just to line things up - max_length = @max_step_name_length + 19 # rubocop:disable Gitlab/ModuleWithInstanceVariables - out.puts "\n #{'Scenario:'.green} #{name.light_green.ljust(max_length)}" \ - " # #{scenario.feature.filename}:#{scenario.line}" - end -end - -Spinach::Reporter::Stdout.prepend(StdoutReporterWithScenarioLocation) diff --git a/features/support/gitaly.rb b/features/support/gitaly.rb deleted file mode 100644 index 3cd5f4ce497..00000000000 --- a/features/support/gitaly.rb +++ /dev/null @@ -1,3 +0,0 @@ -Spinach.hooks.before_scenario do - allow(Gitlab::GitalyClient).to receive(:feature_enabled?).and_return(true) -end diff --git a/features/support/login_helpers.rb b/features/support/login_helpers.rb deleted file mode 100644 index 540ff25a4f2..00000000000 --- a/features/support/login_helpers.rb +++ /dev/null @@ -1,19 +0,0 @@ -module LoginHelpers - # After inclusion, IntegrationHelpers calls these two methods that aren't - # supported by Spinach, so we perform the end results ourselves - class << self - def setup(*args) - Spinach.hooks.before_scenario do - Warden.test_mode! - end - end - - def teardown(*args) - Spinach.hooks.after_scenario do - Warden.test_reset! - end - end - end - - include Devise::Test::IntegrationHelpers -end diff --git a/features/support/rerun.rb b/features/support/rerun.rb deleted file mode 100644 index 60b78f9d050..00000000000 --- a/features/support/rerun.rb +++ /dev/null @@ -1,16 +0,0 @@ -# The spinach-rerun-reporter doesn't define the on_undefined_step -# See it here: https://github.com/javierav/spinach-rerun-reporter/blob/master/lib/spinach/reporter/rerun.rb -require 'spinach-rerun-reporter' - -module Spinach - class Reporter - class Rerun - def on_undefined_step(step_data, failure, step_definitions = nil) - super step_data, failure, step_definitions - - # save feature file and scenario line - @rerun << "#{current_feature.filename}:#{current_scenario.line}" - end - end - end -end |