Cucumber - Server Errors Raised After The End Of Steps
I have non-deterministic failures on my Cucumber tests that occur after the end of some tests. It would seem that when the browser/cucumber steps finish, there are still undergoing requests being processed on the server , and they seem to keep running even while DatabaseCleaner runs and drops documents, which results in failures when trying to access the model in the server.
When my app creates users, they are stored in an instance variable
@users =  for easy access. When I catch those exceptions, I realize the variable is still there
@users.first.present? # => true but its document had already been removed
@users.first.reload # => nil.
I do not really understand where the problem comes from, since there shouldn't be extra page loads (maybe Turbolinks/caching playing tricks on me), and the failure seems really nondeterministic (fails 1/3 times, even at different places in the code)
I'd rather avoid to set
Capybara.raise_server_errors == false although it would most likely fix things for those tests
I was wondering if you had similar problems and how you coped with that...
I feel sooo stupid. I had an "image zoom modal" which was used to display bigger version of images when clicked on. This modal was initialized with an
img attribute, and since the src was supposed to be updated through a click() event, with my poor knowledge I had initialized it with
This was causing the browser to request the image at the same path of the current request (and I didn't notice but the hint was that the second request was of type
*/* instead of HTML/JS, etc.). In that case, Capybara would often finish the test after receiving the updated DOM after the "original request", while the "image request" was still undergoing.
Just changed it to
src="file://null" following some other questions advice.
- → Trigger a click with jQuery using link_to of rails 4
- → Adding html data attribute to simple_forms input
- → How to remove parameters from the root URL if it does I18n
- → passing parameters to rails back end from an ajax call
- → Blocking ?page= in robots.txt
- → react js and rails Updating state on a component with active record relationship
- → State not passed into prop
- → Cannot read property 'modalIsOpen' of undefined
- → Objects not valid issue
- → How to map API params to model
- → Consuming webhooks shopify-api
- → How to add ScriptTag on shopify_api gem?