Commit 963d1a3b 963d1a3b10cd5cf10f467bbdc98bdaf9ba7e4eb6 by Nicolas Perriault

added casper.cli proxy property for phantom.casperArgs; updated samples

1 parent cbb88484
......@@ -64,9 +64,9 @@
timeout: null,
verbose: false
};
// privates
// local properties
// properties
this.checker = null;
this.cli = phantom.casperArgs;
this.colorizer = new phantom.Casper.Colorizer();
this.currentUrl = 'about:blank';
this.currentHTTPStatus = 200;
......
......@@ -42,7 +42,7 @@ var casper = new phantom.Casper({
loadImages: false,
loadPlugins: false,
logLevel: "debug",
verbose: true,
verbose: true
});
casper.start()
......
......@@ -26,7 +26,7 @@ phantom.Casper.extend({
var casper = new phantom.Casper({
verbose: true
}), terms = phantom.casperArgs.args, scores = [], i = 0;
}), terms = casper.cli.args, scores = [], i = 0;
if (terms.length < 2) {
casper.echo('Usage: casperjs googlematch.js term1, term2 [, term3]...').exit();
......@@ -54,7 +54,7 @@ casper.run(function(self) {
return a.score - b.score;
});
var winner = scores[scores.length - 1];
self.echo('winner is "' + winner.term + '" with ' + winner.score + ' results')
self.echo('winner is "' + winner.term + '" with ' + winner.score + ' results');
self.exit();
});
......
......@@ -12,7 +12,7 @@ links = []
casper = new phantom.Casper
casper.start 'http://google.com', ->
@fill 'form[name=f]', q: phantom.args.join(' '), true
@fill 'form[name=f]', q: casper.cli.args.join(' '), true
@click 'input[value="Google Search"]'
casper.then ->
......
......@@ -29,7 +29,7 @@ var links = [
'http://cdiscount.fr/'
];
casper.echo('Testing with timeout=' + timeout);
casper.echo('Testing with timeout=' + timeout + 'ms.');
casper.start();
......
......@@ -25,9 +25,13 @@ phantom.Casper.extend({
(function(casper) {
var tests = [];
if (phantom.casperArgs.args.length > 2 && fs.isFile(phantom.casperArgs.args[2])) {
tests = [phantom.casperArgs.args[2]];
} else {
if (casper.cli.args.length) {
tests = casper.cli.args.filter(function(path) {
return fs.isFile(path) || fs.isDirectory(path);
});
}
if (!tests.length) {
// default test suite is casperjs' one
tests = [fs.absolute(fs.pathJoin(phantom.casperPath, 'tests', 'suites'))];
}
casper.test.runSuites.apply(casper.test, tests);
......