smparkes / capybara-envjs Goto Github PK
View Code? Open in Web Editor NEWCapybara driver for envjs gem
Home Page: http://github.com/smparkes/capybara-envjs
Capybara driver for envjs gem
Home Page: http://github.com/smparkes/capybara-envjs
Hi,
As explained here: when a page contains multiple <button>
elements (with the same name but different values), and one of those buttons is clicked, a different button's value shows up in the request params. For me it always seems to be the last button on the page but I haven't tested exhaustively yet. The correct behaviour is exhibited by an actual web browser and by Capybara's Rack::Test driver, and there's no JavaScript involved on this particular page, so my current workaround is to switch driver mid-scenario so that Rack::Test can submit the form.
Is this a capybara-envjs bug?
Cheers,
-Tom
There is an issue with file upload testing.
I have few fields loaded via ajax. When I use browser - everything works just fine.
Using envjs there is a strange bug with upload happens.
When I upload plaintext file HTTP-headers are added to it (view uploaded file in tmp/upload.csv).
When I upload image - exception raises:
.. WARNIING: [Wed Feb 02 2011 19:32:20 GMT+0200 (MSK)] {ENVJS} Exception while dispatching events: TypeError: malformed UTF-8 character sequence at offset 0
oopse TypeError: malformed UTF-8 character sequence at offset 0
@:0
([object Array],1296667940527)@/Users/dm/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/envjs-0.3.8/lib/envjs/static.js:6582
([object Object],(void 0),1296667940527)@/Users/dm/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/envjs-0.3.8/lib/envjs/static.js:6341
__dispatchEvent__([object Object],[object Object],true)@/Users/dm/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/envjs-0.3.8/lib/envjs/env.js:1836
([object Object])@/Users/dm/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/envjs-0.3.8/lib/envjs/static.js:1718
([object Object])@/Users/dm/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/envjs-0.3.8/lib/envjs/static.js:5250
()@/Users/dm/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/envjs-0.3.8/lib/envjs/static.js:6203
__dispatchEvent__([object Object],[object Object],true)@/Users/dm/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/envjs-0.3.8/lib/envjs/env.js:1811
([object Object])@/Users/dm/.rvm/gems/ree-1.8.7-2010.02@rails3/gems/envjs-0.3.8/lib/envjs/static.js:1718
WARNIING: [Wed Feb 02 2011 19:32:20 GMT+0200 (MSK)] {ENVJS} Exception while dispatching events: TypeError: malformed UTF-8 character sequence at offset 0
F-....
(::) failed steps (::)
malformed UTF-8 character sequence at offset 0 (Johnson::Error)
./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/import.feature:8:in `And I press "Submit"'
Failing Scenarios:
cucumber features/import.feature:5 # Scenario: Upload image file
To reproduce it I've create simple rails app with those issues:
https://github.com/daemon/envjs-bug
Any thoughts?
Hola,
We tried using envjs on a mootools project and it failed to load mootools core 1.2.4.
--- mootools-1.2.4-core-nc.js 2010-06-17 13:44:30.000000000 +0100
+++ mootools-1.2.4-core-nc.js.new 2010-06-17 13:44:56.000000000 +0100
@@ -40,6 +40,7 @@
object.constructor = Native;
object.$family = {name: 'native'};
if (legacy && initialize) object.prototype = legacy.prototype;
- if (object.prototype == undefined) { object.prototype = {}; }
object.prototype.constructor = object;
if (name){
Mootools was then able to load. I'm not sure if this is a sane fix however... Is this something that can be fixed in env.js and/or envjs and/or capybara-envjs?
I am trying to use the driver under Rails and Cucumber. Everything works fine, apart from the external javascripts. I am getting a WARNING:
WARNIING: [Wed May 19 2010 14:11:41 GMT+0100 (BST)] {ENVJS} could not load script http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js: No route matches "/ajax/libs/jquery/1.4.2/jquery.min.js" with {:method=>:get}
My javascript sits in a static javascript include tag in the head of the html markup. (Same happens to document/write blocks too by the way.)
I am running on Rails 2.3.5 with the following gem versions:
http://gist.github.com/406343 (output from rake gems, relevant to capybara-envjs)
I've set Capybara to use envjs as the javascript driver:
Capybara.javascript_driver = :envjs
When I run my cucumber features with spork, it throws an error:
undefined method `flush' for class `DRb::DRbObject' (NameError)
It runs fine standalone without spork. It also runs fine with selenium and rack_test.
I don't really know where to file this; it's an interaction between env.js and Rails, basically, but it bit me in a Capybara context.
I have a Cucumber scenario that fills out a simple form, attaches a JPEG file to the form input, and submits it. It passes in Rack::Test, but when I submit the form using env.js, I get a lot of "Exception while dispatching events: super: no superclass method `require' for Object:Class" (stack trace below).
The offending line is in form.js:
if (transfer_encoding === "base64") {
Ruby.require("base64");
content = Ruby.eval("lambda { |fn| Base64.encode64(File.read(fn)) }").call(array[i].filename);
}
The 'require' is handled (intercepted?) by ActiveSupport::Dependencies::Loadable:
def require(file, *)
load_dependency(file) { super }
end
... which fails because Object has no superclass, I guess.
I can imagine considering this a bug in Rails, but I'm not sure. It looks like I can work around it by uploading PNGs (this theory is untested), or at a mild performance cost, capybara-envjs could require base64 preemptively instead of waiting for form.js to do it. But maybe there's a better way?
I'm using, among other things, ruby 1.8.7-p299, rails 3.0.3, capybara 0.4.0, capybara-envjs 0.4.0, johnson 2.0.0pre3, envjs 0.3.8, and cucumber 0.10.0.
$ cucumber features/editing.feature:22 cucumber features/editing.feature:22 Using the default profile... ....... WARNING: [Sun Dec 26 2010 14:29:20 GMT-0600 (CST)] {ENVJS} Exception while dispatching events: super: no superclass method `require' for Object:Class oopse super: no superclass method `require' for Object:Class undefined /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:227:in `load_dependency' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/johnson-2.0.0.pre3/lib/johnson/tracemonkey/js_land_proxy.rb:16:in `call' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/johnson-2.0.0.pre3/lib/johnson/tracemonkey/js_land_proxy.rb:16:in `__send__' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/johnson-2.0.0.pre3/lib/johnson/tracemonkey/js_land_proxy.rb:16:in `send_with_possible_block' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/johnson-2.0.0.pre3/lib/johnson/ruby_land_proxy.rb:110:in `call_function_property' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/johnson-2.0.0.pre3/lib/johnson/ruby_land_proxy.rb:110:in `method_missing' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/capybara-envjs-0.4.0/lib/capybara/driver/envjs_driver.rb:127:in `_event' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/capybara-envjs-0.4.0/lib/capybara/driver/envjs_driver.rb:78:in `click' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/capybara-0.4.0/lib/capybara/node.rb:144:in `click' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/capybara-0.4.0/lib/capybara/node/actions.rb:37:in `click_button' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/capybara-0.4.0/lib/capybara/session.rb:273:in `send' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/capybara-0.4.0/lib/capybara/session.rb:273:in `method_missing' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/capybara-0.4.0/lib/capybara/dsl.rb:93:in `click_button' /Users/eostrom/workspace/confoundedcontraption/comics/features/step_definitions/web_steps.rb:29 /Users/eostrom/workspace/confoundedcontraption/comics/features/step_definitions/web_steps.rb:14:in `with_scope' /Users/eostrom/workspace/confoundedcontraption/comics/features/step_definitions/web_steps.rb:28 /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/core_ext/instance_exec.rb:48:in `instance_exec' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/core_ext/instance_exec.rb:48:in `cucumber_instance_exec' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/core_ext/instance_exec.rb:69:in `cucumber_run_with_backtrace_filtering' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/core_ext/instance_exec.rb:36:in `cucumber_instance_exec' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/rb_support/rb_step_definition.rb:62:in `invoke' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/step_match.rb:26:in `invoke' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/step_invocation.rb:63:in `invoke' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/step_invocation.rb:42:in `accept' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:99:in `visit_step' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:98:in `visit_step' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/step_collection.rb:15:in `accept' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/step_collection.rb:14:in `each' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/step_collection.rb:14:in `accept' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:93:in `visit_steps' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:92:in `visit_steps' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/scenario.rb:53:in `accept' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime.rb:79:in `with_hooks' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime.rb:95:in `before_and_after' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime.rb:78:in `with_hooks' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime/support_code.rb:115:in `call' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime/support_code.rb:115:in `around' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/language_support/language_methods.rb:13:in `around' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/language_support/language_methods.rb:95:in `call' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/language_support/language_methods.rb:95:in `execute_around' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/language_support/language_methods.rb:12:in `around' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime/support_code.rb:114:in `around' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime/support_code.rb:112:in `call' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime/support_code.rb:112:in `around' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime.rb:90:in `around' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime.rb:77:in `with_hooks' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/scenario.rb:51:in `accept' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/scenario.rb:106:in `with_visitor' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/scenario.rb:45:in `accept' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:51:in `visit_feature_element' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:50:in `visit_feature_element' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/feature.rb:40:in `accept' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/feature.rb:39:in `each' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/feature.rb:39:in `accept' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:20:in `visit_feature' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:19:in `visit_feature' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/features.rb:29:in `accept' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/features.rb:17:in `each' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/features.rb:17:in `each' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/features.rb:28:in `accept' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:14:in `visit_features' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:164:in `broadcast' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/ast/tree_walker.rb:13:in `visit_features' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/runtime.rb:45:in `run!' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/cli/main.rb:43:in `execute!' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/../lib/cucumber/cli/main.rb:20:in `execute' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/gems/cucumber-0.10.0/bin/cucumber:14 /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/bin/cucumber:19:in `load' /Users/eostrom/.rvm/gems/ruby-1.8.7-p299@comics/bin/cucumber:19 WARNING: [Sun Dec 26 2010 14:29:20 GMT-0600 (CST)] {ENVJS} Exception while dispatching events: super: no superclass method `require' for Object:Class F---------------------F (::) failed steps (::) super: no superclass method `require' for Object:Class (NoMethodError) ./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/editing.feature:31:in `And I press "Save"'
I have installed the capybara-envjs gem along with the envjs gem and the johnson gem however when I set the driver with
Capybara.default_driver = :envjs
I get the error 'no driver called envjs was found (Capybara::DriverNotFoundError)', am I missing something?
I have a test that basically works like this:
visit "/foo"
click "some button"
# hits a URL, say, /bar, that redirects back to "/foo"
current_url.should =~ %r{/foo$}
When I inspect the body after clicking the button, I see the content of /foo. However, when I ask for the current_url, it tells me that it's still /bar. So it seems that envjs is honoring the redirect, but browser["window"].location.href is not being updated after the redirect, or maybe there's another way to access the new URL. Have you noticed this or do you have any ideas?
I'm getting this error:
When I click the "Users" tab # features/step_definitions/users/User_Access_steps.rb:64
c is undefined (Johnson::Error)
inline:690 [JavaScript]
inline:699 [JavaScript]
inline:55 [JavaScript]
inline:49 [JavaScript]
./features/step_definitions/users/User_Access_steps.rb:65:in `/^I click the "([^"]*)" tab$/'
features/users/Permissions.feature:75:in `When I click the "Users" tab'
With a custom step that I defined:
When /^I click the "([^"]*)" tab$/ do |arg1|
page.locate(:css, ".tabs > ul > li > a:contains('" + arg1 + "')").click();
end
However, this also fails if I use the usual click_link on the link. The link is generated as part of Jquery UI's tabs code, but the html for the link is simply:
Users
I'd be happy to give any more information needed... I am just getting up to speed on the framework and am not sure what's relevant.
We are using capybara / capybara-envjs with steak (vanilla RSpec plus some aliases) for acceptance testing on a project. We are slowly replacing our Cucumber scenarios with steak, so we actually have both installed on the project.
Because of this, capybara-envjs is assuming that it is running under cucumber. Line 4 of envjs.rb:
if Object.const_defined? :Cucumber
require 'capybara/envjs/cucumber'
end
Because this isn't inside of Cucumber, I get a stack trace related to World being undefined on Object. Stack trace below...
Changing the conditional to match below seems to fix the issues that I'm seeing, but I'm not sure if it will continue to work with Cucumber.
if Object.const_defined?(:Cucumber) && Object.respond_to?(:World)
require 'capybara/envjs/cucumber'
end
/var/lib/hudson/.bundle/ruby/1.8/gems/capybara-0.3.7/lib/capybara/cucumber.rb:4: undefined method World' for main:Object (NoMethodError) from /var/lib/hudson/.bundle/ruby/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in
polyglot_original_require'
from /var/lib/hudson/.bundle/ruby/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in
require'
from /var/lib/hudson/.bundle/ruby/1.8/gems/capybara-envjs-0.1.2/lib/capybara/envjs/cucumber.rb:1
from /var/lib/hudson/.bundle/ruby/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in polyglot_original_require' from /var/lib/hudson/.bundle/ruby/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in
require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in require' from /var/lib/hudson/.bundle/ruby/1.8/gems/capybara-envjs-0.1.2/lib/capybara/envjs.rb:5 from /var/lib/hudson/.bundle/ruby/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in
polyglot_original_require'
from /var/lib/hudson/.bundle/ruby/1.8/gems/polyglot-0.3.1/lib/polyglot.rb:64:in require' from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:158:in
require'
from ./spec/acceptance/acceptance_helper.rb:5
from ./spec/acceptance/saved_candidate_search_feature_spec.rb:1:in require' from ./spec/acceptance/saved_candidate_search_feature_spec.rb:1 from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:15:in
load'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:15:in load_files' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in
each'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/example_group_runner.rb:14:in load_files' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/options.rb:133:in
run_examples'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/lib/spec/runner/command_line.rb:9:in `run'
from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/bin/spec:5
is it possible to relax the capybara ~>0.4.0 dependency. We now have a release of cucumber-rails which requires capybara = 1.0.0 beta1.
thank you for your work and for considering my request
Les
I'm trying to include capybara-envjs in my Gemfile and install it using bundler (0.9.26), but it just hangs while fetching source (not sure if it hangs while or after fetching sources though). If I remove capybara-envjs from my Gemfile, everything works fine.
It just outputs:
Fetching source index from http://gemcutter.org/
Fetching source index from http://gems.github.com/
And stays there forever.
Any ideas?
When I run 'rake test' I get:
Missing these required gems:
capybara-envjs
You're running:
ruby 1.8.7.248 at /Users/riccardotacconi/.rvm/rubies/ree-1.8.7-2010.01/bin/ruby
rubygems 1.3.7 at /Users/riccardotacconi/.rvm/gems/ree-1.8.7-2010.01@global, /Users/riccardotacconi/.rvm/gems/ree-1.8.7-2010.01
rake gems:install
to install the missing gems.I have:
johnson (2.0.0.pre3)
capybara (0.3.9)
capybara-envjs (0.1.6)
RAILS_GEM_VERSION = '2.3.8'
I am loading Capybara from environment.rb in this way:
require 'capybara/rails'
require 'capybara/dsl'
require 'capybara/envjs'
Capybara.javascript_driver = :envjs
Capybara is used inside shouda and I do not have any Cuke or RSpec.
Please advice.
Hello,
Is there a way to check the content of a javascript alert() message? When running my feature I can see that envjs correctly 'sees' the alert() message (I get "WARNIING: [Sat Jul 10 2010 16:01:56 GMT-0500 (PET)] {ENVJS} You must enter a message.") but I don't how to check this a Cucumber step.
I have a Rails(2.3.8) app, which is being tested with Cucumber & Capybara with the capybara-envjs web driver. I am getting this error "Radius exceeds box width".
I have narrowed this down to CurveyCorners - this error doesn't occur in the browser so it must be something to do with the way the driver runs the test. Is there a way to get it to ignore this type of error?
When I use capybara-envjs, I get lots of messages like:
WARNIING: [Fri May 07 2010 22:58:49 GMT-0700 (PST)] {ENVJS} could not load script http://example.com/javascripts/application.js?1273294875: syntax error
Apparently it's trying to download the javascript from example.com rather than getting it from the public directory of my rails app. Any idea what could be causing this?
Hi
I am trying to install Envjs in Mac Os X with ruby 1.9
In my gemfile:
gem "capybara-envjs", :git => 'https://github.com/smparkes/capybara-envjs.git'
But I get come compile time errors regarding Johnson. It seems that Johnson doesn't support ruby 1.9. It cannot compile.
Any work around on this?
I have a link_to with remote=true in a view that I want to test in a Cucumber scenario with capybara-envjs (using @javascript tag). When the user click this link it submits a request to a "get_more" controller action.
With my browser it works, as the browser correctly submits the link with HTTP_ACCEPT "text/javascript, application/javascript".
When I run the scenario, it does not work as I get the error
Missing template announcements/get_more with {:handlers=>[:rxml, :builder, :rjs, :haml, :rhtml, :erb], :formats=>[:html], :locale=>[:en, :en]} in view paths "/Users/Florent/Programmation/Projets/myapp/app/views", "/Users/Florent/.rvm/gems/ree-1.8.7-2010.01/gems/devise-1.1.rc2/app/views" (ActionView::MissingTemplate)
Rails is looking for a HTML template instead my javascript template. Looks like the request is not submitted by capybara-envjs with the correct HTTP_ACCEPT "text/javascript, application/javascript" header.
Is this a bug or is there a way to force capybara-envjs HTTP_ACCEPT header? (BTW thanks a lot for you gem it is very useful!)
Hello there,
Seems capybara-envjs has troubles with jQuery's live events. If an event listener is bound using bind(), everything works fine, but if using live(), it does not. I put together simple example to demonstrate it:
http://github.com/madadam/capybara-envjs-jquery-live-failure-example
Just run ruby -rubygems test.rb
to see it. With selenium driver, it works fine, with envjs, it fails.
I'm trying to access cookies that are set by my application in some js, but envjs does not seem to be aware of them. I checked the cookies on both request and response side in rails and the data is there as it should be. The cookies work fine in the browser, and through selenium, so not sure what the disconnect is with envjs. My site does use subdomains, but I don't know if that makes any difference given that the behavior works as expected in other places.
I have a jQuery change event registered with $('#tags fieldset:last li:first input').live('change', ...). When I fill the field with fill_in the change event does not get triggered. I have to manually trigger it with page.find('#event_tags_attributes_0_name').trigger('change') in my test.
I keep getting:
Could not find gem 'cabybara-envjs (= 0.4.0, runtime)' in any of the gem sources.
I just started using Bundler so I'm pretty new at it, but could this be because I have rubygems v1.3.7 and your gemspec has 's.rubygems_version = "1.3.6"'?
Hi, I have a very simple app written in Rails 3 on Ruby 1.8.7. I have a form with :remote => true, which initiates an AJAX POST request on form submission. The code works in a regular browser, and it works with regular Capibara's selenium driver. If I switch to capybara-envjs the form submits though a normal html mode. Please advise.
My env.rb
require 'capybara/envjs'
Capybara.javascript_driver = :envjs
Capybara.app = Rails3Mongo::Application
My Gemfile
gem 'capybara-envjs'
gem 'database_cleaner', :git => 'git://github.com/bmabey/database_cleaner.git'
gem 'cucumber-rails', :git => 'git://github.com/aslakhellesoy/cucumber-rails.git'
gem "rspec-rails", ">=2.0.0.beta.5"
gem 'cucumber'
My feature:
@javascript
Scenario: Editing a comment
Given There are 10 posts
Given The first post has 3 comments
Given I am on the first comment edit page
When I press "Update Comment"
Then Visual effect has to run
Hi,
I was testing a jqueryUI datepicker and found this weird error. (latest capybara and envjs).
You can reproduce this error running this code:
require 'rubygems' require 'capybara' require 'capybara/dsl' require 'capybara/envjs' Capybara.current_driver = :envjs Capybara.run_server = false Capybara.app_host = 'http://jqueryui.com' session = Capybara::Session.new(:envjs) session.visit('/demos/datepicker/icon-trigger.html') session.find(:css, 'img.ui-datepicker-trigger').trigger(:click) # win.document is undefined (Johnson::Error) puts session.find('#ui-timepicker-div').visible?
This is the problematic jQuery code:
// Lines 6164-6169 jquery.js // Return the scroll offset return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : jQuery.support.boxModel && win.document.documentElement[ method ] || win.document.body[ method ] : elem[ method ];
I'm not sure if it's a capybara-envjs bug or should I post it to envjs / johnson
Hello,
The capybara-envjs is working for me so far, but somehow I just ran up into some issue.
Somehow if the page has <table>
tag with <tfoot>
element in it, Envjs would throw the exception on parsing the page. Some of the backtrace is:
oopsz com.google.gwt.core.client.JavaScriptException: (TypeError): child.tagName is undefined
fileName: /Users/sikachu/.rvm/gems/ruby-1.8.7-p249/gems/envjs-0.3.4/lib/envjs/static.js
lineNumber: 7382
stack: ([object Object])@/Users/sikachu/.rvm/gems/ruby-1.8.7-p249/gems/envjs-0.3.4/lib/envjs/static.js:7382
$appendCharacters([object Object],[object Object],"\n ")@/Users/sikachu/.rvm/gems/ruby-1.8.7-p249/gems/envjs-0.3.4/lib/envjs/static.js:13318
$flushCharacters([object Object])@/Users/sikachu/.rvm/gems/ruby-1.8.7-p249/gems/envjs-0.3.4/lib/envjs/static.js:11615
$appendToCurrentNodeAndPushElement([object Object],"http://www.w3.org/1999/xhtml",[object Object],[object Object])@/Users/sikachu/.rvm/gems/ruby-1.8.7-p249/gems/envjs-0.3.4/lib/envjs/static.js:10222
$startTag([object Object],[object Object],[object Object],false)@/Users/sikachu/.rvm/gems/ruby-1.8.7-p249/gems/envjs-0.3.4/lib/envjs/static.js:12072
$emitCurrentTagToken([object Object],false,6288)@/Users/sikachu/.rvm/gems/ruby-1.8.7-p249/gems/envjs-0.3.4/lib/envjs/static.js:15258
$stateLoop([object Object],6,62,6288,[object Array],false,2,6656)@/Users/sikachu/.rvm/gems/ruby-1.8.7-p249/gems/envjs-0.3.4/lib/envjs/static.js:15815
$tokenizeBuffer([object Object],[object Object])@/Users/sikachu/.rvm/gems/ruby-1.8.7-p249/gems/envjs-0.3.4/lib/envjs/static.js:17889
$pump([object Object],[object split_global])@/Users/sikachu/.rvm/gems/ruby-1.8.7-p249/gems/envjs-0.3.4/lib/envjs/static.js:13711
The test did completed successfully, but the backtrace would print out the whole HTML document. I just want to know if there's something I can do to track down this bug.
Also, could you tell me the way to compile the static.js
from envjs repository? I'd like to update the sources to make sure that it's actually envjs bug.
Thank you
It seems that POST params on AJAX request are not sent to the server. I'm not sure it's a capybara-envjs bug or a envjs bug.
I built a small Sinatra app at https://github.com/kookoolen/capybara-envjs-bug
Just clone it, run bundle install
and rake cucumber
to see it fail.
The same feature pass with selenium instead of envjs.
Hello, I'm having some hard time here to track down a problem I'm having while testing env-js.
What I want to achieve is really simple: There is a link to Twitter that when clicked, shows some tweets hidden in the page (I'll probably change this to load tweets on the fly, but for now it's ok). Here is a sample markup:
<a href="#">Twitter</a>
<div style="display:none">
<ul id="twitter_update_list"><li><span>Lorem Ipsum</span></li><li><span>Lorem Ipsum</span></li><li><span>Lorem Ipsum</span></li></ul>
<a href="#" target="_blank">leia mais >></a>
</div>
I have a test written that just asserts the elements are not visible in the page, then click that Twitter link, and assert the elements are now visible. It fails in this last test.
Using the browser everything is working fine so far.
Here is some debug I've done. As you can see, by using javascript (jQuery) to check whether the element is visible or not, it apparently works. However page body stays unchanged when I check it's content.
(rdb:1) p page.evaluate_script(%q[$("a:contains(Twitter)").next().is(':hidden')])
true
(rdb:1) n # => click_link 'Twitter'
(rdb:1) p page.evaluate_script(%q[$("a:contains(Twitter)").next().is(':hidden')])
false
# And page body does not change
Here is an attempt to use jQuery straight from browser window. Parent is the div with style="display:none", that I expect to be shown when clicking the link. Even tough I try to call :show on it, it does not work.
(rdb:1) p page.driver.browser['window'].jQuery('#twitter_update_list').parent.is(':hidden')
true
(rdb:1) p page.driver.browser['window'].jQuery('#twitter_update_list').parent.show
[object Object]
(rdb:1) p page.driver.browser['window'].jQuery('#twitter_update_list').parent.is(':hidden')
false
(rdb:1) p page.driver.browser['window'].jQuery('#twitter_update_list').parent.parent.html
<a href="#">Twitter</a>
<div style="display:none">
<ul id="twitter_update_list"><li><span>Lorem Ipsum</span></li><li><span>Lorem Ipsum</span></li><li><span>Lorem Ipsum</span></li></ul>
<a href="#" target="_blank">leia mais >></a>
</div>
Displays the same markup.
My javascript function does nothing more than toggling the div element when clicking the "Twitter" link:
$(this).next().toggle();
return false;
I was able to get it working by changing .toggle() to .removeAttr('style'), for testing purposes. That for some reason worked pretty much well, but is not what I want to achieve.
It's important to know that I'm writing this application with Rails 3 beta 4, Ruby 1.8.7, Rspec 2.0 beta 12.
Before the same feature/test was working in a previous version of the application running in Rails 2.2.3, and using Capybara + Culerity/Celerity, and Rspec 1.3.0.
Any idea about that?
Any help would be appreciated.
Thanks, Carlos.
I like to use it with rails app. But couldn't figure out how to get started.
Any example code or app would be much better as a getting started.
I am usring rspec. With the same Gemfile everything works on Mac. On linux it hangs until I Control-C and then slowly gives error messages until I kill -9
I have tried 0.4.0 and github
Hi
I have forked jxson's sample sinatra app and changed the best movie ever form to use ajax and put the same response in p#result. The step Then I should see "You think Teen Wolf is the best movie ever? Pfff..." now fails. Is this a limitation of the driver or is there another way to make this work?
http://github.com/stevehodgkiss/envjs-cucumber-example
Thanks
Steve
just tried to use it, but only got
xpath failure: ReferenceError: alert is not defined
WARNIING: [Thu Mar 25 2010 15:19:48 GMT+0100 (CET)] {ENVJS} could not load script http://example.com/javascripts/scriptaculous.js?1269513576: alert is not defined
ERROR: [Thu Mar 25 2010 15:19:49 GMT+0100 (CET)] {ENVJS} error evaluating script:
Simple test using visit method seems to fail while using envjs driver. Works fine with default driver.
When I google
Then I should see "2010 Google"
When /^I google$/ do
visit "http://www.google.com" \n
end
Running feature fails with "false is not true. (Test::Unit::AssertionFailedError)" message.
Also when using full url (eg. http://www.google.com/webhp), it errors out with "No route matches "/webhp" with {:method=>:get} (ActionController::RoutingError)" message
Details described in this thread: http://groups.google.com/group/ruby-capybara/browse_thread/thread/69e85fa4bbc40cb1
Here is a simple test that passes using selenium, but fails using envjs: http://gist.github.com/551764
Thanks
I've got a fairly standard setup: cucumber, capybara, and I'd now like to throw envjs in there.
Capybara.default_selector = :css
Capybara.javascript_driver = :envjs
I run a cucumber test, with javascript on, and here's the output:
Using the default profile...
not implmented yet: XPath function local-name()
xpath failure: TypeError: v1 is undefined
WARNIING: [Fri Aug 06 2010 13:24:45 GMT-0600 (MST)] {ENVJS} could not load script http://www.example.com/javascripts/prototype.js?1280583605: v1 is undefined
WARNIING: [Fri Aug 06 2010 13:24:45 GMT-0600 (MST)] {ENVJS} could not load script http://www.example.com/javascripts/controls.js?1280583605: Field is undefined
WARNIING: [Fri Aug 06 2010 13:24:45 GMT-0600 (MST)] {ENVJS} could not load script http://www.example.com/javascripts/rails.js?1280583605: document.observe is not a function
I'm using FancyBox to load the content via ajax request in a Rails3rc app.
The following is the feature which passes/works in development, testing via browser, but when I try to test it via envjs, it blows up.
Then I should see "You are Doing Good" within "#fancybox-inner" # features/step_definitions/web_steps.rb:107
scope '//[@id = 'fancybox-inner']' not found on page (Capybara::ElementNotFound)
./features/step_definitions/web_steps.rb:14:in with_scope' ./features/step_definitions/web_steps.rb:108:in
/^(?:|I )should see "([^"])"(?: within "([^"]*)")?$/'
features/homepage.feature:34:in `Then I should see "You are Doing Good" within "#fancybox-inner"'
This is the generated link to be clicked.
Do Good
And this is the jquery/fancybox hook that makes it work.
jQuery(document).ready(function($) {
$("a.do_good_order").fancybox({
'hideOnContentClick': true,
'width': 400,
'height': 300,
'autoScale': false,
'autoDimensions': false
});
});
From the error above, its complaining about the scope '//*[@id = 'fancybox-inner']' not found on page (Capybara::ElementNotFound)
So, my question is, does capybara-envjs supports or can detect the elements inside the #fancybox-inner
div which is a overlayed container of FancyBox??
Hi there,
I'm using jQuery with capybara-envjs, and ended up importing it directly into the page. Unfortunately I keep getting an error as follows:
ERROR [ ... ] {ENVJS} unmatched ) in regular expression
Immediately before the error, cucumber spits out the entire script, which is odd, and evaluating each script (i.e. the jquery library) takes about 30 seconds.
Has anyone else encountered this? If so, do you know what could be going on wrong?
I have a test that is not working, and normally I would put in a "show me the page" so I can see what was being read at the time, but this doesn't seem to work with envjs. When I tag my feature with @javascript, it fails, and the result of showing the page is just a file with "No File". Any suggestions on how to capture the page output at that point and save it as a file?
Hi, Steven! I've been trying to use "Then show me the page" to help debug my tests. It should be an invaluable debugging tool. However, it seems to behave really erratically when using XHRs. What I'm seeing is that unless you look for something in the page that was put there as a result of the XHR, you won't see it in the "show me the page" output.
I've got some simple tests in my project here: https://github.com/sbleon/envjs-test The tests you should check out are in https://github.com/sbleon/envjs-test/blob/master/features/show_me_the_page_test.feature . Please read the comments at the top of that file for a description of what I'm seeing when I run the tests.
Thanks!
PS. This behavior is disturbingly reminiscent of Heisenberg's uncertainty principle and Schroedinger's Cat ;-)
Capybara::OptionNotFound: No such option 'Sales' in this select box. Available options: 'All Categories', 'Returns', 'Sales'
Seems like all_unfiltered("//option[text()='#{option}']") isn't matching what we'd figure on it matching...
I am almost up and running with the envjs driver but am having a problem that makes it look like my event handlers are not being triggered.
inside of one of my steps I have:
click_button(button)
And in my js I have a submit event handler for the form which is not being triggered.
The event is triggered when I do something like this from a step:
page.evaluate_script("$('#login-button').click();");
I was thinking it may have something to do with needing wait wait_until but I am unsure...
I have issue that in some test involving Ajax my
page.should have_css(...)
expectations were failing with Capybara::TimeoutError exception and what I found out that the reason was that Capybara::Driver::Envjs#wait_until was raising it when all javascript events were finished but before final verification if specified css selector is in the page. So I made monkey patch commenting out raising of this exception:
::Capybara::Driver::Envjs.class_eval do
def wait_until max
fired, wait = *browser["Envjs"].wait(-max*1000)
# RSI: do not raise error as then WaitUntil.timeout is not executing passed block
# for the last time after all events are processed
# raise Capybara::TimeoutError if !fired && wait.nil?
end
end
and now my tests are passing as after completion of this wait_until method Capybara checks for the last time if css selector is present.
If necessary I could try to create a test case that repeats this issue.
Currently moving over from selenium to envjs and liking the massive speed increase so far.
I have noticed however I get the following error when running tests:
WARNIING: [Thu Aug 19 2010 14:49:02 GMT+0100 (BST)] {ENVJS} could not load script http://subdomaina.example.com:9887/javascripts/rails.js?1281952643: Connection refused - connect(2)
The javascript is however working fine as a checkbox toggle hides and shows a div and I find not issues in the logs.
It should probably be noted I'm using http://github.com/thoughtbot/capybara-envjs-fixes as I was unable to get the tests to even run without it, not sure which may be causing the issue.
When capybara-envjs follows redirects after a POST, the headers like CONTENT_TYPE and CONTENT_LENGTH are sent along with the GET that fetches the redirect. This doesn't present a problem with the sinatra based test app, but it does in rails apps as rails will barf on the fact that the headers say there is some data in the request, but it's not there (Sinatra is probably wrong in not barfing).
The super simple fix is here: http://github.com/h-lame/capybara-envjs/commit/36c811bfa3aa9d67ca0861ce473776331fe159b0
I've no idea how to test it though (as the Sinatra test app doesn't seem to break!)
Hey there,
I've spent quite a while trying to work this out with no avail (it's sent me deep into the guts of envjs xpath parser with nothing really to show for it), so I'd be really grateful if you could take a look and / or give me some pointers. Basically the problem is, calling select("some option", :from => "some select") will select ALL the matching <option>s on the page within their respective <select>s - effectively ignoring the :from argument.
I've written a failing test based on a slight modification to the upstream capybara test suite:
diff from http://github.com/jnicklas/capybara commit a94f9949d5c13e73b115fb6b2a9774214e6fb813: http://gist.github.com/451651
I've tracked the problem down as far as the call to xpathParse at line 33 of src/xpath/expression.js in the env-js source (this is from your (smparkes's) fork btw). For some reason that I can't work out, this sets the 'absolute' property to true on the result it sends back (this happens at line 1697 of src/xpath/implementation.js although I'll be damned if i can work out why or where it gets called from), meaning that when evalute() is called on the returned object, it searches within context.root, rather than context.node, returning all the matching <option>s in the document.
Any pointers as to how we can remedy this would be great!
Cheers,
Tim
It borks in Rails 3.
To replicate, check out the envjs branch at:
It sates that the Node cannot inherit from a module, if you patch that up by changing the node class to
class Node < Capybara::Driver::Node
Then you get a driver not found error, which can be fixed by adding
Capybara.register_driver :envjs do |app|
Capybara::Driver::Envjs.new(app)
end
But then i got stuck with another claiming that it Capybara::Driver::Envjs::Node didn't have a node method.
Is anyone else able to get this running with capybara 1.0.0 (i'm also using spec) ??
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:in parse_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:in POST' /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:in call' /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:in call' /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:in call' /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:in cache' /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:in call' /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:in run_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:in call' /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:in call' /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:in call' /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:in synchronize' /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:in call' /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:in call' /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:in call' /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:in process_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:in send' /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:in evaluate_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:in evaluate_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:in call' /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:in call_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:in click_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:in with_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:in cucumber_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:in cucumber_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:in invoke' /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:in accept' /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:in broadcast' /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:in accept' /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:in accept' /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:in broadcast' /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:in accept' /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:in call' /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:in execute_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:in call' /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:in with_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:in with_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:in visit_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:in visit_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:in each' /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:in visit_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:in visit_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:in each' /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:in accept' /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:in broadcast' /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:in execute!' /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
Support for jQuery 1.4+ is not good. This is a problem with env.js, but is likely to come up when people are using capybara-envjs, so I thought it should be documented here.
Per smparkes:
1.4 relies a lot more on event bubbling and that code in env.js (at least the Ruby fork) is not good.
It's not all that terribly hard to fix ... no rocket science ... but it's probably a few hard core days to really get it solid and unfortunately I don't have the right combination of need and time right now.
Wish I did. It's one of the biggest pains in env.js right now since more and more code relies on proper bubbling.
I'm pretty sure I have a standard capybara-envjs install. Rails 3, Cucumber 0.9.3. I'm getting the following error:
element.contentWindows appears to be undefined for some reason. Thoughts?
I'm not sure where the best place is to post this, so if here isn't right, I'm sorry.
I'm trying to get a very simple test of capybara-envjs working, and am not having any success. I have a very simple rails app at http://github.com/phillipkoebbe/envjs_test that has an html page in root (/envjs_test.html). On that page is a button that calls a JS function to hide one div and show another div. There is a cucumber feature in features/a_test.feature that has a non javascript scenario (to prove that the hidden div is not visible) and a javascript scenario that should be visible if JS is working.
The tests all pass when using the @javascript tag (both with the selenium and culerity drivers), but when I try the @envjs tag, it fails with a message that indicates the onclick of the button didn't work, meaning javascript support isn't there.
I have also tried to set the javascript_driver to :envjs, but get the "unknown driver" error from capybara when I do.
I just updated all gems this morning, but here is a list of versions:
capybara (0.3.8)
capybara-envjs (0.1.3, 0.1.2)
cucumber (0.7.3, 0.7.2, 0.6.3, 0.6.2)
cucumber-rails (0.3.1, 0.3.0, 0.2.4)
culerity (0.2.10, 0.2.9)
envjs (0.3.5, 0.3.4)
gherkin (1.0.30, 1.0.26)
johnson (2.0.0.pre3)
rack-test (0.5.3)
rails (2.3.5, 1.2.6)
selenium-webdriver (0.0.18)
Does it matter that I'm using Prototype and not JQuery?
Anything else you need to know?
Peace.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.