recursive_acronym
recursive_acronym

Reputation: 3031

capybara error message, test still passes

When I run integrations tests with Capybara/webkit I get this error message:

undefined|36|TypeError: Result of expression 'node' [undefined] is not an object.

However it doesn't cause the test to fail and it doesn't always occur. When it does occur it seems to occur at the same point in the test (right before the final assertion)

test:

it "does something with things" do
  #....
  within('#dialog_box') do
    click_button 'Save'
  end
  puts 'after within'
  page.should have_content(thing_attrs[:name]) 
  puts 'after assertion'
end

Final output:

after within
undefined|36|TypeError: Result of expression 'node' [undefined] is not an object.
after assertion
  does something with things [pass]

How can I narrow down what is causing this? It makes test output ugly :)

Upvotes: 1

Views: 521

Answers (1)

Chris Salzberg
Chris Salzberg

Reputation: 27374

I had a very similar problem, the error I was getting was:

undefined|0|TypeError: 'undefined' is not an object

In the end in order to figure out where it was coming from, I removed js files from application.js one by one until the error disappeared. Once I had narrowed it down, I figured out that there was, in fact, an undefined variable, which wasn't causing any issues and hence all tests were passing.

There might be a better way to do this, not really sure, but this approach worked for me. Best of luck.

Upvotes: 2

Related Questions