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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With