You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Driver Information (and browser if relevant):
it's relevant, as the issue happens only with rack_test. With a JS capable driver (I actually tried only Chrome) the issue is not present.
Expected Behavior
Spec should pass
Actual Behavior
Spec fails
Steps to reproduce
While working on this PR I encountered what I think is a rather rare situation where inside awithin block rack_test fails to find a CSS selector that becomes present after clicking an element inside the within HTML .
What happens is that the node is stale and does not include the changes from the page refresh. This is the actual commit that explains and fixes the spec.
I haven't spent much time in investigating if this can be solved in other ways than splitting the within block in the spec, but I was able to fix the issue and keep the single within block by injecting this code in Capybara:
I'm not confident this is a good fix, as it changes the behavior of Capybara::Node::Base, which I think is used by other drivers too, but I hope it can be useful in pointing someone to the right solution.
The text was updated successfully, but these errors were encountered:
Thanks for reporting this. As you stated the provided path is not a good fix because it would affect all drivers and there are plenty of valid situations where find_css would return an empty result set that we don't want to be triggering an extra search for. Your patch would also only affect CSS and not XPath behavior. The root cause of this issue is that the context node is not being detected as stale when the document changes, I will need to play around with the code to see what (if anything) we can do about that.
@spaghetticode Please try the issue_2157 branch and let me know if that fixes the problem for you - It's not a final solution yet but is probably the general direction I will go for a final solution.
Meta
Capybara Version:
3.13.2
Driver Information (and browser if relevant):
it's relevant, as the issue happens only with
rack_test
. With a JS capable driver (I actually tried only Chrome) the issue is not present.Expected Behavior
Spec should pass
Actual Behavior
Spec fails
Steps to reproduce
While working on this PR I encountered what I think is a rather rare situation where inside a
within
blockrack_test
fails to find a CSS selector that becomes present after clicking an element inside thewithin
HTML .What happens is that the node is stale and does not include the changes from the page refresh. This is the actual commit that explains and fixes the spec.
I haven't spent much time in investigating if this can be solved in other ways than splitting the
within
block in the spec, but I was able to fix the issue and keep the singlewithin
block by injecting this code in Capybara:I'm not confident this is a good fix, as it changes the behavior of
Capybara::Node::Base
, which I think is used by other drivers too, but I hope it can be useful in pointing someone to the right solution.The text was updated successfully, but these errors were encountered: