Session 测试两项功能时未清除浏览器会话

Session 测试两项功能时未清除浏览器会话,session,ruby-on-rails-3,selenium,cucumber,capybara,Session,Ruby On Rails 3,Selenium,Cucumber,Capybara,我的应用程序上有两个黄瓜功能,类似于: Feature: Number 1 Background: User logs in on twitter Steps @log-out-remote-too Scenario: User logs out from local-app Steps Feature: Number 2 Scenario: User is logged in and is welcomed Sees "wel

我的应用程序上有两个黄瓜功能,类似于:

Feature: Number 1  
  Background: User logs in on twitter  
    Steps  
  @log-out-remote-too
  Scenario: User logs out from local-app
    Steps  

Feature: Number 2  
  Scenario: User is logged in and is welcomed  
     Sees "welcome" inside "something"  
     Sees more stuff  
我正在为firefox和css选择器使用webdriver/selenium。第二个特点总是!不管怎样,都会失败。 我已经试着移除这个钩子,这样它就不会进入twitter.com并注销。 我还尝试了hook@re登录我的本地应用程序。 我也尝试过通过水豚来清理饼干

如果有人能在这方面帮助我,我将非常感谢。我拒绝在不遵循内外循环的情况下开发我的应用程序,但我没有那么多时间


PD我注意到第二个特性的存在(即使它没有任何场景)会导致第一个特性失败。这对我来说很奇怪

我终于找到了解决办法

我写了下面的钩子:

Before('@with_remote_login') do
  Capybara.current_driver = :selenium
end
我将其添加到需要“干净”运行的场景中

Feature: Number 1  
  Background: User logs in on twitter  
    Steps  

  Scenario: User logs out from local-app
    Steps  

Feature: Number 2 
  @with_remote_login
  Scenario: User is logged in and is welcomed  
     Sees "welcome" inside "something"  
     Sees more stuff