Re: [Capybara] new envjs_driver version

4 views
Skip to first unread message

Steven Parkes

unread,
Mar 2, 2010, 6:58:30 PM3/2/10
to ruby-c...@googlegroups.com, johnso...@googlegroups.com, en...@googlegroups.com
On Mar 2, 2010, at Mar 2,3:08 PM , Matt Wynne wrote:

> Great! Any benchmarks on how fast it is?

A helluva a lot faster than it used to?

Right now it takes about 110 seconds to run the session specs. Selenium takes about 300 seconds to do the same thing.

Not as fast as I would like. There should be some low-hanging fruit ...

The most time consuming things right now are the big xpath expressions.

Now you can do something like (taken from the capybara specs):

$('#clickable').click(function() {
var link = $(this);
setTimeout(function() {
$(link).after('<a href="#">Has been clicked</a>');
$(link).after('<input type="submit" value="New Here">');
$(link).after('<input type="text" id="new_field">');
Ruby.require('rubygems');
Ruby.require('ruby-debug/debugger');
$('#change').remove();
}, 500);
return false;
});

And end up with this:

smparkes@collegeterrace ~/capybara-envjs x86_64$ spec spec/session/envjs_session_spec.rb
.........................................................................................................................................................................................................................................................................................../home/collegeterrace/smparkes/x86_64/rvm/ruby-1.8.7-p249/gems/johnson-2.0.0.pre3/lib/johnson/tracemonkey/runtime.rb:36
@thread_id ||= Thread.current.object_id
(rdb:1) p w=self["window"]
[object Window 390]
(rdb:1) p w["$"].call("#change")[0]
Element #71 P => change
(rdb:1) p w["$"].call("#change")[0].innerHTML
"I changed it"
(rdb:1) p w["$"].call("#change")[0].outerHTML
"<p id=\"change\">I changed it</p>"
(rdb:1) c
.................

Finished in 1315.109529 seconds

300 examples, 0 failures

It's far from perfect, but you can look at the global state of the application, both Ruby and JS, at any point in time, e.,g., in the middle of an event or timer callback.

The stuff one could do, with all the time in the world? Well it boggles the mind.

Reply all
Reply to author
Forward
0 new messages