Skip to content

Instantly share code, notes, and snippets.

@takkaria
Last active August 29, 2015 14:00
Show Gist options
  • Save takkaria/392949159e08f0bb551a to your computer and use it in GitHub Desktop.
Save takkaria/392949159e08f0bb551a to your computer and use it in GitHub Desktop.
Echo automated test
// Login
function login() {
var USER = 'andi@takkaria.org';
var PASSWORD = 'xxx';
casper.thenOpen('http://echomanchester.net/admin/');
casper.then(function() {
this.fill('form', {
'email': USER,
'password': PASSWORD,
}, true);
});
casper.then(function() {
this.evaluateOrDie(function() {
return /Dashboard/.test(document.body.innerText);
}, 'login failed');
});
}
// TEST 001: Edit test
casper.start("");
login();
casper.thenOpen("http://local.echomanchester.net/event/203/edit");
// Set location
var LOCATION = "Testing, M15 8FF";
casper.then(function() {
this.fill('form', { 'location': LOCATION }, true);
});
// Check location was altered
casper.then(function() {
this.evaluateOrDie(function() {
return $("#location").val() == LOCATION;
}, 'Setting location failed.');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment