In Rails testing with RSpec and Capybara, is it possible to test the position of a certain content on a page?
I have a page that lists orders in different sections ‘Pending’ and ‘Received’, and I would like to test that a particular order can move from the ‘Pending’ to the ‘Received’ section on the page.
It would help if I could test that the content is inside a particular div.
I’d say the easiest way is to build this right into your selectors, and assert the presence of the element in the correct section, and the absence of it in the old section. The following example assumes you’re keeping the order ID in a data attribute: