Last active
August 29, 2015 14:00
-
-
Save takkaria/392949159e08f0bb551a to your computer and use it in GitHub Desktop.
Echo automated test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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