Casperjs - Using casper.options and, in particular, injecting client scripts using casper.tester

docs strate you can pass the options object to casperjs.create() , including js clientScripts for input to the client page.

The docs indicate that you should not use an instance of casper.create in a test file.

The docs do not indicate (at least I could not find it) how to use the options object with the casper.tester class. I tried to do something like:

 casper.options = { clientScripts:[ '../testlib/sinon-1.7.3.js' ], logLevel:"warning", verbose:true }; 

Until casper.test.begin , but it violated the test.

putting it between test.begin and casper.start.

 casper.test.begin('Basic index.html elements test',14, function suite(test){ casper.options..etc casper.start(url, function(){ //also tried here 

and also under it also violated the tests

I will be happy for any direction. Especially with the injection part

+4
source share
1 answer

You will need to click the file on casper.option.clientScripts so as not to violate other parameters that the casper test sets.

 casper.options.clientScripts.push("../testlib/sinon-1.7.3.js"); 

Source: CasperJS Mailing List

+5
source

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


All Articles