This is the command that I am running to execute the javascript tests using capybara
docker-compose run --rm --service-ports --use-aliases -e RAILS_ENV=test test /bin/bash -l -c "sleep 1 && bundle exec rails db:migrate && bundle exec rspec --tag js --fail-fast --format documentation"
However, when the tests are being executed, I get the above error. From my perspective, everything has been setup as Capybara has noted in the documentation, but It seems Capybara isn't recognizing the driver.
Turns out I had the config Capybara.javascript_driver = :selenium_headless_in_container inside the Capybara.register_driver block. Once outside, it executed successfully.
Error Summary
I have a Docker container where I am trying to run Capybara using Selenium and when I run the tests, it throws the following error:
Current System Specs
Here are the current specs of what I'm running: Ruby Version: 3.2.2 Rails Version: 6.1.7.7 Puma Version: 6.4.2 capybara Version: 3.40.0 capybara-lockstep version: 2.2.0 selenium-webdriver version: 4.17.0 Selenium Docker Image: selenium/standalone-chrome:120.0.6099.224-chromedriver-120.0.6099.109-grid-4.17.0-20240123
Local System Setup
Here is the configuration I have:
spec/support/capybara.rb
spec/rails_helper.rb
build/docker-compose.yml
Steps to reproduce
This is the command that I am running to execute the javascript tests using capybara
docker-compose run --rm --service-ports --use-aliases -e RAILS_ENV=test test /bin/bash -l -c "sleep 1 && bundle exec rails db:migrate && bundle exec rspec --tag js --fail-fast --format documentation"
However, when the tests are being executed, I get the above error. From my perspective, everything has been setup as Capybara has noted in the documentation, but It seems Capybara isn't recognizing the driver.