Skip to content

Instantly share code, notes, and snippets.

@dmackerman
Created July 8, 2014 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmackerman/f496020f158da30fa87c to your computer and use it in GitHub Desktop.
Save dmackerman/f496020f158da30fa87c to your computer and use it in GitHub Desktop.
describe('productizer.io : login & register', function() {
beforeEach(function () {
var productizer = require('../productizer.js');
productizer.get();
});
it('should allow user to successfully log in and out', function() {
productizer.login('dmackerman@gmail.com', 'ferrari0');
expect(productizer.pageHeader.getText()).toContain('Dashboard');
productizer.logout();
expect(productizer.loginContentArea.getText()).toContain('An Intraprenuers\' tool for Lean-a-fying the Enterprise');
});
it("should verify that the registration email & password field is a required field", function() {
expect(productizer.userEmailField.getAttribute('required')).toEqual('true');
expect(productizer.userPasswordField.getAttribute('required')).toEqual('true');
expect(productizer.userRegisterField.getAttribute('required')).toEqual('true');
expect(productizer.userRegisterPasswordField.getAttribute('required')).toEqual('true');
});
it("should show an error for an invalid login", function() {
productizer.login('dmackerman@gmail.com', 'foobar');
expect(productizer.loginErrorContainer.getText()).toBe(productizer.errorMessages.invalidLogin);
});
it("should not let a user register if they already registered", function() {
productizer.register('dmackerman@gmail.com', 'ferrari');
expect(productizer.loginErrorContainer.getText()).toBe(productizer.errorMessages.alreadyRegistered);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment