If it were me, I'd drop this line inside env.rb:
require 'ruby-debug'; debugger
or in a Before hook, use n and s to get a feel for what it's doing,
set break breakpoints in cuke files at places I think it's going to
start failing and hit c, etc.
I use Before and After hooks to add more logging but that probably
won't help if you're having some weird boostrapping problem. I do find
it extremely helpful to tell what scenario all those database queries
belong to though and since you mentioned it, I'll throw that in the
end here:
Before do |scenario|
Rails.logger.debug { "\n#{'-'*50}\nSCENARIO
#{scenario.file_colon_line if
scenario.respond_to?(:file_colon_line)}\n\n" }
end
After do |scenario|
Rails.logger.debug { "\n\nEND SCENARIO #{scenario.file_colon_line if
scenario.respond_to?(:file_colon_line)}\n#{'-'*50}" }
end
On 15 February 2011 21:01, Jason Nah <[email protected]> wrote:
> Howdy Guys,
>
> I'm in the midst of trying to find out why the selenium driver doesn't seem
> to work with my setup. That being:
>
> Rails3
> Cucumber 0.10.0
> Capybara 0.4.1.2
> Selenium WebDriver 0.1.2
> Launchy 0.3.7
> And I have libffi installed
> MacOSX 10.6.6
> Ruby 1.8.7 p302 (using rvm)
> Spork 0.8.4
> Guard 0.2.2
>
> My feature contains the following:
>
> Feature: My feature
>
> @javascript
> Scenario: User does x
> Given ...
> When ...
> Then ...
>
>
> Right now, when I run the feature using
>
> bundle exec cucumber feature/myfeature.feature
>
> I get the following:
>
> F-----------------F
>
> Failing Scenarios:
> cucumber features/myfeature.feature:7 # Scenario: User does x
>
> 1 scenario (1 failed)
> 17 steps (17 skipped)
>
> My env.rb file contains the following:
>
> Capybara.default_driver = :selenium
>
>
> I've tried the following:
>
> 1. Created a separate test.rb file to load capybara separately.
>
> It contained the following:
>
> require 'capybara'
> require 'capybara/dsl'
>
> Capybara.default_driver = :selenium
>
> class Test
> include Capybara
> def dotest
> visit('http://www.stackoverflow.com')
> end
> end
>
> Test.new.dotest
>
> Ran it with
>
> bundle exec ruby tmp/test.rb
>
> Firefox opened, navigated and worked. This shows that capybara, and the
> selenium webdriver works as per the Gemfile (ie versions are compatible)
>
>
> 2. Injected the following code in env.rb
>
> driver = Capybara.drivers[:selenium].call
> driver.browser
>
> Again, firefox opened and closed after running
>
> bundle exec cucumber feature/myfeature.feature
>
> But again, nothing in the feature is actually executed. Same result
> (F-----------------F).... making me think there's something funny going on
> between cucumber and capybara.
>
> So... my questions are:
>
> Is there a way to get cucumber to log more information out?
> Is there a way to get capybara to log more information out?
> What would be the best approach to figure out what the issue is...
>
> Cheers,
> Jason
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby or Rails Oceania" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rails-oceania?hl=en.
>
--
Gregory McIntyre
--
You received this message because you are subscribed to the Google Groups "Ruby
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rails-oceania?hl=en.