#214 ✓resolved
kfitzpatrick

Cucumber selenium_webrat example completely failing

Reported by kfitzpatrick | April 8th, 2009 @ 02:20 PM

I recently checked out the latest cucumber webrat_selenium example from http://github.com/aslakhellesoy/...>

When I run 'rake features' from the CLI I get the following error message:


    Given I am on the Google search page           # features/step_definitons/search_steps.rb:1
      uninitialized constant Webrat::Selenium::RailsApplicationServer::RAILS_ROOT (NameError)
      (eval):2:in `visit'
      ./features/step_definitons/search_steps.rb:2:in `/^I am on the Google search page$/'
      features/search.feature:7:in `Given I am on the Google search page'

My related installed gems are: cucumber (0.2.3, 0.1.16) nokogiri (1.2.3, 1.2.2) rspec (1.2.2, 1.1.12, 1.1.8) Selenium (1.1.14) selenium-client (1.2.14, 1.2.7) webrat (0.4.4, 0.4.3)

Comments and changes to this ticket

  • mike (at grassotti)

    mike (at grassotti) April 14th, 2009 @ 10:42 AM

    I am having the same problem. All of the other cucumber examples (including selenium without webrat) are working as expected.

    Looks like webrat's rails_application_server.rb is checking the RAILS_ROOT constant in order to set path for log and tmp files before starting mongrel.

    My installed gems are: aslakhellesoy-cucumber (0.2.3.4) webrat (0.4.4) rspec (1.2.4) rspec-rails (1.2.4) Selenium (1.1.14) selenium-client (1.2.14)

  • kfitzpatrick

    kfitzpatrick April 14th, 2009 @ 04:18 PM

    So it's borking because it's trying to run outside of the context of a Rails project?

  • kfitzpatrick

    kfitzpatrick April 14th, 2009 @ 04:30 PM

    Do you think it's possible to edit the env.rb file to fool it into thinking there's a RAILS_ROOT?

    I see a bit of code in there that's attempting to hack webrat into ignoring Rails. Perhaps we just need something else.

    Unfortunately I'm still a bit of a Ruby n00b and I'm not sure where to go with it.

  • kfitzpatrick

    kfitzpatrick April 29th, 2009 @ 01:42 PM

    I have a solution for this one and I'll be uploading a patch soon.

    I'll also have a patch for webrat soon that will include a config.application_server = :noserver option.

  • gaffo

    gaffo May 10th, 2009 @ 10:22 PM

    • State changed from “new” to “open”

    Just wondering if you guys did your:

    Webrat.configure do |config| config.mode = :rails end

    ?

    Thanks for the report!

  • kfitzpatrick

    kfitzpatrick May 11th, 2009 @ 09:57 AM

    @gaffo,

    The original example did have :rails as the mode. However, as the example was running against Google and not a local rails application it was erroring out, unable to find RAILS_ROOT.

    The following patches fixed the problem for me.

    First:

    http://github.com/kfitzpatrick/c...

    This fixes the hack that make Webrat think that Rails is available and includes the .ru file. This is necessary because we still don't have a mode in Webrat to handle non-Ruby-framework apps. We talked about this in our other conversation about webrat's potential :noserver mode.

    Second:

    http://github.com/kfitzpatrick/c...

    This one just fixes some of the calls to Selenium which weren't working. For some reason, the Selenium implementation of click_button only works when passed the button label and not with the ID as the example is currently written.

    Hope this helps!

    • Kevin
  • gaffo

    gaffo June 15th, 2009 @ 12:42 AM

    • State changed from “open” to “resolved”
    • Tag changed from bug, cucumber, errors, selenium to bug, cucumber, errors, selenium, stale

    Kevin,
    Can you check this out with the :external mode and current master to see if it is working. I dind't pull in your .ru fix but we did add the no-appserver mode. I'm going to mark this as resolved for the moment but will gladly open it back up if it's not entirely resolved.

    Thanks,
    Mike

  • gaffo

    gaffo September 16th, 2009 @ 11:42 AM

    Andy, thanks for the input. Could you please provide a separate ticket for this? A patch would also be nice.

  • kfitzpatrick

    kfitzpatrick September 16th, 2009 @ 04:22 PM

    Andy,

    Do you have the following in your env.rb file?

    
    Webrat.configure do |config|
      config.mode = :selenium
      config.application_framework = :external
    end
    
    World do
      session = Webrat::SeleniumSession.new
      session.extend(Webrat::Methods)
      session.extend(Webrat::Selenium::Methods)
      session.extend(Webrat::Selenium::Matchers)
      session
    end
    

    I'm using this right now on my project and it works great.

    BTW, Mike, sorry I never got back to you but the new format works exactly as I imagined it would :)

    • Kevin

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

Pages