Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
# config.action_view.annotate_rendered_view_with_filenames = true

config.i18n.enforce_available_locales = false

# Add config/routes_test.rb to routes
config.paths['config/routes.rb'] << Rails.root.join('config/routes_test.rb')
end

# Used by Rails' routes url_helpers (typically when including a link in an email)
Expand Down
9 changes: 9 additions & 0 deletions config/routes_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

Rails.application.routes.draw do
# Define your test-specific routes here

# This route will return an empty response with a 200 OK status code
# when the browser requests the favicon.ico file.
get '/favicon.ico', to: proc { |_env| [200, {}, ['']] }
end
12 changes: 11 additions & 1 deletion spec/support/capybara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,23 @@
# Use the fast rack_test driver for non-feature tests by default
Capybara.default_driver = :rack_test

# Create a custom driver based on Capybara's :selenium_chrome_headless driver
# This resolves a ElementClickInterceptedError when executing `click_button 'Sign in'` with DMP Assistant
Capybara.register_driver :selenium_chrome_headless_add_window_size do |app|
# Get a copy of the default options for Capybara's :selenium_chrome_headless driver
options = Capybara.drivers[:selenium_chrome_headless].call.options[:options].dup
options.add_argument('--window-size=1920,1080') # default window-size is only (800x600)
# Create a new Selenium driver with the customised options
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
end

RSpec.configure do |config|
config.before(:each, type: :feature, js: false) do
Capybara.use_default_driver
end

# Use the Selenium headless Chrome driver for feature tests
config.before(:each, type: :feature, js: true) do
Capybara.current_driver = :selenium_chrome_headless
Capybara.current_driver = :selenium_chrome_headless_add_window_size
end
end