Commit f92b5171 authored by Andreas Åkre Solberg's avatar Andreas Åkre Solberg

Removed test specs, and now only contain one spec config and ruleset.

parent 05e6a786
const moment = require('moment');
var ts = moment().format('YYYY-MM-DD HH:mm')
exports.config = {
user: process.env.BROWSERSTACK_USERNAME || 'BROWSERSTACK_USERNAME',
key: process.env.BROWSERSTACK_ACCESS_KEY || 'BROWSERSTACK_ACCESS_KEY',
updateJob: true,
specs: [
'./tests/specs/dataporten-test.js'
],
exclude: [],
commonCapabilities: {
build: 'Development play.oauth.no Dataporten UI Test',
"browserstack.debug": true,
name: 'Dataporten UI Test',
},
capabilities: [
{
os: "WINDOWS", os_version: "10",
browser: "chrome",
browser_version: "62"
},
// {
// os: "WINDOWS", os_version: "10",
// browser: "firefox",
// browser_version: "57"
// },
// {
// os: "WINDOWS", os_version: "7",
// browser: "chrome",
// browser_version: "20"
// },
// {
// os: "WINDOWS", os_version: "7",
// browser: "IE",
// browser_version: "9"
// },
// {
// os: "WINDOWS", os_version: "7",
// browser: "IE",
// browser_version: "8"
// }, // PROBLEMS
// {
// os: "WINDOWS", os_version: "7",
// browser: "firefox",
// browser_version: "3.6"
// }, // Problems SyntaxError: invalid range in character class
// {
// os: "WINDOWS", os_version: "7",
// browser: "firefox",
// browser_version: "50"
// }, // PROBLEMS SyntaxError: invalid range in character class
// {
// os: "OS X", os_version: "Sierra",
// browser: "safari",
// browser_version: "10"
// },
// {
// os: "OS X", os_version: "Snow Leopard",
// browser: "safari",
// browser_version: "5.1"
// },
],
logLevel: 'silent', // verbose
coloredLogs: true,
screenshotPath: './errorShots/',
baseUrl: '',
waitforTimeout: 5000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 35000
}
}
// Code to support common capabilities
exports.config.capabilities.forEach(function(caps){
for(var i in exports.config.commonCapabilities) caps[i] = caps[i] || exports.config.commonCapabilities[i];
caps.name = exports.config.commonCapabilities.name + ' ' + ts
});
......@@ -8,49 +8,59 @@ exports.config = {
user: process.env.BROWSERSTACK_USERNAME || 'BROWSERSTACK_USERNAME',
key: process.env.BROWSERSTACK_ACCESS_KEY || 'BROWSERSTACK_ACCESS_KEY',
updateJob: false,
updateJob: true,
specs: [
'./tests/specs/dataporten.js'
'./tests/specs/dataporten-test.js'
],
exclude: [],
commonCapabilities: {
build: 'Prototyping play.oauth.no Dataporten Auth Engine testing',
build: 'Development play.oauth.no Dataporten UI Test',
"browserstack.debug": true,
name: 'Dataporten UI Test',
},
capabilities: [
// {
// os: "WINDOWS", os_version: "10",
// browser: "chrome",
// browser_version: "62"
// },
{
os: "WINDOWS", os_version: "10",
browser: "chrome",
browser_version: "62"
},
// {
// os: "WINDOWS", os_version: "10",
// browser: "firefox",
// browser_version: "57"
// },
// {
// os: "WINDOWS", os_version: "10",
// os: "WINDOWS", os_version: "7",
// browser: "chrome",
// browser_version: "14"
// browser_version: "20"
// },
// {
// os: "WINDOWS", os_version: "7",
// browser: "IE",
// browser_version: "8"
// browser_version: "9"
// },
// {
// os: "WINDOWS", os_version: "7",
// browser: "IE",
// browser_version: "8"
// }, // PROBLEMS
// {
// os: "WINDOWS", os_version: "7",
// browser: "firefox",
// browser_version: "3.6"
// }, // Problems SyntaxError: invalid range in character class
// {
// os: "WINDOWS", os_version: "7",
// browser: "firefox",
// browser_version: "50"
// }, // PROBLEMS SyntaxError: invalid range in character class
// {
// os: "OS X", os_version: "Sierra",
// browser: "safari",
// browser_version: "10"
// },
{
os: "OS X", os_version: "Sierra",
browser: "safari",
browser_version: "10"
},
// {
// os: "OS X", os_version: "Snow Leopard",
// browser: "safari",
......@@ -58,18 +68,18 @@ exports.config = {
// },
],
logLevel: 'verbose',
logLevel: 'silent', // verbose
coloredLogs: true,
screenshotPath: './errorShots/',
baseUrl: '',
waitforTimeout: 15000,
waitforTimeout: 5000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 120000
timeout: 35000
}
}
......
var Launcher = require('webdriverio').Launcher
const opts = {
configFile: __dirname + "/conf/dataporten-test.conf.js"
configFile: __dirname + "/conf/dataporten.conf.js"
}
var wdio = new Launcher(opts.configFile, opts)
wdio.run().then(function (code) {
......
var assert = require('assert');
var Dataporten = require('../../lib/Dataporten')
var BrowserStack = require('../../lib/BrowserStack').BrowserStack
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"
},
"test2": {
"username": "bjorg_laererg",
"password": "2wsx"
}
}
}
var dp = new Dataporten.Session(browser)
let page
describe('Login for the first time', function() {
it('initiate authentication', function () {
page = dp.auth()
assert(page instanceof Dataporten.DiscoveryPage, 'Expected the discovery page first time when authenticating')
});
it('set language', function () {
page = page.setLang()
});
it('incremental search UNINETT', function () {
page = page.search('UNIN')
});
it('Select testusers on the discovery page', function () {
page = page.select('Feide testbrukere')
assert(page instanceof Dataporten.LoginPage, 'Expected Feide login page after discovery')
});
it('Authenticate with a test user on the login page', function () {
page = page.login(settings.users.test.username, settings.users.test.password)
console.log(" ==============> Step 6 After authentication")
page.debug()
if (page instanceof Dataporten.PreProdWarningPage) {
page = page.skip()
console.log(" ==============> Step 7 PreProdWarningPage")
page.debug()
}
if (page instanceof Dataporten.AuthorizationPage) {
page = page.acceptTermsOfUse()
console.log(" ==============> Step 8 AuthorizationPage")
page.debug()
}
assert(page instanceof Dataporten.CompletedPage, 'Expected returned after successfull authz')
page = dp.auth()
assert(page instanceof Dataporten.DiscoveryPage, 'Expected the discovery page second time when authenticating')
console.log(" ==============> Step 8 Authenticateion second time")
page.debug()
page = page.selectOther()
page = page.selectOtherTestuser()
console.log(" ==============> Step 9 Selecting other")
page.debug()
assert(page instanceof Dataporten.LoginPage, 'Expected Feide login page after discovery')
page = page.login(settings.users.test2.username, settings.users.test2.password)
if (page instanceof Dataporten.PreProdWarningPage) {
page = page.skip()
console.log(" ==============> Step 7 PreProdWarningPage")
page.debug()
}
if (page instanceof Dataporten.AuthorizationPage) {
page = page.acceptTermsOfUse()
console.log(" ==============> Step 8 AuthorizationPage")
page.debug()
}
page = dp.auth()
assert(page instanceof Dataporten.DiscoveryPage, 'Expected the discovery page third time when authenticating')
page.debug()
});
});
BrowserStack.reportStatus(browser.requestHandler.sessionID, "error", "Problems yay")
console.log("---- sessionid")
console.log(browser.requestHandler.sessionID)
console.log("----- -----")
var assert = require('assert');
var Dataporten = require('../../../lib/Dataporten')
var Dataporten = require('../../lib/Dataporten')
var BrowserStack = require('../../lib/BrowserStack').BrowserStack
var settings = {
oauthserver: {
......@@ -12,118 +13,88 @@ var settings = {
"test": {
"username": "asbjorn_elevg",
"password": "1qaz"
},
"test2": {
"username": "bjorg_laererg",
"password": "2wsx"
}
}
}
describe('Prepare play.oauth.no', function() {
it('can find search results', function () {
browser
.url('https://play.oauth.no/')
.waitForExist('a=OAuth Server Configuration')
browser
.click('a=OAuth Server Configuration')
browser.waitForVisible('#inputUserinfo')
for (var key in settings.oauthserver) {
browser.setValue('[id=' + key + ']', settings.oauthserver[key])
}
browser.click('#btnAuthenticate')
.waitUntil(function() {
// console.log("Browser URL ", browser.getUrl())
return (browser.getUrl().indexOf('/accountchooser') > -1)
}, 5000);
// browser.pause(2000);
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')
}
var dp = new Dataporten.Session(browser)
browser.waitUntil(function() {
return (browser.getUrl().indexOf('play.oauth.no') > -1)
}, 5000)
browser.pause(2000)
let page
browser.screenshot()
describe('Login for the first time', function() {
it('initiate authentication', function () {
page = dp.auth()
assert(page instanceof Dataporten.DiscoveryPage, 'Expected the discovery page first time when authenticating')
browser.waitUntil(function() {
return (browser.getUrl().indexOf('play.oauth.no') > -1)
}, 5000)
});
it('set language', function () {
page = page.setLang()
browser.scroll('div.footer-uninett')
});
it('incremental search UNINETT', function () {
page = page.search('UNIN')
if (!browser.waitForExist('a=Access Token')) {
throw new Error("Could not find access token after authentication.")
});
it('Select testusers on the discovery page', function () {
page = page.select('Feide testbrukere')
assert(page instanceof Dataporten.LoginPage, 'Expected Feide login page after discovery')
});
it('Authenticate with a test user on the login page', function () {
page = page.login(settings.users.test.username, settings.users.test.password)
console.log(" ==============> Step 6 After authentication")
page.debug()
if (page instanceof Dataporten.PreProdWarningPage) {
page = page.skip()
console.log(" ==============> Step 7 PreProdWarningPage")
page.debug()
}
if (page instanceof Dataporten.AuthorizationPage) {
page = page.acceptTermsOfUse()
console.log(" ==============> Step 8 AuthorizationPage")
page.debug()
}
browser.click('#btnWipe')
browser.pause(800)
browser.click('#btnAuthenticate')
.waitUntil(function() {
// console.log("Browser URL ", browser.getUrl())
return (browser.getUrl().indexOf('/accountchooser') > -1)
}, 5000);
assert(page instanceof Dataporten.CompletedPage, 'Expected returned after successfull authz')
page = dp.auth()
assert(page instanceof Dataporten.DiscoveryPage, 'Expected the discovery page second time when authenticating')
console.log(" ==============> Step 8 Authenticateion second time")
page.debug()
page = page.selectOther()
page = page.selectOtherTestuser()
console.log(" ==============> Step 9 Selecting other")
page.debug()
assert(page instanceof Dataporten.LoginPage, 'Expected Feide login page after discovery')
page = page.login(settings.users.test2.username, settings.users.test2.password)
if (page instanceof Dataporten.PreProdWarningPage) {
page = page.skip()
console.log(" ==============> Step 7 PreProdWarningPage")
page.debug()
}
if (page instanceof Dataporten.AuthorizationPage) {
page = page.acceptTermsOfUse()
console.log(" ==============> Step 8 AuthorizationPage")
page.debug()
}
page = dp.auth()
assert(page instanceof Dataporten.DiscoveryPage, 'Expected the discovery page third time when authenticating')
page.debug()
browser.screenshot()
// browser.end()
// assert(browser.getTitle().match(/BrowserStack - Google Search/i));
});
});
BrowserStack.reportStatus(browser.requestHandler.sessionID, "error", "Problems yay")
console.log("---- sessionid")
console.log(browser.requestHandler.sessionID)
console.log("----- -----")
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