I am using Capybara for acceptance testing and I have several scenarios, where I need to test if a page has reloaded or not:
1) If I leave a search input field empty and click on the search icon I want to verify that nothing happens and in particular that the page does not reload.
2) On the results page I have three sorting options for results. When I click on a sorting button the page reloads with the chosen sorting criterion applied. I have some trouble with clicking an element using Capybara or even pure JavaScript, so a means for me to check if the element is clicked at all is to check if the page has been reloaded. So how do I do that?
一种方法是根据排序标准将一个类添加到表(或其他元素)中,并测试其存在:
page.find_by_css('table.sort_by_foo').should be
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.