2013-05-09 90 views
0

使用:导轨3.2.13,黄瓜(1.2.3),硒 - 的webdriver(2.31.0),水豚(2.0.3)滑轨+黄瓜+硒:测试失败一起,分别传递

我在移动网站上工作,需要使用硒来测试JavaScript功能。然而,当我尝试运行黄瓜测试一起,紧随@javascript标记测试的测试与此失败:

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

我猜东西在我的通配符路线match ':action(/:id)' => "site"被触发assets。但是,当我在textmate中执行command + shift + F(在整个项目中查找关键字)时,我只能在视图中找到对资产的一个引用,并且对它进行注释并不会执行任何操作。

我也尝试过改变黄瓜在我的ENV文件中使用截断,而不是交易:

来源: Cucumber::Rails::Database.javascript_strategy = :transaction 到: Cucumber::Rails::Database.javascript_strategy = :truncation

,但没有奏效。这是一个错误?或者我的测试/视图有问题吗?硒还有另一种选择,我可以尝试使用JavaScript进行测试吗?

更新:试图安装capybara-webkit,但遇到错误。

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/[email protected]/gems/capybara-webkit-0.14.2 for inspection. 
    Results logged to /Users/emai/.rvm/gems/[email protected]/gems/capybara-webkit-0.14.2/./gem_make.out 
+0

我使用[capybara-webkit](https://github.com/thoughtbot/capybara-webkit) – cortex 2013-05-09 14:08:29

+0

我试过安装它,但它给了我一个错误。我会粘贴它 – Edmund 2013-05-09 14:12:35

+0

尝试[this](http://stackoverflow.com/questions/8365764/error-installing-gem-capybara-webkit/11570002#11570002)或[this](http://stackoverflow.com/问题/ 11354656 /错误错误错误安装,水豚,WebKit的/ 11622193#11622193)。 – cortex 2013-05-09 14:27:20

回答

0

所以我最终搞明白了。黄瓜失败了,因为还没有从我的旧项目中迁移过来的图像(我将这个项目从Rails 2升级到Rails 3,所以很多文件还没有移动过)。我有指向这些图像的常量,当这些资产没有找到时,它导致Cucumber失败。所以要警告!