Jarfis
Jarfis

Reputation: 125

Rspec - Capybara feature spec using the javascript driver isn't finishing after failure

I'm trying to create feature specs for my site, but I've hit a stumbling block pretty much right out of the gate.

When I try and run a capybara javascript feature spec, it fails but doesn't end the test or close the browser window.

running this test

RSpec.feature "Whatever", type: :feature, js: true do
  scenario "whatever again" do
    visit "/whatever_url"
    expect(true).to eq(true)
  end
end

results in

Whatever
  whatever again (FAILED - 1)

and hangs there for hours, no messages about what is causing the failure

I've tried with both the selenium and webkit javascript drivers. They're mostly working since when I run them with more complex actions they carry them out, it's just the finishing the test part that is giving me trouble.

I'm running it with rails 4.2.4, rspec 3.5.1, capybara 2.7.1, and ubuntu 15.10. If there's any other useful data I should include please let me know

Upvotes: 0

Views: 683

Answers (1)

Jarfis
Jarfis

Reputation: 125

I figured out what the problem was.

In my rails_helper there was a config.after(:all) block wrapping DatabaseCleaner.clean that was freezing when javascript specs were done.

The failure in the test itself was a missing asset cropping up in the console when visit was being fired off.

update: I was also encountering other problems with capybara and the js webdrivers interacting with devise and solved that with the solution here, and after implementing that solution the DatabaseCleaner.clean in the after(:all) no longer causes this problem

Upvotes: 1

Related Questions