diff --git a/docker-compose.yml b/docker-compose.yml index bd05cd9b..864ae862 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,9 +18,17 @@ services: - .:/app ports: - "3000:3000" + - "4000:4000" - "35729:35729" environment: - HOSTNAME=localhost:3000 - DOCKERIZED=true depends_on: - postgresql + + selenium_chrome: + image: selenium/standalone-chrome-debug + logging: + driver: none + ports: + - 5900:5900 diff --git a/features/support/env.rb b/features/support/env.rb index 68dd53e9..8f18e8e1 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -87,12 +87,33 @@ ) end +Capybara.register_driver :selenium_chrome_in_container do |app| + Capybara::Selenium::Driver.new app, browser: :remote, url: "http://selenium_chrome:444/wd/hub", desired_capabilities: :chrome +end + +Capybara.register_driver :headless_selenium_chrome_in_container do |app| + Capybara::Selenium::Driver.new( + app, + browser: :remote, + url: "http://selenium_chrome:4444/wd/hub", + desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w(headless disable-gpu) } ) + ) +end + Capybara.javascript_driver = if ENV['CAPYBARA_JAVASCRIPT_DRIVER'] ENV['CAPYBARA_JAVASCRIPT_DRIVER'].to_sym else - :selenium + :headless_selenium_chrome_in_container end +Capybara.server_host = '0.0.0.0' + +Capybara.server_port = 4000 + +Capybara.app_host = 'http://app:4000' + +Capybara.always_include_port = true + if ENV['BROWSER'] DatabaseCleaner.strategy = :truncation Capybara.default_driver = ENV['BROWSER'].to_sym