I have created a docker compose file for doing Capybara tests inside a container. The problem i'm currently facing to is that i can't find a ability to to route the subdomains of my lvh.me domain. When I add lvh.me to the hosts file of Selenium I get the same result that my tests are failing. In which way can I add some routing for subdomains to Selenium to accept subdomains like {{user}}.lvh.me:3001
My Capybara configuration
Capybara.register_driver :selenium do |app|
Capybara.app_host = "http://0.0.0.0:3001"
Capybara.server_host = '0.0.0.0'
Capybara.server_port = '3001'
Capybara.always_include_port = true
args = ['--no-default-browser-check', '--headless', '--start-maximized']
caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"args" => args})
Capybara::Selenium::Driver.new(
app,
browser: :remote,
url: "http://hub:4444/wd/hub",
desired_capabilities: caps
)
end
Capybara.configure do |config|
config.default_driver = :rack_test
config.javascript_driver = :selenium
end
And my docker compose file
version: '3'
services:
db:
image: postgres
volumes:
- ./tmp/db:/var/lib/postgresql/data
redis:
image: redis
volumes:
- ./tmp/redis:/var/lib/redis/data
web:
build: .
environment:
- REDIS_URL=redis://redis
- DATABASE_HOST=db
command: sh "/myapp/docker-entrypoint.sh"
volumes:
- .:/myapp
links:
- db
- redis
- hub
depends_on:
- db
- redis
ports:
- "3001:3001"
- "3000:3000"
hub:
container_name: hub
image: selenium/hub:3.9
ports:
- "4444:4444"
selenium:
container_name: selenium
image: selenium/node-chrome:3.9
environment:
HUB_PORT_4444_TCP_ADDR: hub
HUB_PORT_4444_TCP_PORT: 4444
depends_on:
- hub
links:
- hub