0

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

Jarfis
  • 125
  • 11
  • The example you've given should pass not fail - what errors are you getting? – Thomas Walpole Nov 08 '16 at 17:47
  • That's the thing, I'm not getting any errors. I've updated the question to include the results from the spec (not sure why I forgot that in the first place) – Jarfis Nov 08 '16 at 17:54
  • ok -- fyi assuming the `RSpec.feature` you're calling is the one provided by Capybara then you don't need to also specify `type: :feature` since it's already set. – Thomas Walpole Nov 08 '16 at 23:13

1 Answers1

1

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

Community
  • 1
  • 1
Jarfis
  • 125
  • 11