Closed jaynetics closed 3 years ago
Your thoughts on the issue are definitely possible, I will take a look. In the meantime to make your test more reliable - since the labels do appear to be vanishing as the error message is being built it sounds like you need to increase the maximum wait time in your expectation, and you really should be using the block form of accept_confirm (the blockless form is driver specific and will stop working at some point)
accept_confirm do
# click button to remove labels and trigger confirm dialog
click_on 'label remover'
end
# labels should be gone
expect(page).not_to have_selector('label', wait: 5) # increase the maximum wait time enough for the labels to reliably be removed
Fixed via 76912ce0e8746072162b15cf7fc8894805aac917
Meta
Capybara Version: 3.34.0 Driver Information (and browser if relevant): selenium-webdriver 4.0.0beta3 with Firefox 68.10
Expected Behavior
this spec should either pass or not:
Actual Behavior
the spec mostly passes, but in some rare cases it raises:
Steps to reproduce
this is hard to reproduce reliably, because it seems to be a race condition of miliseconds.
i think this is what happens in the error case:
the DOM element is still there when
#assert_no_selector
happens, but it's gone when#failure_message
tries to get the element text to generate a nice detailed failure message as follows: