I am trying to write an integration test in which I must check the visibility of an element on button click. The code works perfectly in one machine and failing in the other. The element is displayed until the data comes from the backend. So its visibility depends on the speed of the machine also. Is that the problem? This is the code:
assert page.has_css?('#my_element_id')
assert find('#my_element_id', visible: true)
But I am getting an error: expected false to be truthy
.
Is there any other way to assert the visibility of the element?