Sig
Sig

Reputation: 5916

Page has field both visible and invisible at the same time

How is it possible the following spec (RSpec 3.8 + Capybara 3.8.2) passes?

scenario 'he can dismiss it', js: true do
  find(:dataAttribute, 'tags.addButton').click

  expect(page).to have_field('tag[name]', visible: false)
  expect(page).to have_field('tag[name]')
end

Here the HTML

<input class="input" type="text" name="tag[name]" id="tag_name" />

Upvotes: 0

Views: 145

Answers (1)

Thomas Walpole
Thomas Walpole

Reputation: 49880

visible: false means to not check visibility -- if you want to confirm the element is not visible you need to specify visible: :hidden

Upvotes: 1

Related Questions