Hello!
My rspec feature test fail with the ff:
Failure/Error: visit "/user_update"
Selenium::WebDriver::Error::UnknownError:
unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/lib/chromium/chrome
is no longer running, so ChromeDriver is assuming that
Chrome has crashed.)
in my spec_helper.rb
I have:
Capybara.register_driver :selenium_chrome_headless do |app|
caps = Selenium::WebDriver::Remote::Capabilities.chrome(
'chromeOptions' => {
'binary' => ENV['CHROME_BIN'],
'args' => ['headless', 'disable-gpu', 'window-size=1366,720', 'no-sandbox'].compact
}.compact)
Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: caps)
end
Capybara.javascript_driver = :selenium_chrome_headless
I also SSH into the job and saw that chromium/chrome and chromedriver have the same version.
cd11e80a7014:~# chromium-browser --version
=> Chromium 86.0.4240.111
cd11e80a7014:~# chromedriver --version
=> ChromeDriver 86.0.4240.111 (b8c36128a06ebad76af51591bfec980224db5522-refs/branch-heads/4240@{#1290})
My circleci config looks like:
feature-tests:
<<: *test-defaults
steps:
- checkout
- run: cp config/circleci.database.yml config/database.yml
# Ruby Dependencies
- restore_cache:
keys:
- gem-cache-v2-{{ checksum "Gemfile.lock" }}
- run:
name: Bundle install and check gem vulnerabilities
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
bundle clean --force
bundle exec bundler-audit check --update
- save_cache:
key: gem-cache-v2-{{ checksum "Gemfile.lock" }}
paths:
- ./vendor/bundle
# Database setup
- run: bundle exec rake db:create db:schema:load
- run:
name: run tests
command: |
mkdir /tmp/test-results
bundle exec rspec \
--format RspecJunitFormatter \
--out /tmp/test-results/rspec.xml \
--format progress \
spec/features/user_updates_feature_spec.rb
Running locally works, but in circleci it fails.
What I have tried:
- add 'disable-dev-shm-usage" in chromeOptions args
- changed the cache keys in the circleci config
- add driver_path option in Capybara::Selenium::Driver.new to explicitly tell where the driver is
What could be the problem?
Thank you.