Skip to content
This repository
Browse code

Port password login tests to satisfy

  • Loading branch information...
commit bf458a822fe1d5c808a8e7e86109718dbb79a36f 1 parent 4439e54
Brian Noguchi authored

Showing 1 changed file with 47 additions and 51 deletions. Show diff stats Hide diff stats

  1. +47 51 test/password.satisfy.js
98 test/password.satisfy.js
@@ -71,55 +71,51 @@ describe('password', function () {
71 71 });
72 72 });
73 73
74   -// describe('login', function () {
75   -// it('should succeed with the right email + password', function (done) {
76   -// browser.get('/login', function (res, $) {
77   -// $('form')
78   -// .fill({ email: 'brian@example.com', password: 'password' })
79   -// .submit( function (res, $) {
80   -// expect(res).to.have.status(200);
81   -// expect($('h2')).to.have.text('Authenticated');
82   -// expect($('h2')).to.not.have.text('Not Authenticated');
83   -// done();
84   -// });
85   -// });
86   -// });
87   -//
88   -// describe('failing', function () {
89   -// it('should fail with the wrong password', function (done) {
90   -// browser.get('/login', function (res, $) {
91   -// $('form')
92   -// .fill({ email: 'brian@example.com', password: 'wrongpassword' })
93   -// .submit( function (res, $) {
94   -// expect(res).to.have.status(200);
95   -// expect($('#errors')).to.have.text('Login failed');
96   -// done();
97   -// });
98   -// });
99   -// });
100   -//
101   -// it('should fail with an empty password', function (done) {
102   -// browser.get('/login', function (res, $) {
103   -// $('form')
104   -// .fill({ email: 'brian@example.com', password: '' })
105   -// .submit( function (res, $) {
106   -// expect($('#errors')).to.have.text('Missing password');
107   -// done();
108   -// });
109   -// });
110   -// });
111   -//
112   -// it('should fail with no email, no password', function (done) {
113   -// browser.get('/login', function (res, $) {
114   -// $('form')
115   -// .fill({ email: '', password: '' })
116   -// .submit( function (res, $) {
117   -// expect($('#errors li:first')).to.have.text('Missing login');
118   -// expect($('#errors li:eq(1)')).to.have.text('Missing password');
119   -// done();
120   -// });
121   -// });
122   -// });
123   -// });
124   -// });
  74 + describe('login', function () {
  75 + var loginUrl = 'http://localhost:3000/login';
  76 +
  77 + it('should succeed with the right email + password', function (done) {
  78 + satisfy(loginUrl)
  79 + .fill({ email: 'brian@example.com', password: 'password' })
  80 + .submit()
  81 +
  82 + .expect('h2').to.have.text('Authenticated')
  83 + .expect('h2').to.not.have.text('Not Authenticated')
  84 +
  85 + .run(done);
  86 + });
  87 +
  88 + describe('failing', function () {
  89 + it('should fail with the wrong password', function (done) {
  90 + satisfy(loginUrl)
  91 + .fill({ email: 'brian@example.com', password: 'wrongpassword' })
  92 + .submit()
  93 +
  94 + .expect('#errors').to.have.text('Login failed')
  95 +
  96 + .run(done);
  97 + });
  98 +
  99 + it('should fail with an empty password', function (done) {
  100 + satisfy(loginUrl)
  101 + .fill({ email: 'brian@example.com', password: '' })
  102 + .submit()
  103 +
  104 + .expect('#errors').to.have.text('Missing password')
  105 +
  106 + .run(done);
  107 + });
  108 +
  109 + it('should fail with no email, no password', function (done) {
  110 + satisfy(loginUrl)
  111 + .fill({ email: '', password: '' })
  112 + .submit()
  113 +
  114 + .expect('#errors li:first').to.have.text('Missing login')
  115 + .expect('#errors li:eq(1)').to.have.text('Missing password')
  116 +
  117 + .run(done);
  118 + });
  119 + });
  120 + });
125 121 });

0 comments on commit bf458a8

Please sign in to comment.
Something went wrong with that request. Please try again.