Reputation: 12068
The docs strate you can pass an options
object to casperjs.create()
including js clientScripts to inject to the client page.
The docs also state that you shouldn't casper.create instance in a test file.
The docs don't state (at least I couldn't find it) how to use an options
object with the casper.tester class. I did try to do something like:
casper.options = {
clientScripts:[
'../testlib/sinon-1.7.3.js'
],
logLevel:"warning",
verbose:true
};
Before casper.test.begin
but it broke the test.
putting it between the 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 beneath it also broke the tests
I,ll be glad for any direction with this. Especially with the injection part
Upvotes: 5
Views: 2897
Reputation: 3811
You will need to push the file onto casper.option.clientScripts
so as not to disrupt the other options that casper test
sets.
casper.options.clientScripts.push("../testlib/sinon-1.7.3.js");
Source: CasperJS mailing list
Upvotes: 7