I have a quite big rails application whose main view consists of a complex, deeply nested form that is edited by different users along a predefined process flow (user1 inputs some info, user2 some more etc.).
I wrote a very long test using Rspec + Capybara in order to test the whole process, which worked fine until I switched to using a remote form (by setting remote: true).
At this point, I would need to switch between using a js driver and a regular one in order to test different things within the same view (js when submitting, regular driver for everything else), but I cannot seem to find any example of how to do this.
The main issue is all the testing documentation I found assumes you can run separate tests, each with its own driver, just by setting js: true and doing some other changes, but my issue is I need everything to happen within the same test as the sequence of events is key.
Any suggestion would be highly appreciated.
I dont believe you can nest a test using a different capybara driver while keeping changes of the above nested tests; the changes don't stick when changing from say rack_test to webkit or selenium. I had a similar problem of just getting capybara to detect changes with :remote => true set, ended up getting it to work with webkit driver. I posted what worked for me here: Capybara, Javascript and RSpec Integration Tests with :remote => true
You may just want to refactor out the steps needed to be done before the test with a remote form into a method that you can just call in a before block to keep your code clean.
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.