Commit 11ba9bae authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg

Implement full login flow

parent 5f326317
......@@ -25,6 +25,7 @@ exports.config = {
framework: 'mocha',
mochaOpts: {
ui: 'bdd'
ui: 'bdd',
timeout: 120000
}
}
......@@ -1150,6 +1150,14 @@
"tweetnacl": "0.14.5"
}
},
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"requires": {
"safe-buffer": "5.1.1"
}
},
"string-width": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
......@@ -1159,14 +1167,6 @@
"strip-ansi": "4.0.0"
}
},
"string_decoder": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
"requires": {
"safe-buffer": "5.1.1"
}
},
"stringstream": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz",
......
var assert = require('assert');
var oauthserver = {
inputAuthorization: "https://authengine.paas2.uninett.no/oauth/authorization",
inputToken: "https://authengine.paas2.uninett.no/oauth/token",
inputUserinfo: "https://authengine.paas2.uninett.no/openid/userinfo",
inputClientid: "fbc138bb-432d-4c0c-b4b2-ef10aaa02db2"
var settings = {
oauthserver: {
inputAuthorization: "https://authengine.paas2.uninett.no/oauth/authorization",
inputToken: "https://authengine.paas2.uninett.no/oauth/token",
inputUserinfo: "https://authengine.paas2.uninett.no/openid/userinfo",
inputClientid: "fbc138bb-432d-4c0c-b4b2-ef10aaa02db2"
},
users: {
"test": {
"username": "asbjorn_elevg",
"password": "1qaz"
}
}
}
......@@ -14,8 +22,8 @@ describe('Prepare play.oauth.no', function() {
browser
.url('https://play.oauth.no/')
.click('a=OAuth Server Configuration')
for (var key in oauthserver) {
browser.setValue('[id=' + key + ']', oauthserver[key])
for (var key in settings.oauthserver) {
browser.setValue('[id=' + key + ']', settings.oauthserver[key])
}
browser.click('#btnAuthenticate')
.waitUntil(function() {
......@@ -27,6 +35,88 @@ describe('Prepare play.oauth.no', function() {
browser.screenshot();
console.log("TITLE IS ", browser.getTitle())
browser.setValue('[id=usersearch]', 'UNIN')
browser.click('a=Bokmål')
browser.waitForText('p=Feide testbrukere', 3000);
browser.click('p=Feide testbrukere')
browser.waitUntil(function() {
return (browser.getUrl().indexOf('/simplesaml/module.php/feide') > -1)
}, 5000);
browser.screenshot()
browser
.setValue('[id=username]', settings.users.test.username)
.setValue('[id=password]', settings.users.test.password)
.click('input.submit')
browser.waitUntil(function() {
return (browser.getUrl().indexOf('/simplesaml/module.php/preprodwarning/showwarning.php') > -1)
}, 5000);
browser
.click('#yesbutton')
var processTermsOfUse = false
browser.waitUntil(function() {
if (browser.getTitle() === 'Authorization Required') {
processTermsOfUse = true
return true
}
return (browser.getUrl().indexOf('play.oauth.no') > -1)
}, 5000)
if (processTermsOfUse) {
browser
.click('a=Dataportens personvernerklæring')
browser
.waitForVisible('button=Lukk')
browser
.screenshot()
.click('button=Lukk')
browser
.waitForVisible('#bruksvilkar')
browser
.click('#bruksvilkar')
browser
.waitForVisible('#submit')
browser
.screenshot()
browser
.click('#submit')
}
browser.waitUntil(function() {
return (browser.getUrl().indexOf('play.oauth.no') > -1)
}, 5000)
browser.pause(2000)
browser.screenshot()
browser.waitUntil(function() {
return (browser.getUrl().indexOf('play.oauth.no') > -1)
}, 5000)
browser.scroll('div.footer-uninett')
if (!browser.waitForExist('a=Access Token')) {
throw new Error("Could not find access token after authentication.")
}
browser.click('#btnWipe')
browser.pause(800)
browser.click('#btnAuthenticate')
.waitUntil(function() {
// console.log("Browser URL ", browser.getUrl())
return (browser.getUrl().indexOf('/accountchooser') > -1)
}, 5000);
browser.screenshot()
// browser.end()
// assert(browser.getTitle().match(/BrowserStack - Google Search/i));
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment