The stale element error from Selenium tells me motion re-renders between selenium finding an element and filling it in. The failure of the 'Taken' test with a 'Name cannot be blank' error shows that a motion is getting triggered too soon or is not registering the fill_in of Taken. When I added some logging to that test, I could see below that motion was getting triggered on the 'T' of 'Taken', but the formdata showed a dog_name of empty and T, such that it re-rendered for the first time as nil.
I tried a few solutions, including changing the input to map a motion on blur, instead of the form on change, but I decided we wanted to be able to write a system test like this, on change.
In the end the solution for these errors seems to be:
This capybara issue suggested adding a click before finding if there was a timing issue.
Making waiting_for_render a method that accepted a block, so we could be sure we were waiting for the right rendering to happen
I tested this fix four times, and it appears to be working.
Description
Attempts to fix intermittent system test failure: https://travis-ci.com/github/unabridged/motion/jobs/490209306 https://travis-ci.com/github/unabridged/motion/jobs/490205207
The stale element error from Selenium tells me motion re-renders between selenium finding an element and filling it in. The failure of the 'Taken' test with a 'Name cannot be blank' error shows that a motion is getting triggered too soon or is not registering the
fill_in
of Taken. When I added some logging to that test, I could see below that motion was getting triggered on the 'T' of 'Taken', but the formdata showed a dog_name of empty and T, such that it re-rendered for the first time as nil.I tried a few solutions, including changing the input to map a motion on blur, instead of the form on change, but I decided we wanted to be able to write a system test like this, on change.
In the end the solution for these errors seems to be:
waiting_for_render
a method that accepted a block, so we could be sure we were waiting for the right rendering to happenI tested this fix four times, and it appears to be working.