Skip to content

Commit

Permalink
fix(test): use proper controlFlow in protractor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kingcody committed Jul 23, 2015
1 parent f34e8f3 commit 8dce663
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
18 changes: 9 additions & 9 deletions app/templates/e2e/account(auth)/signup/signup.spec(jasmine).js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ describe('Signup View', function() {

describe('with local auth', function() {

it('should signup a new user, log them in, and redirecting to "/"', function(done) {
<% if (filters.mongooseModels) { %>UserModel.remove(function() {<% }
if (filters.sequelizeModels) { %>UserModel.destroy({ where: {} }).then(function() {<% } %>
page.signup(testUser);
beforeAll(function(done) {
<% if (filters.mongooseModels) { %>UserModel.removeAsync().then(done);<% }
if (filters.sequelizeModels) { %>UserModel.destroy({ where: {} }).then(done);<% } %>
});

var navbar = require('../../components/navbar/navbar.po');
it('should signup a new user, log them in, and redirecting to "/"', function() {
page.signup(testUser);

expect(browser.getLocationAbsUrl()).toBe(config.baseUrl + '/');
expect(navbar.navbarAccountGreeting.getText()).toBe('Hello ' + testUser.name);
var navbar = require('../../components/navbar/navbar.po');

done();
});
expect(browser.getLocationAbsUrl()).toBe(config.baseUrl + '/');
expect(navbar.navbarAccountGreeting.getText()).toBe('Hello ' + testUser.name);
});

it('should indicate signup failures', function() {
Expand Down
18 changes: 9 additions & 9 deletions app/templates/e2e/account(auth)/signup/signup.spec(mocha).js
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ describe('Signup View', function() {

describe('with local auth', function() {

it('should signup a new user, log them in, and redirecting to "/"', function(done) {
<% if (filters.mongooseModels) { %>UserModel.remove(function() {<% }
if (filters.sequelizeModels) { %>UserModel.destroy({ where: {} }).then(function() {<% } %>
page.signup(testUser);
before(function() {
<% if (filters.mongooseModels) { %>return UserModel.removeAsync();<% }
if (filters.sequelizeModels) { %>return UserModel.destroy({ where: {} });<% } %>
})

var navbar = require('../../components/navbar/navbar.po');
it('should signup a new user, log them in, and redirecting to "/"', function() {
page.signup(testUser);

<%= does("browser.getLocationAbsUrl()") %>.eventually.equal(config.baseUrl + '/');
<%= does("navbar.navbarAccountGreeting.getText()") %>.eventually.equal('Hello ' + testUser.name);
var navbar = require('../../components/navbar/navbar.po');

done();
});
<%= does("browser.getLocationAbsUrl()") %>.eventually.equal(config.baseUrl + '/');
<%= does("navbar.navbarAccountGreeting.getText()") %>.eventually.equal('Hello ' + testUser.name);
});

describe('and invalid credentials', function() {
Expand Down

0 comments on commit 8dce663

Please sign in to comment.