使用: Rails 3.2.13、cucumber (1.2.3)、selenium-webdriver (2.31.0)、capybara (2.0.3)
私はモバイル サイトで作業しており、セレンを使用して JavaScript 機能をテストする必要があります。ただし、きゅうりのテストを一緒に実行しようとすると、@javascript
タグ付けされたテストの直後のテストが次のように失敗します。
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'
assets
ワイルドカード route で何かがトリガーされていると思いmatch ':action(/:id)' => "site"
ます。ただし、textmate で command + shift + F を実行すると (プロジェクト全体でキーワードを検索するため)、ビュー内のアセットへの参照が 1 つしか見つからず、コメントアウトしても何も起こりません。
また、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/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