Skip to content

Instantly share code, notes, and snippets.

@boblail
Created January 20, 2011 02:08
Show Gist options
  • Save boblail/787283 to your computer and use it in GitHub Desktop.
Save boblail/787283 to your computer and use it in GitHub Desktop.
Notes about capybara's examples which are failing for capyabara-zombie
1) Capybara::Driver::Zombie it should behave like driver with javascript support#drag_to should drag and drop an object
Failure/Error: @driver.find('//div[contains(., "Dropped!")]').should_not be_empty
expected empty? to return false, got true
# /opt/local/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
# /opt/local/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/handler.rb:44:in `handle_matcher'
# /opt/local/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/extensions/kernel.rb:50:in `should_not'
# /opt/local/lib/ruby/gems/1.8/gems/capybara-0.4.0/lib/capybara/spec/driver.rb:93
jQuery draggable.start and draggable.stop events are fired.
jQuery('#drag').offset() is {top: NaN, left: NaN} <== JSDOM doesn't implement element position; I think jQuery cares about this...
NB: env-js does not implement position either
NB: it looks like html_unit does
NB: droppable is not raising 'over': jquery.ui.droppable.js uses $.ui.intersect to test for intersection.
TODO: Further Investigation
If I specify :pageX and :pageY (10, 136), I see this error now:
TDOO: JSDOM ISSUE: OPEN, SUBMIT
'TypeError: Cannot read property \'padding-top\' of undefined
at Object.getPropertyValue (/usr/local/lib/node/.npm/zombie/9999.0.0-LINK-29b80986/package/node_modules/.npm/jsdom/0.1.23/package/lib/jsdom/browser/index.js:123:26)
at Function.curCSS (/jquery.js:12:9511)
at String.<anonymous> (/jquery.js:12:8931)
at Function.each (/jquery.js:12:7964)
at I (/jquery.js:12:8890)
at Function.css (/jquery.js:12:9118)
at Object.height (/jquery.js:19:39592)
at Object.<anonymous> (/jquery-ui.js:22:14835)
at Object.call (/jquery-ui.js:10:389)
at Object._trigger (/jquery-ui.js:22:9150)'
2) Capybara::Driver::Zombie it should behave like session with javascript support all JS specs Node#drag_to should drag and drop an object
Failure/Error: @session.find('//div[contains(., "Dropped!")]').should_not be_nil
Unable to find '//div[contains(., "Dropped!")]'
IGNORE: SAME AS FAILURE #1
3) Capybara::Driver::Zombie it should behave like session with javascript support all JS specs#wait_until should wait for block to return true
Failure/Error: @session.evaluate_script('activeRequests == 1').should be_true
expected false to be true
# /opt/local/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
# /opt/local/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/handler.rb:21:in `handle_matcher'
# /opt/local/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/extensions/kernel.rb:27:in `should'
# /opt/local/lib/ruby/gems/1.8/gems/capybara-0.4.0/lib/capybara/spec/session/javascript.rb:83
This has something to do with script execution contexts
- $('#waiter').change is fired.
- setTimeout works
- but @session.evaluate_script('activeRequests') is _always_ whatever value `activeRequests` is given on line 1 of test.js
I believe this is the same as [issue #37](https://github.com/assaf/zombie/issues/issue/37)
@boblail
Copy link
Author

boblail commented Jan 21, 2011

This failure was occurring because jQuery expected the 'click' event to be fired when the checkbox's value was changed.
4) Capybara::Driver::Zombie it should behave like session with javascript support all JS specs#check should trigger associated events
Failure/Error: @session.should have_css('#checkbox_event_triggered');
expected #has_css?("#checkbox_event_triggered") to return true, got false
# /opt/local/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/fail_with.rb:29:in fail_with' # /opt/local/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/handler.rb:21:inhandle_matcher'
# /opt/local/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/extensions/kernel.rb:27:in `should'
# /opt/local/lib/ruby/gems/1.8/gems/capybara-0.4.0/lib/capybara/spec/session/javascript.rb:159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment