Forked from fzaninotto/gist:43f420d082d0884c94d9
Last active
December 11, 2017 15:55
-
-
Save vukanac/190a339305313699cad9d3985cbbcf18 to your computer and use it in GitHub Desktop.
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
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', '[email protected]'); | |
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); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment