jasmine / jasmine-gem

Jasmine ruby gem
682 stars 274 forks source link

PhantomJS is abandoned, replace it with Selenium/Chrome headless #293

Closed plentz closed 5 years ago

plentz commented 6 years ago

related https://github.com/rails/rails/pull/30930/

BrianHawley commented 6 years ago

But be sure to keep PhantomJS support as an option, in case people have to run tests on platforms where GTK3 isn't supported, so they can't run headless Chrome/Firefox. (Yes, I'm aware that having to run tests on a platform that old is its own problem, but it happens.)

slackersoft commented 6 years ago

The original selenium functionality never really disappeared, just pulled out of this repo. Take a look at jasmine_selenium_runner for real browser support. This gives users who are fine with PhantomJS and don't want the Selenium overhead the option, while still allowing users who want a real browser that option.

Hope this helps. Thanks for using Jasmine!

rpbaltazar commented 5 years ago

Is chrome headless supported in the end, or not?

slackersoft commented 5 years ago

Chrome headless is supported via the jasmine selenium runner gem. I don't think we have great docs for how to use the headless part of chrome with the selenium runner, but I would be happy to review a pull request there to update the readme with steps to configure the browser.

Hope this helps. Thanks for using Jasmine!

benthorner commented 5 years ago

To add to the above, here's how we're using headless Chrome with Jasmine.

# Gemfile
group :development, :test do
  gem "jasmine"
  gem "jasmine_selenium_runner", require: false
end

# spec/javascripts/support/jasmine_helper.rb
require "jasmine/runners/selenium"

Jasmine.configure do |config|
  config.runner = lambda { |formatter, jasmine_server_url|
    options = Selenium::WebDriver::Chrome::Options.new
    options.headless!

    webdriver = Selenium::WebDriver.for(:chrome, options: options)
    Jasmine::Runners::Selenium.new(formatter, jasmine_server_url, webdriver, 50)
  }
end

The jasmine_selenium_runner gem doesn't support headless chrome out of the box.

jergarmar commented 5 years ago

Thanks so much for the headless chrome example. Super helpful!