-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
getting all the test to pass and refactoring the test
- Loading branch information
Showing
12 changed files
with
238 additions
and
137 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
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 |
---|---|---|
|
@@ -146,6 +146,9 @@ | |
}, | ||
setUrl : function ( url ) { | ||
apiUrl = url; | ||
}, | ||
setUser : function ( _user ) { | ||
user = _user; | ||
} | ||
|
||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require('dotenv').load(); | ||
|
||
var _timeout = 50000, | ||
testUser = process.env.TEST_USER, | ||
testPassword = process.env.TEST_PASSWORD; | ||
|
||
module.exports = { | ||
'login' : function ( test ) { | ||
test | ||
.open('http://127.0.0.1:3030') | ||
.wait(2000) | ||
.click('.login-switch') | ||
.type('#email', testUser ) | ||
.type('#password', testPassword ) | ||
.click('[type="submit"]') | ||
.waitForElement('#io-dashboard > h2', _timeout) | ||
.assert.text('#io-dashboard > h2').is('Hello.') | ||
.done(); | ||
}, | ||
persistant : function ( test ) { | ||
test | ||
.open('http://127.0.0.1:3030') | ||
.waitForElement('#io-dashboard > h2', _timeout) | ||
.wait(2000) | ||
.assert.text('#io-dashboard > h2').is('Hello.') | ||
.done(); | ||
}, | ||
logout : function ( test ) { | ||
test | ||
.open('http://127.0.0.1:3030') | ||
.waitForElement('#io-dashboard > h2', _timeout) | ||
.wait(2000) | ||
.click('[data-view="login"]') | ||
.waitForElement('#password') | ||
.assert.text('.main > h2').is('Login') | ||
.done(); | ||
} | ||
} |
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,118 +1,15 @@ | ||
var _timeout = 50000; | ||
|
||
var _timeout = 50000, | ||
auth = require('./auth'); | ||
|
||
module.exports = { | ||
'signup flow works': function ( test ) { | ||
|
||
// good for now but there also should | ||
// be a cleanup script | ||
// and also test for errors in between | ||
test | ||
.open('http://127.0.0.1:3030') | ||
.waitForElement('#password') | ||
.wait(2000) | ||
.type('#email', 'temp' + ( Math.random() * 100000 ) + '@gmail.com') | ||
.type('#password', '123456') | ||
.click('[type="submit"]') | ||
.waitForElement('.pure-button.alert.submit-plan') | ||
.assert.visible('.pure-button.alert.submit-plan') | ||
.click('.plan-list > li >input[type="radio"]') | ||
.click('.submit-plan') | ||
.waitForElement('input[type="submit"]') | ||
.type('#card_number', '4242424242424242') | ||
.type('#cvc', '123') | ||
.type('#card_exp_month', '02') | ||
.type('#card_exp_year', '20') | ||
.click('input[type="submit"]') | ||
.waitForElement('.message', _timeout) | ||
.assert.text('.message') | ||
.is('Thanks for joining!', 'Successfully created new member account') | ||
.waitForElement('[data-view="login"]') | ||
.click('[data-view="login"]') | ||
.waitForElement('#password') | ||
.done(); | ||
}, | ||
'dashboard is working': function ( test ) { | ||
|
||
test | ||
.open('http://127.0.0.1:3030') | ||
.wait(2000) | ||
// login | ||
.click('.login-switch') | ||
.type('#email', '[email protected]') | ||
.type('#password', '123456') | ||
.click('[type="submit"]') | ||
.waitForElement('#io-dashboard > h2', _timeout) | ||
.assert.text('#io-dashboard > h2') | ||
.is('Hello.', 'Login Successfull') | ||
// donate | ||
.click('[data-view="donate"]') | ||
.waitForElement('#amount') | ||
.type('#amount', '1.00') | ||
.type('#card_number', '4242424242424242') | ||
.type('#cvc', '123') | ||
.type('#card_exp_month', '02') | ||
.type('#card_exp_year', '20') | ||
.click('[type="submit"]') | ||
.waitForElement('.message', _timeout) | ||
.assert.text('.message') | ||
.is('Thanks! You have been charged $1.00') | ||
// create a event | ||
.click('[data-view="createevent"]') | ||
.waitForElement('#date') | ||
.click('#date') | ||
.waitForElement('.pika-single') | ||
.assert.visible('.pika-single', 'Calendar opened') | ||
//random number of clicks / 12 | ||
.click('.pika-next') | ||
.click('.pika-next') | ||
.click('.pika-next') | ||
// random day / 28 | ||
.click('[data-day="15"] > button') | ||
.type('#title', 'Hello World') | ||
.type('#description', 'Woot woot!') | ||
.click('[type="submit"]') | ||
.waitForElement('.message', _timeout) | ||
.assert.text('.message') | ||
.is('Your Event \'Hello World\' has been created!' + | ||
' We will email you if there are any issues with the event.') | ||
// make a payment | ||
.click('[data-view="payment"]') | ||
.waitForElement('#amount') | ||
.type('#amount', '1.00') | ||
.type('#card_number', '4242424242424242') | ||
.type('#cvc', '123') | ||
.type('#card_exp_month', '02') | ||
.type('#card_exp_year', '20') | ||
.click('[type="submit"]') | ||
.waitForElement('.message', _timeout) | ||
.assert.text('.message') | ||
.is('Thanks! You have been charged $1.00') | ||
// update plan | ||
.click('[data-view="updateplan"]') | ||
.waitForElement('.pure-button.alert.submit-plan') | ||
.click('.plan-list > li >input[type="radio"]') | ||
.click('.submit-plan') | ||
.waitForElement('.message', _timeout) | ||
.assert.text('.message') | ||
.is('Your plan has been updated.') | ||
// update card | ||
.click('[data-view="updatepayment"]') | ||
.waitForElement('#card_number') | ||
.type('#card_number', '4242424242424242') | ||
.type('#cvc', '123') | ||
.type('#card_exp_month', '02') | ||
.type('#card_exp_year', '20') | ||
.click('[type="submit"]') | ||
.waitForElement('.message', _timeout) | ||
.assert.text('.message') | ||
.is('Payment Successfully Updated') | ||
//cancel plan | ||
.click('[data-view="cancelplan"]') | ||
.waitForElement('.yes-plan') | ||
.click('.yes-plan') | ||
.waitForElement('.message', _timeout) | ||
.assert.text('.message') | ||
.is('Sorry to see you go') | ||
.done(); | ||
} | ||
'signup flow': require('./views/signup'), | ||
'signup user logout' : auth.logout, | ||
'login' : auth.login, | ||
'login is persistant' : auth.persistant, | ||
'donating' : require('./views/donate'), | ||
'creating an event' : require('./views/createevent'), | ||
'making a payment' : require('./views/payment'), | ||
'updating plan' : require('./views/updateplan'), | ||
'canceling plan' : require('./views/cancelplan'), | ||
'logout' : auth.logout | ||
}; |
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,15 @@ | ||
var _timeout = 50000; | ||
|
||
module.exports = function ( test ) { | ||
test | ||
.open('http://127.0.0.1:3030') | ||
.waitForElement('#io-dashboard > h2') | ||
.wait(2000) | ||
.click('[data-view="cancelplan"]') | ||
.waitForElement('.yes-plan') | ||
.click('.yes-plan') | ||
.waitForElement('.message', _timeout) | ||
.assert.text('.message') | ||
.is('Sorry to see you go') | ||
.done() | ||
} |
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,46 @@ | ||
var _timeout = 50000, | ||
// starts on current month | ||
// + 1 to alway go forawrd at least once | ||
// 9 to limit range to ( 9 + 1 ) 10 so we dont hit | ||
// the current month next year "only some dates are avail" | ||
month = Math.round( (Math.random() * 9) + 1 ), | ||
day = Math.round( (Math.random() * 27) + 1 ); | ||
|
||
function randomDate ( test ) { | ||
test.randomDate = function ( ) { | ||
var _test = this; | ||
for( var i = 0; i <= month; i += 1 ){ | ||
_test = _test.click('.pika-next'); | ||
} | ||
return _test.click('[data-day="' + day + '"] > button'); | ||
} | ||
} | ||
|
||
module.exports = function ( test ) { | ||
// extend test object | ||
randomDate( test ); | ||
|
||
test | ||
.open('http://127.0.0.1:3030') | ||
.waitForElement('#io-dashboard > h2') | ||
.wait(2000) | ||
.click('[data-view="createevent"]') | ||
.waitForElement('#date') | ||
//random number of clicks / 12 | ||
.type('#start','7:00 AM') | ||
.type('#end','8:00 AM') | ||
.type('#title', 'Hello World') | ||
.type('#description', 'Woot woot!') | ||
.click('#date') | ||
.waitForElement('.pika-single') | ||
.assert.visible('.pika-single', 'Calendar opened') | ||
.randomDate() | ||
// .click('body') | ||
.click('[type="submit"]') | ||
.waitForElement('.message', _timeout) | ||
.assert.text('.message') | ||
.is('Your Event \'Hello World\' has been created!' + | ||
' We will email you if there are any issues with the event.', | ||
'Correct Message Shown') | ||
.done() | ||
} |
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,20 @@ | ||
var _timeout = 50000; | ||
|
||
module.exports = function ( test ) { | ||
test | ||
.open('http://127.0.0.1:3030') | ||
.waitForElement('#io-dashboard > h2') | ||
.wait(2000) | ||
.click('[data-view="donate"]') | ||
.waitForElement('#amount') | ||
.type('#amount', '1.00') | ||
.type('#card_number', '4242424242424242') | ||
.type('#cvc', '123') | ||
.type('#card_exp_month', '02') | ||
.type('#card_exp_year', '20') | ||
.click('[type="submit"]') | ||
.waitForElement('.message', _timeout) | ||
.assert.text('.message') | ||
.is('Thanks! You have been charged $1.00') | ||
.done() | ||
} |
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,20 @@ | ||
var _timeout = 50000; | ||
|
||
module.exports = function ( test ) { | ||
test | ||
.open('http://127.0.0.1:3030') | ||
.waitForElement('#io-dashboard > h2') | ||
.wait(2000) | ||
.click('[data-view="payment"]') | ||
.waitForElement('#amount') | ||
.type('#amount', '1.00') | ||
.type('#card_number', '4242424242424242') | ||
.type('#cvc', '123') | ||
.type('#card_exp_month', '02') | ||
.type('#card_exp_year', '20') | ||
.click('[type="submit"]') | ||
.waitForElement('.message', _timeout) | ||
.assert.text('.message') | ||
.is('Thanks! You have been charged $1.00') | ||
.done() | ||
} |
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,28 @@ | ||
var _timeout = 50000; | ||
|
||
module.exports = function ( test ) { | ||
// good for now but there also should | ||
// be a cleanup script | ||
// and also test for errors in between | ||
test | ||
.open('http://127.0.0.1:3030') | ||
.waitForElement('#password') | ||
.wait(2000) | ||
.type('#email', 'temp' + ( Math.random() * 100000 ) + '@gmail.com') | ||
.type('#password', '123456') | ||
.click('[type="submit"]') | ||
.waitForElement('.pure-button.alert.submit-plan') | ||
.assert.visible('.pure-button.alert.submit-plan') | ||
.click('.plan-list > li >input[type="radio"]') | ||
.click('.submit-plan') | ||
.waitForElement('input[type="submit"]') | ||
.type('#card_number', '4242424242424242') | ||
.type('#cvc', '123') | ||
.type('#card_exp_month', '02') | ||
.type('#card_exp_year', '20') | ||
.click('input[type="submit"]') | ||
.waitForElement('.message', _timeout) | ||
.assert.text('.message') | ||
.is('Thanks for joining!', 'Successfully created new member account') | ||
.done(); | ||
} |
Oops, something went wrong.