How do I re-use Capybara sessions between tests?

后端 未结 4 1123
别那么骄傲
别那么骄傲 2021-02-05 09:27

I want to keep on using the same session and by that I mean Rails\' session between various Test::Unit integration tests that use Capybara. The Capybara::Sess

4条回答
  •  忘了有多久
    2021-02-05 09:47

    Add the following after your capybara code that interacts with the page:

    Capybara.current_session.instance_variable_set(:@touched, false)
    
    or
    
    page.instance_variable_set(:@touched, false)
    

    If that doesn't work, these might help:

    https://github.com/railsware/rack_session_access

    http://collectiveidea.com/blog/archives/2012/01/05/capybara-cucumber-and-how-the-cookie-crumbles/

提交回复
热议问题