Suppose I'm testing a form with Capybara and Minitest, the form has a text input, which using bootstrap-datepicker, I wanna unscope(like ActiveRecord) the within('form') scope only at assert_selector '.datepicker-dropdown', count: 1
, as .datepicker-dropdown
is appended to body not the form
within "form" do
# other tests...
find("input.date-picker").click
assert_selector '.datepicker-dropdown', count: 1
# failed because .datepicker-dropdown is appended to body
end
Though bootstrap-datepicker have an option container to specify where to append the datepicker-dropdown widget, but not suitable for this case.
question from:https://stackoverflow.com/questions/65838745/capybara-ingore-within-scope-at-specify-assertion