Permalink
Browse files

Merge pull request #856 from teampoltergeist/equal

Node equality needs to also compare page_id
  • Loading branch information...
2 parents ebe9aec + f2ace4a commit 7dd97491f1d741073fe9fd3196a2ad6f8f0bed22 @twalpole twalpole committed on GitHub Feb 17, 2017
Showing with 12 additions and 1 deletion.
  1. +1 −1 lib/capybara/poltergeist/node.rb
  2. +11 −0 spec/integration/session_spec.rb
@@ -156,7 +156,7 @@ def trigger(event)
end
def ==(other)
- command :equals, other.id
+ (page_id == other.page_id) && command(:equals, other.id)
end
def send_keys(*keys)
@@ -303,6 +303,17 @@
end
end
+ describe 'Node#==' do
+ it "doesn't equal a node from another page" do
+ @session.visit('/poltergeist/simple')
+ @elem1 = @session.find(:css, '#nav')
+ @session.visit('/poltergeist/set')
+ @elem2 = @session.find(:css, '#filled_div')
+ expect(@elem2 == @elem1).to be false
+ expect(@elem1 == @elem2).to be false
+ end
+ end
+
it 'has no trouble clicking elements when the size of a document changes' do
@session.visit('/poltergeist/long_page')
@session.find(:css, '#penultimate').click

0 comments on commit 7dd9749

Please sign in to comment.