mardi 5 février 2019

Capybara have_text Passes When It Should Fail

I have an test written with RSpec and Capybara that should not be passing, however it is:

it 'should have the given text' do
  visit root_path
  expect(page).to have_text("This is not here")
end

I then included this in the test to look for the issue:

puts page.text

It returns a lot more text than is on the page, and included in that is:

Extracted source (around line #12):
10 11 12 13
})
visit root_path
expect(page).to have_text("This is not here")

It looks like whatever I put in my test will come up when it calls has_text?. Why does it contain all this text that is not on the page?

Aucun commentaire:

Enregistrer un commentaire