WebDriverError

My code passes all tests on local environment but won’t pass test on CircleCI

Failures:

  1) User registers invalid personal info and declined card
     Failure/Error: visit register_path
     Selenium::WebDriver::Error::WebDriverError:
       unable to connect to chromedriver 127.0.0.1:9515
     # ./spec/features/user_registers_spec.rb:5:in `block (2 levels) in <top (required)>'

Something wrong with selenium-webdriver on CircleCI?

this is my Gemfile

group :test do
  gem 'database_cleaner', '1.4.1'
  gem 'shoulda-matchers', '2.7.0'
  gem 'vcr', '3.0.3'
  gem 'webmock'
  gem 'capybara'
  gem 'capybara-email'
  gem 'selenium-webdriver'
end

I installed chromedriver using brew, do I need to set up Circle yml file?

Are you using Circle 1.0 or 2.0? What config file are you using? At a guess you’d need to ensure that Selenium, Chrome and the ChromeDriver is on that box, and I imagine a config file is the way to do it.

Don’t forget you can run a build with SSH and try running your tests manually - if they don’t work, you can apt-get install stuff and then try again - it makes debugging a whole lot easier.

Thanks Halfer

I am using 1.0

this is my circle.yml file now. After this error, I added the dependencies part at the bottom, but I am still facing the same issue.

machine:
  ruby:
    version: 2.1.2
  environment:
    STRIPE_PUBLISHABLE_KEY: 
    STRIPE_SECRET_KEY: 
deployment:
  production:
    branch: master
    commands:
      - git fetch --unshallow
      - heroku maintenance:on --app xxx
      - heroku pg:backups capture --app xxx
      - git push git@heroku.com:walterflix.git $CIRCLE_SHA1:refs/heads/master
      - heroku run rake db:migrate --app xxx
      - heroku maintenance:off --app xxx
  staging:
    branch: staging
    commands:
      - git fetch --unshallow
      - heroku maintenance:on --app xxx-staging
      - git push git@heroku.com:xxx-staging.git $CIRCLE_SHA1:refs/heads/master
      - heroku run rake db:migrate --app xxx-staging
      - heroku maintenance:off --app xxx-staging
  dependencies:
    pre:
      # install chrome
      - wget -N https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -P ~/
      - sudo dpkg -i --force-depends ~/google-chrome-stable_current_amd64.deb
      - sudo apt-get -f install -y
      - sudo dpkg -i --force-depends ~/google-chrome-stable_current_amd64.deb
      - sudo rm /usr/local/bin/chromedriver
      # install chromedriver
      - wget -N http://chromedriver.storage.googleapis.com/2.34/chromedriver_linux64.zip -P ~/
      - unzip ~/chromedriver_linux64.zip -d ~/
      - rm ~/chromedriver_linux64.zip
      - sudo mv -f ~/chromedriver /usr/local/bin/chromedriver
      - sudo chown root:root /usr/local/bin/chromedriver
      - sudo chmod 0755 /usr/local/bin/chromedriver

OK. Fail a build and debug via SSH? See if there are any logs left by Selenium or Chrome etc first. Then try launching Selenium in the foreground to see if it starts, etc.

Sorry Halfer, I am new to this field,

I am not sure what should I do exactly based on your advice right now :slight_smile:

But it didn’t fail to build or didn’t break at least, the errors are still the same as I posted…