Created
July 28, 2015 14:04
-
-
Save sircharleswatson/922141a432ddd9309814 to your computer and use it in GitHub Desktop.
User Registration Tests
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
Feature: User Registration | |
As Impatient Ivan | |
I want to register an account as quickly as possible | |
So that I can start using the app | |
Background: | |
Given I am not logged in | |
@dev | |
Scenario: Create an account with valid credentials] | |
When I create an account with valid credentials | |
Then I should be logged in | |
And I should see a welcome message | |
@dev | |
Scenario: Create an account with invalid credentials | |
When I create an account with invalid credentials | |
Then I should receive an error message |
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
'use strict'; | |
module.exports = function () { | |
this.Given(/^I am not logged in$/, function (callback) { | |
return this.client.executeAsync(function (done) { | |
done(Meteor.userId()); | |
}, function (err, result) { | |
assert.equal(result, undefined); | |
callback(); | |
}); | |
}); | |
this.When(/^I create an account with valid credentials$/, function () { | |
return this.client | |
.waitForExist('#registrationEmail') | |
.waitForExist('#registrationPassword') | |
.setValue('#registrationEmail', 'ivan@impatient.com') | |
.setValue('#registrationPassword', 'hurryup') | |
.click('#register'); | |
}); | |
this.Then(/^I should be logged in$/, function (callback) { | |
return this.client.executeAsync(function (done) { | |
done(Meteor.user()); | |
}, function (err, result) { | |
assert.equal(result.emails[0], 'ivan@impatient.com'); | |
callback(); | |
}); | |
}); | |
this.Then(/^I should see a welcome message$/, function () { | |
return this.client | |
.waitForExist('#welcome') | |
.getText('#welcome').should.become('Welcome to TaskHero!'); | |
}); | |
this.When(/^I create an account with invalid credentials$/, function () { | |
return this.client | |
.waitForExist('#registrationEmail') | |
.waitForExist('#registrationPassword') | |
.setValue('#registrationEmail', 'impatientivan.com') | |
.setValue('#registrationPassword', 'hurry') | |
.click('#register'); | |
}); | |
this.Then(/^I should receive an error message$/, function () { | |
return this.client | |
.waitForExist('#error') | |
.getText('#error').should.become('You username/password were invalid'); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment