diff --git a/.circleci/config.yml b/.circleci/config.yml index c12d5c60..d1e8c724 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,6 +19,9 @@ jobs: - image: redis:7.0 - image: selenium/standalone-chrome:latest name: chrome + environment: + START_XVFB: 'false' + JAVA_OPTS: -Dwebdriver.chrome.whitelistedIps= steps: - checkout @@ -30,6 +33,10 @@ jobs: - run: name: Bundle Install command: bundle install --jobs=4 --retry=3 + - run: + name: Wait for Selenium Chrome + command: | + dockerize -wait tcp://chrome:4444 -timeout 1m - run: name: Database Setup command: | @@ -40,6 +47,8 @@ jobs: command: bundle exec rspec - store_artifacts: path: coverage + - store_artifacts: + path: tmp/capybara workflows: rspec: diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 83365aa1..4e34b6af 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -46,6 +46,14 @@ RSpec.configure do |config| # Configure Capybara for CI environments if ENV['CI'] # Setup for CircleCI + Capybara.server = :puma, { Silent: true } + + # Make the app accessible to Chrome in the Docker network + ip_address = Socket.ip_address_list.detect(&:ipv4_private?).ip_address + host! "http://#{ip_address}" + Capybara.server_host = ip_address + Capybara.app_host = "http://#{ip_address}:#{Capybara.server_port}" + driven_by :selenium, using: :headless_chrome, options: { browser: :remote, url: "http://chrome:4444/wd/hub",