Created
February 27, 2019 06:49
-
-
Save sj26/1579926c405a1652127a657669e155e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.6" | |
services: | |
app: | |
build: .. | |
depends_on: | |
- selenium | |
environment: | |
SELENIUM_HOST: selenium | |
selenium: | |
image: selenium/standalone-chrome | |
shm_size: 2g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Capybara.configure do |config| | |
config.default_driver = :selenium | |
# We use remote in docker compose to drive headless chrome in another container | |
selenium_host = ENV.fetch("SELENIUM_HOST", "127.0.0.1") | |
selenium_port = ENV.fetch("SELENIUM_PORT", "4444") | |
# Selenium container needs to talk back to us, but docker-compose run | |
# doesn't use a stable hostname, so listen on all addresses and ask for the | |
# current hostname and tell selenium to connect back on that. Also add the | |
# ephemeral port to all `visit` urls, etc. | |
config.server = :puma | |
config.server_host = "0.0.0.0" | |
config.app_host = "http://#{Socket.gethostname}" | |
config.always_include_port = true | |
Capybara.register_driver :selenium do |app| | |
Capybara::Selenium::Driver.new app, | |
browser: :remote, | |
url: "http://#{selenium_host}:#{selenium_port}/wd/hub", | |
desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment