Slow Zombie.js test speeds while processing scripts vs. a real browser

468 views
Skip to first unread message

Dan Smith

unread,
Jun 4, 2014, 6:22:11 PM6/4/14
to zomb...@googlegroups.com
While testing my application and attempting to implement some basic regression tests in Zombie and Mocha I started hitting some very slow test result speeds right away.

I noticed that running the two tests below took on average about 5000ms to complete each one, for a rough total time of 10 seconds for 2 tests.
Passing runScripts:false immediately sped up the process to around 1 second per test. So, I decided to see if there were any particular scripts that load very slow in an actual browser that might be slowing everything down.
After many tests in Google Chrome the scripts load in roughly 500 - 700ms for both "/" and "/-/signup" from inspecting the network tab. 
So, if a real browser can process all of these scripts in a relatively prompt manner, why does the Zombie Browser process them so slowly?

Looking at my zombie debug logs, I noticed that when scripts are on it loads a few scripts very quickly but then i see rapid messages like the following. What does this generally mean when I see these?
Zombie: Fired timeout after 100ms delay
Zombie: Fired timeout after 1000ms delay
Zombie: Fired timeout after 500ms delay


Here's the majority of my code:

var Browser = require('zombie'),
browser = new Browser({debug:true, runScripts:true}),
assert = require('assert'),
config = require('../config');
describe("Navigate to the application", function() {
it("should go to the Local URL ", function(done) {
browser.visit(config.envs.local, function() {
assert.equal(browser.location.href, "http://localhost:3000/");
done();
});
});

it("should click the 'Sign Up' link", function(done) {
browser.clickLink('Sign Up', function() {
assert.equal(browser.location.href, "http://localhost:3000/-/signup");
done();
});
});
});


Assaf Arkin

unread,
Jun 4, 2014, 7:21:01 PM6/4/14
to Dan Smith, zomb...@googlegroups.com
Client-side script uses setTimeout/setInterval to fire these events, Zombie will wait for all of them to complete.

You can tell it to wait with completion function, see test cases for some examples:

--
You received this message because you are subscribed to the Google Groups "zombie.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zombie-js+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages