Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
it('should refuse partial submissions', function(done) {
var browser = this.browser;
browser.fill('first_name', 'John');
browser.pressButton('Send').then(function() {
assert.ok(browser.success);
assert.equal(browser.text('h1'), 'Contact');
assert.equal(browser.text('div.alert'), 'Please fill in all the fields');
}).then(done, done);
});
it('should keep values on partial submissions', function(done) {
var browser = this.browser;
browser.fill('first_name', 'John');
browser.pressButton('Send').then(function() {
assert.equal(browser.field('first_name').value, 'John');
}).then(done, done);
});
it('should refuse invalid emails', function(done) {
var browser = this.browser;
browser.fill('first_name', 'John');
browser.fill('last_name', 'Doe');
browser.fill('email', 'incorrect email');
browser.fill('message', 'Lorem ipsum');
browser.pressButton('Send').then(function() {
assert.ok(browser.success);
assert.equal(browser.text('h1'), 'Contact');
assert.equal(browser.text('div.alert'), 'Please check the email address format');
}).then(done, done);
});
it('should accept complete submissions', function(done) {
var browser = this.browser;
browser.fill('first_name', 'John');
browser.fill('last_name', 'Doe');
browser.fill('email', 'test@example.com');
browser.fill('message', 'Lorem ipsum');
browser.pressButton('Send').then(function() {
assert.ok(browser.success);
assert.equal(browser.text('h1'), 'Message Sent');
assert.equal(browser.text('p'), 'Thank you for your message. We\'ll answer you shortly.'');
}).then(done, done);
});
@robert-wallis

This comment has been minimized.

Copy link

commented Feb 10, 2016

The red highlighting is because the line ends with two single quote marks: ' '

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.