Reputation: 12653
I am testing a Rails app on CircleCI. I'm running parallel tests in separate containers.
#.circleci/config.yml
...
jobs:
build:
parallelism: 2
...
One container always fails with:
Selenium::WebDriver::Error::WebDriverError:
invalid session id
If I change configuration and only run 1 container, all my tests pass.
I guess I have configured something incorrectly for parallel testing. Can anyone help me to understand why Selenium might be expecting a session that does not exist, and where I should be looking to debug this?
Upvotes: 1
Views: 937
Reputation: 3573
This is a common problem in selenium running in docker env. A way to fix it is use the disable-dev-shm-usage
options and change the Capybara server port. Like it:
# ...
Capybara.server_port = 9887 + ENV["CIRCLE_NODE_INDEX"].to_i # In order to create a new server port to each runner
Capybara.register_driver :headless_chrome do |app|
# ...
browser_options.args << '--disable-dev-shm-usage'
# ...
end
Source: https://github.com/grosser/parallel_tests/issues/658#issuecomment-429395002
Upvotes: 3