Skip to content

Instantly share code, notes, and snippets.

@leehambley
Created June 1, 2016 07:59
Show Gist options
  • Save leehambley/403562804ecc32a2aa4bc799e37b47d7 to your computer and use it in GitHub Desktop.
Save leehambley/403562804ecc32a2aa4bc799e37b47d7 to your computer and use it in GitHub Desktop.
casper.test.begin('Test App Login Works Successfully', 1, function(test) {
var goalUrl = /wizard\/create/;
var formSelector = "form[name='harrowForm.form']";
casper.start('https://harrow.io/', function openTheHomePage() {
casper.evaluate(function() {
var res = localStorage.clear();
this.echo("Clearing Local Storage", res);
});
casper.capture('homepage.png');
casper.clickLabel('Log In', 'a');
});
casper.then(function fillAndSubmitLoginForm(){
casper.waitForSelector(formSelector, function () {
casper.capture('login-form.png');
casper.fillSelectors(formSelector, {
"input[name='email']" : "[email protected]",
"input[name='password']" : "Jack0/perp"
}, true);
});
});
casper.then(function waitForTheWizardStartPage(){
this.waitForUrl(goalUrl, function(){
casper.capture('wizard.png');
test.assertUrlMatch(goalUrl, 'landed on the wizard startpage');
});
});
casper.run(function endOfTestRunCallback(){
test.done()
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment