|
/*jshint node:true */ |
|
|
|
"use strict"; |
|
|
|
var account = require("./lib/account.js"); |
|
|
|
module.exports = { |
|
"Redirects to /login" : function(test) { |
|
test |
|
.open("http://account.local.ncplatform.net:8888") |
|
.assert |
|
.url().is("http://account.local.ncplatform.net:8888/login") |
|
.done(); |
|
}, |
|
|
|
"Login form appears" : function(test) { |
|
test |
|
.open("http://account.local.ncplatform.net:8888/login") |
|
.assert.chain() |
|
.exists("#email") |
|
.exists("#password") |
|
.exists("button[type='submit']") |
|
.end() |
|
.done(); |
|
}, |
|
|
|
"Simple login" : function(test) { |
|
account.create(function(details) { |
|
test |
|
.open("http://account.local.ncplatform.net:8888/login") |
|
.type("#email", details.email) |
|
.type("#password", details.password) |
|
.submit(".login-panel") |
|
.assert |
|
.url().is("http://account.local.ncplatform.net:8888/account/download") |
|
.open("http://account.local.ncplatform.net:8888/logout") |
|
.done(); |
|
}); |
|
}, |
|
|
|
"Login with a redirect" : function(test) { |
|
account.create(function(details) { |
|
test |
|
.open("http://account.local.ncplatform.net:8888/login?redirect_uri=/account/security") |
|
.type("#email", details.email) |
|
.type("#password", details.password) |
|
.submit(".login-panel") |
|
.assert |
|
.url().is("http://account.local.ncplatform.net:8888/account/security") |
|
.open("http://account.local.ncplatform.net:8888/logout") |
|
.done(); |
|
|
|
}); |
|
}, |
|
|
|
"IP Whitelisting" : function(test) { |
|
account.create("12.12.12.12", function(details) { |
|
test |
|
.open("http://account.local.ncplatform.net:8888/login?redirect_uri=/account/security/email") |
|
.type("#email", details.email) |
|
.type("#password", details.password) |
|
.submit(".login-panel") |
|
.submit(".auth2f.email > form") |
|
.assert |
|
.url().is("http://account.local.ncplatform.net:8888/account/security/email/done") |
|
.open("http://account.local.ncplatform.net:8888/logout") |
|
.open("http://account.local.ncplatform.net:8888/login") |
|
.type("#email", details.email) |
|
.type("#password", details.password) |
|
.submit(".login-panel") |
|
.assert.chain() |
|
.url().is("http://account.local.ncplatform.net:8888/login/wait?type=email&redirect_uri=%2Faccount%2Fdownload") |
|
.exists(".login_auth2f_email-page") |
|
.end() |
|
.done(); |
|
}); |
|
} |
|
}; |
I also fought with DalekJS for a bit over dalekjs/dalek#1, which combined with the
0.0.1
version should give anybody thinking of whole-heartedly switching at least a bit of pause.