开发者

Browser sessions not cleared-up when testing two cucumber features

I have two cucumber features on my app that resembles something like:

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  

I am using webdriver/selenium for firefox and the css selector. The second feature always! fails, no matter what. I have tried removing the hook so it does not go to twitter.com and logs out. I have tried also a hook @re-login for logging in on my local app. I have also tried clearing the cookies through Capybara.

I would really thank if someone could help me on this. I am resisting the idea to develop my app without following the outside-in cycle but have not so much time.

PD I have noticed that the presence of the second feature (even if it has no scenarios on it) 开发者_开发知识库makes the first feature fail. This is weird to me


I finally found a workaround for this.

I wrote the following hook:

Before('@with_remote_login') do
  Capybara.current_driver = :selenium
end

which I added to the scenarios which needed to run "cleanly"

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜