n1k0/casperjs — comment on commit f0b8a38ae09e8b30a3f807e86d6b9e04a8974755
File:  line 0
By n1k0:

> No I haven't tried anything passed 0.4.2 since this is the tag the gh-page said was the stable version.
> Is 0.4.2 still the most stable release?

It has changed since 0.6 has been published yesterday, it's now the latest stable release and the official documentation is up to date as well :)

> I'm in love.

*blushing*

Thanks for this kind feedback!

> What would be the best way to add named arguments to cli array?
>
> Example : --username srhyne --password *****

It's builtin since 0.6, but I didn't found the time to write a complete documentation section on the topic.

Actually here's a sample 0.6 script you can use to play around with argument passing:

``` js
var casper = require("casper").create();

casper.echo("Casper CLI passed args:");
require("utils").dump(casper.cli.args);

casper.echo("Casper CLI passed options:");
require("utils").dump(casper.cli.options);

casper.exit();
```

Sample usage:

```
$ casperjs samples/cliargs.js arg1 arg2 arg3 --foo=bar --plop anotherarg
Casper CLI passed args:
[
"arg1",
"arg2",
"arg3",
"anotherarg"
]
Casper CLI passed options:
{
"casper-path": "/Users/niko/Sites/casperjs",
"cli": true,
"foo": "bar",
"plop": true
}
```

> Evaluation scope?
> So just to be clear... functions passed to the different Evaluate methods
> CANNOT share any scope with the casper suite correct ( besides the named
> arguments obj passed as the second argument)?

Exactly.

> Wait
> wait() works just like then, thenOpen right? You can just just do .wait(100)
> .then(func) and that's the same as .wait(1000, func) right?

That's the idea indeed.

> Per test file best practice
> I want to make sure my test files run in the desired sequence. What's the
> preferable way to manage the test file sequence?

Hmm, there's currently no way to order the found tests, you can add an issue and I'll be happy to work on adding this feature :)

FTR the order of found test files is based on the test filenames, ordered alphabetically (depending on your OS I guess.)

> Also, should I use casper.start in each test file even if the previous test
> file finishes on the url I am going to use for the next test file? (Does
> that make sense?)

Yes, it's a good idea to use `start()` at the beginning of every test file in order to somewhat `reset` previous Casper state. You must think of a single test file as a whole suite, not as a piece of split scenario.

> THANK YOU!

Thank YOU for using it and taking the time to provide feedback :)