
var cmg = require('helpers/core');// If you used --includes you'll need
// var cmg = casper.cmg;
cmg.init(casper); casper.cmg.testLoginProcess(casper, user [optional], pass [optional], call_done [optional, default true])
casper.waitFor(function test() {
return window.janrain && janrain.ready;
}, function then() {
test.assertEval(…);
}/*, function onTimeout, int timeout, obj timeout details*/);
casper.waitForSelector('.mySelector', function then() {
test.assertExists(…);
}/*, function onTimeout, int timeout, obj timeout details*/);
casper.test.begin(str description, int expectedTests, function theTests(test) {
casper.start('http://my.url.tld/path/to/page/', function then(){});
casper.then(function () { /* do testy stuff */ });
casper.waitFor(function () { /* do testy stuff */ });
casper.waitForSelector(function () { /* do testy stuff */ });
// After all of the tests
casper.then(function () {
test.done();
});
// This is what makes casper actually start doing stuff.
casper.run();
});
// for all tests that need to run in page environment
test.assertEval(function () { …test code… }, str description)
// for all non-test code that needs to be run in page environment
this.evaluate(function () { …code to run in browser… })
// from evaluate/assertEval
__utils__.method()
// from top script level
require('utils').method()