fixed casper tests with polyfill

This commit is contained in:
Peter Cottle 2015-04-11 12:39:16 -07:00
parent 1ff2a731fb
commit b9337909ba
3 changed files with 27 additions and 1 deletions

View file

@ -4,6 +4,15 @@ var screenshotRoot = './src/__tests__/casperjs/screenshots/entirePage';
var CasperUtils = {
start: function(casper, url, callback) {
// Setup some sanity error handling
casper.on('page.error', function(msg, trace) {
casper.echo('Error: ' + msg, 'ERROR');
casper.echo('Stack: ' + trace);
});
casper.start(url, callback);
},
getRoot: function() {
// Unfortunately this is hardcoded for now :*( cant get the path
// variable synchronously when running this test, and CasperJS does

View file

@ -1,7 +1,15 @@
var CasperUtils = require('./casperUtils').CasperUtils;
casper.on('page.error', function(msg, trace) {
casper.echo('Error: ' + msg, 'ERROR');
casper.echo('Stack: ' + JSON.stringify(trace));
});
casper.options.logLevel ="debug";
casper.start(
CasperUtils.getUrl(),
CasperUtils.getUrlForCommands([
'asd'
]),
function() {
this.test.assertTitle('Learn Git Branching');

View file

@ -97,6 +97,15 @@
{{jsDependencies}}
<script src="lib/jquery-ui-1.9.0.custom.min.js"></script>
<script type="text/javascript">
// PhantomJS doesn't support bind yet LOL. polyfill
Function.prototype.bind = Function.prototype.bind || function (thisp) {
var fn = this;
return function () {
return fn.apply(thisp, arguments);
};
};
</script>
<!-- Templates from here on out. Someone seriously needs to fix template
management for node.js apps. I know there is the text plugin