Reputation: 2940
The error:
casper.test property is only available using the `casperjs test` command
Searched my entire codebase for "casper.test", "this.test", "@test", etc, and none are present. Looking at the casper code, one of these needs to be triggered for this error to be raised.
The error is intermittent and only occurs on some casper runs. Has anyone else gotten this bug? I'm running 1.1.0-beta3
.
Upvotes: 6
Views: 2412
Reputation:
It has nothing to do with launching it. Not sure why, but I also received this error on my code before writing to file. It went away after removing...
JSON.stringify(obj);
Again, I dont know what caused the issue. And it may be something else causing it for you. But if you find which piece of code is causing it, I have a solution.
My solution: Use a handler for errors with a basic variable switch and turn off the error log for that portion of the step.
casper.on("error", function(err) {
if(custLog) {console.log(err);} //log the error
});
and in the step...
casper.then(function() {
custLog = false;
fs.write(fileName, JSON.stringify(content), 'w');
custLog = true;
});
You may or may not need to order the reorder the inner stack there.
Upvotes: 0
Reputation: 671
You can add
phantom.casperTest = true;
at the top of the test file.
Upvotes: 12
Reputation: 38092
Have you launch your script like this ?
casperjs test yourScript.js
Upvotes: 4