Reputation: 11920
I'm using RSpec with Capybara. On tests marked js: true
it uses the default javascript driver (Selenium).
The test itself passes (see below), but I noticed it opens a Firefox window and then immediately closes it while running the test. As you can see below, the test is pretty straightforward and I don't have anything like save_and_open_page
anywhere in there.
Thanks!
# rails_helper
require "spec_helper"
require "rspec/rails"
require "capybara/rails"
require "capybara/rspec"
# Test
it "user can sign in", js: true do
visit root_path
click_tab("sign_up")
fill_in "session[email]", with: "[email protected]"
fill_in "session[password]", with: "gr4ce!"
click_submit
expect(current_path).to eq(home_index_path)
end
Upvotes: 1
Views: 1136
Reputation: 268
This happens because the Selenium driver uses firefox to execute the javascript in the test. You can use a headless browser such as phantom.js which wont open a browser window. The poltergiest gem is probably what you are looking for.
Upvotes: 3