paulroho
paulroho

Reputation: 1266

Why is [object Casper].test undefined?

I am evaluating CasperJS' testing API under Windows. Unfortunately, the test property of the Casper object is always undefined.

Running the following script prints "this.test is undefined":

phantom.casperPath = 'D:\\GitHubSources\\casperjs';
phantom.injectJs(phantom.casperPath + '\\bin\\bootstrap.js');

var casper = require('casper').create();

casper.start('http://localhost:56679/index.html', function(){
    this.echo('this.test is ' + this.test);
});

casper.run(function(){
    this.exit();
});

Any hints?

Upvotes: 1

Views: 1321

Answers (1)

NiKo
NiKo

Reputation: 11411

Because you seem using the 1.1 branch, which has backward uncompatible changes; as stated in the branch changelog:

The Casper object won't be created with a test reference if not invoked using the casperjs test command, therefore the ability to run any test without calling it has been dropped. I know, get over it.

PS: I'm actually considering tagging the master branch as 2.0

Upvotes: 3

Related Questions