Selenium doesn't work with Cucumber/Capybara (out of the box) - MacOSX

后端 未结 2 1709
我寻月下人不归
我寻月下人不归 2021-01-06 01:51

I\'m having trouble trying to get a cucumber example to run under selenium. I\'m running

  • Rails3
  • Cucumber 0.10.0
  • Capybara 0.4.1.2
相关标签:
2条回答
  • 2021-01-06 02:39

    Did you try

    bundle exec cucumber feature/myfeature.feature
    

    !!

    0 讨论(0)
  • 2021-01-06 02:51

    Ok... I found out my problem. Somewhere in the bowls of cucumber is a dependency on DatabaseCleaner which is being triggered once when you use the selenium driver. The failure statement:

    F______________F
    

    Told me that the failure was occurring in the setup and teardown. Cucumber wasn't reporting the exception and even with the -b it didn't do anything.

    How I found the problem:

    1. Add ruby-debug as a gem dependency

    2. Add require "ruby-debug" to env.rb

    3. I added the following statement to env.rb:

    Before do
        breakpoint; 0
    end
    
    1. Ran the feature using bundle exec. The debugger kicked in.

    2. Type in cat StandardError which will tell the debugger to breakpoint when "StandardError" is thrown. StandardError is the base class for all errors in Cucumber. What we want to do is find out where the error is being thrown and why.

    3. Type in cont to tell the debugger to resume

    After adding database-cleaner as a gem dependency, everything went away. Firefox started firing up and things start to work as advertised.

    0 讨论(0)
提交回复
热议问题