Вопрос

I have a rails app and I am using a nitrous.io box to develop it. I am trying to run my cucumber features but I am getting an error because firefox is not install. I tried to install firefox but the security settings of the box does not allow me to do.

It there a way to run cucumber features on a nitrous box?

Это было полезно?

Решение

Since you will not be able to utilize a web browser within the web IDE, you will want to utilize PhantomJS. You can install the latest version with the Autoparts package manager:

parts install phantomjs

Once installed, you will need to configure your rails app to utilize it. There are many articles which will help you out with this. Here is a bit from blog.pezholio.co.uk which covers using PhantomJS with Cucumber:

" I’m assuming you’ve got Cucumber-rails set up in your Rails app already, so if you haven’t, take a look at this Railscast to get you started.

Next, add poltergeist to your gemfile (probably in your :test group) like so:

gem 'poltergeist'

and run bundle install

The next thing to do is register Poltergeist as a new browser in Cucumber, and make it run as the default driver for all your JavaScript tests. Open up your features/support/env.rb file and add the following lines:

require 'capybara/poltergeist'

Capybara.register_driver :poltergeist do |app|
    Capybara::Poltergeist::Driver.new(app, {debug: false})
end

Capybara.javascript_driver = :poltergeist

Then you should be good to go! Crucially, you need to make sure you add the @javascript tag to all your tests, so Capybara knows to use Poltergeist for your tests, but other than that, when you now run your tests, rather than a browser window being fired up, everything happens in the background like magic! "

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top