-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes: - add prompt for Jasmine or Mocha - if Mocha choosen, prompt for Expect or Should - use `<%= does() %>` to dynamically insert assertions (expect|should) - add mocha variants for protractor tests - add mocha options to protractor.conf - remove `test/fixtures/(bower|package).json` from repo - move runE2E functionality to runTest and simplify switch - comment generator test functions - use node `0.11.13` in travis due to issues with `0.11.14`+ Note: Server-side jasmine test are needed to fully unify testing frameworks. Once Jasmine tests are included for server, mocha dep can be removed fully when selecting Jasmine.
- Loading branch information
Showing
20 changed files
with
438 additions
and
216 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
language: node_js | ||
node_js: | ||
- '0.10' | ||
- '0.11' | ||
- '0.11.13' | ||
env: | ||
global: | ||
- SAUCE_USERNAME=fullstack_ci | ||
|
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
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
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
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
File renamed without changes.
73 changes: 73 additions & 0 deletions
73
app/templates/e2e/account(auth)/login/login.spec(mocha).js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict'; | ||
|
||
var config = protractor.getInstance().params; | ||
var UserModel = require(config.serverConfig.root + '/server/api/user/user.model'); | ||
|
||
describe('Login View', function() { | ||
var page; | ||
|
||
var loadPage = function() { | ||
browser.get('/login'); | ||
page = require('./login.po'); | ||
}; | ||
|
||
var testUser = { | ||
name: 'Test User', | ||
email: '[email protected]', | ||
password: 'test' | ||
}; | ||
|
||
before(function() { | ||
return UserModel | ||
.removeAsync() | ||
.then(function() { | ||
return UserModel.createAsync(testUser); | ||
}) | ||
.then(loadPage); | ||
}); | ||
|
||
after(function() { | ||
return UserModel.removeAsync(); | ||
}); | ||
|
||
it('should include login form with correct inputs and submit button', function() { | ||
<%= does("page.form.email.getAttribute('type')") %>.eventually.equal('email'); | ||
<%= does("page.form.email.getAttribute('name')") %>.eventually.equal('email'); | ||
<%= does("page.form.password.getAttribute('type')") %>.eventually.equal('password'); | ||
<%= does("page.form.password.getAttribute('name')") %>.eventually.equal('password'); | ||
<%= does("page.form.submit.getAttribute('type')") %>.eventually.equal('submit'); | ||
<%= does("page.form.submit.getText()") %>.eventually.equal('Login'); | ||
}); | ||
|
||
describe('with local auth', function() { | ||
|
||
it('should login a user and redirecting to "/"', function() { | ||
page.login(testUser); | ||
|
||
var navbar = require('../../components/navbar/navbar.po'); | ||
|
||
<%= does("browser.getLocationAbsUrl()") %>.eventually.equal(config.baseUrl + '/'); | ||
<%= does("navbar.navbarAccountGreeting.getText()") %>.eventually.equal('Hello ' + testUser.name); | ||
}); | ||
|
||
describe('and invalid credentials', function() { | ||
before(function() { | ||
return loadPage(); | ||
}) | ||
|
||
it('should indicate login failures', function() { | ||
page.login({ | ||
email: testUser.email, | ||
password: 'badPassword' | ||
}); | ||
|
||
<%= does("browser.getLocationAbsUrl()") %>.eventually.equal(config.baseUrl + '/login'); | ||
|
||
var helpBlock = page.form.element(by.css('.form-group.has-error .help-block.ng-binding')); | ||
<%= does("helpBlock.getText()") %>.eventually.equal('This password is not correct.'); | ||
}); | ||
|
||
}); | ||
|
||
}); | ||
}); |
File renamed without changes.
Oops, something went wrong.