Closed Florent2 closed 14 years ago
I've been bitten by this and it's an issue in envjs. I wrote it up here: smparkes/env-js#16
smparkes/env-js#16 committed. Thanks!
Thanks both of you!
Steven, I've tried to use the master version of capybara-envjs but without success. When I use in my Gemfile
gem "capybara-envjs", :require => "capybara/envjs", :git => "git://github.com/smparkes/capybara-envjs.git"
I get from bundle install the error: Could not find gem 'capybara-envjs (>= 0, runtime)' in git://github.com/smparkes/capybara-envjs.git (at master). Source does not contain any versions of 'capybara-envjs (>= 0, runtime)'
Do you know if I can use the latest master version of capybara-envjs in my application?
I don't currently provide the gemspec at the root of the repo that bundler wants. (I don't have any firm opinion on this; I respect people that are both for and against).
Thanks Steven for your answer, I understand your choice. I got the same error when trying to vendor the gem, but as there is no urgency, I'll rather wait for the next gem release. Thanks again.
Sorry about that. I haven't tried it, so I don't have much experience with it. You can always download the repo, build them gem, and install it (though that might not work for your deployment needs).
More to the point, the repo tracks the capy repo which has unreleased changes so I'd have to backport this to pre-capy 3.9.
But I'm not sure when Jonas is going to do another release ...
I have the following scenario for my Rails 3 beta 4 application:
@javascript Scenario: successful event posting Given I follow "Event" # this click just call some jQuery to show an additional part in the form, this is why I need @javascript for this scenario And I fill in "announcement_message" with "Yogurt party tonight!" And I select "20" from "announcement_start_datetime_4i" And I select "23" from "announcement_end_datetime_4i" When I press "Post it" # this is a normal form submit button Then I should see "Announcement was successfully created." And an announcement should exist with message: "Yogurt party tonight!", category: "Event"
It works correctly in the browser, but when I run it with Cucumber and capybara-envjs I got the following error.
Another similar scenario for the same form but without the need of the @javascript tag works without problem.
The problem is due to the ":multipart => true" option of the form_for. If I remove this option from my view, the scenario runs without problem.
So it looks like both the presence of both @javascript tag in the Cucumber scenario and the form_for ":multipart => true" option in the view provokes this bug.
.................... WARNIING: [Sat Jul 10 2010 11:30:05 GMT-0500 (PET)] {ENVJS} Exception while processing XHR: bad content body WARNIING: [Sat Jul 10 2010 11:30:05 GMT-0500 (PET)] {ENVJS} Exception while loading window: bad content body WARNIING: [Sat Jul 10 2010 11:30:05 GMT-0500 (PET)] {ENVJS} Exception while dispatching events: bad content body oopse bad content body undefined /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/utils.rb:499:in
parse_multipart' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/utils.rb:471:in
loop' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/utils.rb:471:inparse_multipart' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/request.rb:268:in
parse_multipart' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/request.rb:146:inPOST' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/methodoverride.rb:15:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/actionpack-3.0.0.beta4/lib/action_dispatch/middleware/params_parser.rb:21:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/actionpack-3.0.0.beta4/lib/action_dispatch/middleware/flash.rb:182:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/actionpack-3.0.0.beta4/lib/action_dispatch/middleware/session/abstract_store.rb:106:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/actionpack-3.0.0.beta4/lib/action_dispatch/middleware/cookies.rb:235:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/activerecord-3.0.0.beta4/lib/active_record/query_cache.rb:31:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/query_cache.rb:28:in
cache' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/activerecord-3.0.0.beta4/lib/active_record/query_cache.rb:11:incache' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/activerecord-3.0.0.beta4/lib/active_record/query_cache.rb:30:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:365:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/actionpack-3.0.0.beta4/lib/action_dispatch/middleware/callbacks.rb:46:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/activesupport-3.0.0.beta4/lib/active_support/callbacks.rb:414:in_run_call_callbacks' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/activesupport-3.0.0.beta4/lib/active_support/callbacks.rb:88:in
send' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/activesupport-3.0.0.beta4/lib/active_support/callbacks.rb:88:inrun_callbacks' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/actionpack-3.0.0.beta4/lib/action_dispatch/middleware/callbacks.rb:44:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/sendfile.rb:105:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/actionpack-3.0.0.beta4/lib/action_dispatch/middleware/remote_ip.rb:48:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/railties-3.0.0.beta4/lib/rails/rack/logger.rb:14:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/runtime.rb:17:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/activesupport-3.0.0.beta4/lib/active_support/cache/strategy/local_cache.rb:72:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/lock.rb:11:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/lock.rb:11:insynchronize' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/lock.rb:11:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/actionpack-3.0.0.beta4/lib/action_dispatch/middleware/static.rb:30:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/railties-3.0.0.beta4/lib/rails/application.rb:145:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/urlmap.rb:47:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in
each' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-1.1.0/lib/rack/urlmap.rb:41:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-test-0.5.4/lib/rack/mock_session.rb:30:in
request' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-test-0.5.4/lib/rack/test.rb:207:inprocess_request' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/rack-test-0.5.4/lib/rack/test.rb:66:in
post' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/capybara-envjs-0.1.6/lib/capybara/driver/envjs_driver.rb:213:insend' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/capybara-envjs-0.1.6/lib/capybara/driver/envjs_driver.rb:213 /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/johnson-2.0.0.pre3/lib/johnson/tracemonkey/js_land_proxy.rb:16:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/johnson-2.0.0.pre3/lib/johnson/tracemonkey/js_land_proxy.rb:16:in__send__' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/johnson-2.0.0.pre3/lib/johnson/tracemonkey/js_land_proxy.rb:16:in
send_with_possible_block' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/johnson-2.0.0.pre3/lib/johnson/tracemonkey/runtime.rb:49:inevaluate_compiled_script_without_clearing_traps' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/envjs-0.3.7/lib/envjs/env.js:2444:in
makeRequest' [JavaScript] /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/envjs-0.3.7/lib/envjs/env.js:2456 [JavaScript] /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/envjs-0.3.7/lib/envjs/static.js:3729 [JavaScript] /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/envjs-0.3.7/lib/envjs/env.js:1145 [JavaScript] /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/envjs-0.3.7/lib/envjs/env.js:2665 [JavaScript] /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/envjs-0.3.7/lib/envjs/env.js:95 [JavaScript] /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/envjs-0.3.7/lib/envjs/env.js:2674 [JavaScript] /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/envjs-0.3.7/lib/envjs/env.js:6 [JavaScript] /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/johnson-2.0.0.pre3/lib/johnson/tracemonkey/runtime.rb:49:inevaluate_compiled_script' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/envjs-0.3.7/lib/envjs/runtime.rb:53:in
evaluate' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/envjs-0.3.7/lib/envjs/runtime.rb:189 /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/capybara-envjs-0.1.6/lib/capybara/driver/envjs_driver.rb:190:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/capybara-envjs-0.1.6/lib/capybara/driver/envjs_driver.rb:190 /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/johnson-2.0.0.pre3/lib/johnson/tracemonkey/js_land_proxy.rb:16:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/johnson-2.0.0.pre3/lib/johnson/tracemonkey/js_land_proxy.rb:16:in__send__' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/johnson-2.0.0.pre3/lib/johnson/tracemonkey/js_land_proxy.rb:16:in
send_with_possible_block' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/johnson-2.0.0.pre3/lib/johnson/ruby_land_proxy.rb:110:incall_function_property' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/johnson-2.0.0.pre3/lib/johnson/ruby_land_proxy.rb:110:in
method_missing' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/capybara-envjs-0.1.6/lib/capybara/driver/envjs_driver.rb:141:in_event' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/capybara-envjs-0.1.6/lib/capybara/driver/envjs_driver.rb:102:in
click' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/capybara-0.3.9/lib/capybara/session.rb:56:inclick_button' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/capybara-0.3.9/lib/capybara/dsl.rb:55:in
click_button' /Users/Florent/Programmation/Projets/myapp/features/step_definitions/web_steps.rb:29 /Users/Florent/Programmation/Projets/myapp/features/step_definitions/web_steps.rb:14:inwith_scope' /Users/Florent/Programmation/Projets/myapp/features/step_definitions/web_steps.rb:28 /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/core_ext/instance_exec.rb:48:in
instance_exec' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/core_ext/instance_exec.rb:48:incucumber_instance_exec' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/core_ext/instance_exec.rb:69:in
cucumber_run_with_backtrace_filtering' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/core_ext/instance_exec.rb:36:incucumber_instance_exec' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/rb_support/rb_step_definition.rb:54:in
invoke' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/step_match.rb:26:ininvoke' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/step_invocation.rb:62:in
invoke' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/step_invocation.rb:41:inaccept' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:99:in
visit_step' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:164:inbroadcast' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:98:in
visit_step' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/step_collection.rb:15:inaccept' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/step_collection.rb:14:in
each' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/step_collection.rb:14:inaccept' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:93:in
visit_steps' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:164:inbroadcast' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:92:in
visit_steps' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/scenario.rb:53:inaccept' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:321 /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:342:in
before_and_after' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:320 /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:331:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:331 /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/language_support/language_methods.rb:13 /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/language_support/language_methods.rb:95:in
call' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/language_support/language_methods.rb:95:inexecute_around' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/language_support/language_methods.rb:12:in
around' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:330 /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:328:incall' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:328:in
around' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/step_mother.rb:319:inwith_hooks' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/scenario.rb:51:in
accept' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/scenario.rb:106:inwith_visitor' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/scenario.rb:45:in
accept' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:51:invisit_feature_element' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:164:in
broadcast' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:50:invisit_feature_element' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/feature.rb:35:in
accept' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/feature.rb:34:ineach' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/feature.rb:34:in
accept' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:20:invisit_feature' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:164:in
broadcast' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:19:invisit_feature' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/features.rb:29:in
accept' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/features.rb:17:ineach' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/features.rb:17:in
each' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/features.rb:28:inaccept' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:14:in
visit_features' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:164:inbroadcast' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/ast/tree_walker.rb:13:in
visit_features' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/cli/main.rb:64:inexecute!' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/../lib/cucumber/cli/main.rb:25:in
execute' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/cucumber-0.8.3/bin/cucumber:8 /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/bin/cucumber:19:in `load' /Users/Florent/.rvm/gems/ree-1.8.7-2010.01/bin/cucumber:19 WARNIING: [Sat Jul 10 2010 11:30:06 GMT-0500 (PET)] {ENVJS} Exception while dispatching events: bad content body F--............P--------(::) pending steps (::)
features/announcement_creation.feature:37:in `Given pending # bug when running this scenarion, looks like capybara-envjs submit the form with AJAX ?'
(::) failed steps (::)
bad content body (EOFError) ./features/step_definitions/web_steps.rb:29 ./features/step_definitions/web_steps.rb:14:in
with_scope' ./features/step_definitions/web_steps.rb:28:in
/^(?:|I )press "([^"])"(?: within "([^"])")?$/' features/announcement_creation.feature:25:in `When I press "Post it"'Failing Scenarios: cucumber features/announcement_creation.feature:19 # Scenario: successful event posting