HuddleEng / PhantomCSS

Visual/CSS regression testing with PhantomJS
MIT License
4.72k stars 259 forks source link

PhantomJS fails with TypeError #184

Closed tejasbubane closed 7 years ago

tejasbubane commented 7 years ago

File:

var casper = require('casper');
var url = './dist/index.html';

casper.
  start( url ).
  then(function(){
    // Take a screenshot of the UI component
    phantomcss.screenshot('#intro', 'a screenshot of my dialog');
  });

Error:

⇒  casperjs test/home.test.js
TypeError: undefined is not a constructor (evaluating 'casper.
  start( url )')

  phantomjs://code/home.test.js:5 in global code
  :0 in injectJs
  phantomjs://code/bootstrap.js:456

This is an identified issue in phantomJS: https://github.com/ariya/phantomjs/issues/14211 and will be fixed in 2.5. Until then, is there anything we can do with here to handle this?

jamescryer commented 7 years ago

I don't think you need to require CasperJS if you invoke from the command line (https://github.com/Huddle/PhantomCSS/blob/master/casperjs.bat) on Windows or just the Casperjs executable on other platforms. The demo works without it, https://github.com/Huddle/PhantomCSS/blob/master/demo/testsuite.js