#frontendtesting
casper.start(“/home”).then(function(){
// Initial state of form
phantomcss
.screenshot(“#signUpForm”, “sign up form”);
// Hit the sign up button (should trigger error)
casper.click(“button#signUp”);
// Take a screenshot of the UI component
phantomcss
.screenshot(“#signUpForm”, “sign up form error”);
// Fill in form by name attributes & submit
casper.fill(“#signUpForm”, {
name: “Alicia Sedlock”,
email: “
[email protected]”
}, true);
// Take a second screenshot of success state
phantomcss
.screenshot(“#signUpForm”, “sign up form success”);
});