Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headless Chrome hangs up forever #70

Closed
neosepulveda opened this issue May 1, 2019 · 6 comments
Closed

Headless Chrome hangs up forever #70

neosepulveda opened this issue May 1, 2019 · 6 comments

Comments

@neosepulveda
Copy link

Hi Heroku!

I just created a new Rails app and I added one system test using headless Chrome. The test suite run perfectly well on localhost but in Heroku CI hangs up forever. I followed a few setups and configurations that I've seen around, however, I always end up in the same point.

heroku ci:debug --pipeline foo

$ bundle exec rspec spec/system/react_status_spec.rb 
DEPRECATION WARNING: Single arity template handlers are deprecated. Template handlers must
now accept two parameters, the view object and the source for the view object.
Change:
  >> JbuilderHandler.call(template)
To:
  >> JbuilderHandler.call(template, source)
 (called from <top (required)> at /app/config/environment.rb:7)
DEPRECATION WARNING: Single arity template handlers are deprecated. Template handlers must
now accept two parameters, the view object and the source for the view object.
Change:
  >> JbuilderHandler.call(template)
To:
  >> JbuilderHandler.call(template, source)
 (called from <main> at /app/config/environment.rb:7)
Capybara starting Puma...
* Version 3.12.1 , codename: Llamas in Pajamas
* Min threads: 0, max threads: 4
* Listening on tcp://127.0.0.1:46206

DevTools listening on ws://127.0.0.1:9222/devtools/browser/21f03248-bfc5-4fbc-8b07-542888f4ac9e

It hangs up indefinitely after displaying DevTools listening on ws://127.0.0.1:9222/devtools/browser/21f03248-bfc5-4fbc-8b07-542888f4ac9e. It never times out or displays an error.

This is Capybara-Chrome driver configuration

# frozen_string_literal: true

require 'selenium/webdriver'
require 'capybara-screenshot/rspec'
Capybara.javascript_driver = :selenium_chrome_headless

Capybara::Screenshot.register_driver(:selenium_chrome_headless) do |driver, path|
  driver.browser.save_screenshot(path)
end

RSpec.configure do |config|
  config.before(:each, type: :system) do
    driven_by(:rack_test)
  end

  config.before(:each, type: :system, js: true) do
    driven_by(:selenium_chrome_headless)
  end
end

This is my app.json heroku Ci file

  "environments": {
    "test": {
      "addons": [
        "heroku-postgresql"
      ],
      "scripts": {
        "test": "bundle exec rspec"
      },
      "formation": {
        "test": {
          "quantity": 1,
          "size": "standard-1x"
        }
      },
      "buildpacks": [
        { "url": "heroku/ruby" },
        { "url": "heroku/nodejs" },
        { "url": "https://github.com/heroku/heroku-buildpack-google-chrome" },
        { "url": "https://github.com/heroku/heroku-buildpack-chromedriver" }
      ]
    }
  }

Any ideas of what is causing this problem?

Thank you very much in advance ❤️

@rubendinho
Copy link

rubendinho commented May 1, 2019

@neosepulveda There have been a bunch of problems related to - i think - a change in how Google publishes version numbers.

Try setting your chrome driver version explicitly. Per https://github.com/heroku/heroku-buildpack-chromedriver, that would involve setting CHROMEDRIVER_VERSION explicitly to the latest stable version. As of this writing, that's "74.0.3729.6"

Possibly related: titusfortner/webdrivers#72

@neosepulveda
Copy link
Author

@rubendinho Thanks for the quick reply. I tried using the stable release in the path or specifying the version as mentioned in the issue your referenced but no luck...

As a reference for other people who stumble into this, this is what I tried and did not work:

Selenium::WebDriver::Chrome.path = '/app/.apt/usr/bin/google-chrome-stable'
Webdrivers::Chromedriver.version = '2.46'

@rubendinho How do you exactly specify what CHROMEDRIVER_VERSION to use? Thanks

@rubendinho
Copy link

rubendinho commented May 2, 2019 via email

@neosepulveda
Copy link
Author

HI @rubendinho, I tried your suggestion and still not working unfortunately.

Here is the log log

-----> Downloading chromedriver v74.0.3729.6...
Archive:  /tmp/chromedriver.zip
  inflating: /app/.chromedriver/bin/chromedriver  
-----> Creating chromedriver export scripts...
-----> No test-setup command provided. Skipping.
-----> Run `eval $(ci env)` to set up your environment for running tests

~ $ bundle exec rspec 
Capybara starting Puma...
* Version 3.12.1 , codename: Llamas in Pajamas
* Min threads: 0, max threads: 4
* Listening on tcp://127.0.0.1:37885
2019-05-02 09:25:32 DEBUG Webdrivers Looking for Site: https://chromedriver.storage.googleapis.com
2019-05-02 09:25:32 DEBUG Webdrivers Get response: #<Net::HTTPOK 200 OK readbody=true>
2019-05-02 09:25:32 DEBUG Webdrivers Found Site: https://chromedriver.storage.googleapis.com
2019-05-02 09:25:32 DEBUG Webdrivers Looking for Site: https://chromedriver.storage.googleapis.com
2019-05-02 09:25:33 DEBUG Webdrivers Get response: #<Net::HTTPOK 200 OK readbody=true>
2019-05-02 09:25:33 DEBUG Webdrivers Found Site: https://chromedriver.storage.googleapis.com
2019-05-02 09:25:33 DEBUG Webdrivers Browser executable: '/app/.apt/usr/bin/google-chrome'

DevTools listening on ws://127.0.0.1:9222/devtools/browser/dae2e479-2f5c-4bfa-b403-f7011bdb1a21

FYI, I am using webdrivers gem as you said

@kapoorlakshya
Copy link
Contributor

The webdrivers related problem has been solved - titusfortner/webdrivers#72

@neosepulveda
Copy link
Author

Closing this issue as it has been solved in titusfortner/webdrivers#72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants