I'm writing a test script with PhantomCSS but I'm running into an error. I've already run my script one time and I created the baseline screenshots. Now, when I try to run through it again, it creates the .diff.png images, but then throws the error:
TypeError: 'undefined' is not an object (evaluating 'test.success')
/path/to/phantomcss.js:426
FAIL TypeError: 'undefined' is not an object (evaluating 'test.success')
# type: error
# file: visual.js
# subject: false
# error: "TypeError: 'undefined' is not an object (evaluating 'test.success')"
# stack: in anonymous() in /path/to/phantomcss.js:426
FAIL 1 test executed in 4.035s, 0 passed, 1 failed, 0 dubious, 0 skipped.
I commented out most of my phantomcss.init() code, but this is what I have left:
var phantomcss = require('/path/to/phantomcss.js');
phantomcss.init({
failedComparisonRoot: './diffs'
});
casper.start(url);
casper.viewport(1024, 768);
casper.then(function() {
casper.wait(2500, function() {
phantomcss.screenshot('#app-bar', 'App_bar_initial');
phantomcss.screenshot('.selected', 'Selected_Menu_Initial');
});
});
casper.then(function() {
phantomcss.compareAll();
})
casper.then(function() {
casper.test.done();
})
casper.run(function() {
phantom.exit(phantomcss.getExitStatus());
});
EDIT: Line 426 from phantomcss.js is:
function waitForTests(tests){
casper.then(function(){
casper.waitFor(function(){
return tests.length === tests.reduce(function(count, test){
if (test.success || test.fail || test.error) {
return count + 1;
} else {
return count;
}
}, 0);
.....