0

Using: Rails 3.2.13, cucumber (1.2.3), selenium-webdriver (2.31.0), capybara (2.0.3)

I am working on a mobile site and need to use selenium to test the javascript features. However, when I try to run the cucumber tests together, the test immediately following the @javascript tagged tests are failing with this:

      The action 'assets' could not be found for SiteController (AbstractController::ActionNotFound)
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:116:in `process'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/warden-1.2.1/lib/warden/manager.rb:35:in `block in call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/warden-1.2.1/lib/warden/manager.rb:34:in `catch'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/warden-1.2.1/lib/warden/manager.rb:34:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/etag.rb:23:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:in `context'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__1123647381172448721__call__979271738568178806__callbacks'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/cucumber-rails-1.3.1/lib/cucumber/rails/action_controller.rb:10:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/builder.rb:134:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/urlmap.rb:64:in `block in call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `each'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/urlmap.rb:49:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/capybara-2.0.3/lib/capybara/server.rb:19:in `call'
      /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
      /Users/emai/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
      /Users/emai/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
      /Users/emai/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

I'm guessing something is triggering assets in my wildcard route match ':action(/:id)' => "site". However, when I do a command + shift + F in textmate (to look for keywords within the whole project) I can only find one reference to assets in the view and commenting it out doesn't do anything.

I also tried changing cucumber to use truncation instead of transaction in my env file:

From: Cucumber::Rails::Database.javascript_strategy = :transaction to: Cucumber::Rails::Database.javascript_strategy = :truncation

but nothing has worked. Is this a bug? Or is there something wrong with my test/views? Is there another alternative to selenium that I could try to test with javascript?

UPDATE: trying to install capybara-webkit, but running into error.

    Nets-Mac-Pro:sl-mobile emai$ bundle install
    ...
    ...

    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

            /Users/emai/.rvm/rubies/ruby-1.9.3-p362/bin/ruby extconf.rb 
    Command 'qmake -spec macx-g++' not available


    Gem files will remain installed in /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/capybara-webkit-0.14.2 for inspection.
    Results logged to /Users/emai/.rvm/gems/ruby-1.9.3-p362@sherry3/gems/capybara-webkit-0.14.2/./gem_make.out
bigpotato
  • 26,262
  • 56
  • 178
  • 334
  • I use [capybara-webkit](https://github.com/thoughtbot/capybara-webkit) – cortex May 09 '13 at 14:08
  • I tried installing it but it gave me an error. I'll paste it – bigpotato May 09 '13 at 14:12
  • Try [this](http://stackoverflow.com/questions/8365764/error-installing-gem-capybara-webkit/11570002#11570002) or [this](http://stackoverflow.com/questions/11354656/error-error-error-installing-capybara-webkit/11622193#11622193). – cortex May 09 '13 at 14:27
  • What sucks is that I'm using macports... not homebrew! – bigpotato May 09 '13 at 14:32

1 Answers1

0

So I eventually figured it out. Cucumber was failing because there were missing images that I haven't migrated over yet from my old project (I'm upgrading this project from Rails 2 to Rails 3, so a lot of the files have not been moved over yet). I had constants pointing to these images, and it was causing Cucumber to fail when these assets weren't found. So be warned!

bigpotato
  • 26,262
  • 56
  • 178
  • 334