As many other here at Stack are struggling with, I'm trying to split my CasperJS tests across multiple files. I've spent three days reading the docs and crawling through the answers here and can't seem to find anything that helps.
I have three scripts (setup, functions, cleanup) that I include using the --pre, --post and --include commands. When I run each of my test files individually, it works great:
casperjs test tests/tables.js --includes=tests/phantomcss-functions.js --post=tests/phantomcss-cleanup.js --pre=tests/phantomcss-setup.js
...produces...
Test file: tests/phantomcss-setup.js
Test file: tests/tables.js
Test file: tests/phantomcss-cleanup.js
PASS 1 test executed in 2.416s, 1 passed, 0 failed, 0 dubious, 0 skipped.
When I attempt to run CapserJS on the entire directory, though, it doesn't quite fail -- it just doesn't work, jumping from the --pre step to the --post step without walking through any of the files in the directory:
Test file: tests/phantomcss-setup.js
Test file: tests/phantomcss-cleanup.js
No PASS, no FAIL. Just that. I'm at a complete loss. There's nothing in the debugging output. I've included the scripts output below. If anyone has an inkling of what to try next, I'd love to hear it!
phantomcss-functions.js:
var phantomcss = require('../node_modules/phantomcss/phantomcss.js');
function fileNameGetter(root,filename){ ... }
phantomcss.init({
fileNameGetter: fileNameGetter
});
phantomcss-setup.js:
casper.start();
casper.viewport(1024, 768);
casper.test.done();
phantomcss-cleanup.js
casper.then( function now_check_the_screenshots(){
phantomcss.compareAll();
});
casper.then( function end_it(){
casper.test.done();
});
casper.run(function(){
phantom.exit(phantomcss.getExitStatus());
});
tables.js (Test File Sample)
casper.thenOpen( 'http://127.0.0.1:5000/prototypes/page-product-basic.html' );
casper.then(function(){
phantomcss.screenshot('table.attribute-table:first-of-type', 'Table - Attribute');
});
casper.test.done();