Casperjs test cow-test.js undefined is not a function evaluating casper.test.begin

I am using windows. I am trying to use CasperJS test environment.

I am using phantomjs version 1.9.0. I am using casperjs version version 1.0.2.

When i started

casperjs test cow-test.js 

The following is returned.

 Test file: cow-test.js FAIL TypeError: 'undefined' is not a function (evaluating 'casper.test.begin') # type: uncaughtError # error: "TypeError: 'undefined' is not a function (evaluating 'casper.test.begin')" TypeError: 'undefined' is not a function (evaluating 'casper.test.begin') C:/cow-test.js:16 FAIL 1 tests executed in 0.116s, 0 passed, 1 failed. Details for the 1 failed test: In cow-test.js:0 uncaughtError: TypeError: 'undefined' is not a function (evaluating 'casper.test.begin') var cow = {}; test.assert(cow); test.done(); })') 

If I only do

 console.log(casper.test); 

Coming back

 [object Object] 

If I only do

 console.log(casper.test.begin); 

The following is returned.

 undefined 

What should I do? Should I run "casperjs test cow-test.js" from a specific directory?

Or something else?

Thanks Andre Andre_Mikulec@Hotmail.com

+4
source share
2 answers

You are using a stable version of casperjs, and the documents and code on the site are for devel version 1.1

+7
source

The "test" API is only introduced with casperJs 1.0.2, you must update to use this syntax.

CasperJs has a mailing list for support: https://groups.google.com/forum/#!forum/casperjs

With the hope that this helps,

+4
source

Source: https://habr.com/ru/post/1493977/


All Articles