private-event-sourcing-examples-46 Write a single, simple protractor test + Sign Up & Login + [WIP] (errors on auth)

This commit is contained in:
Andrew Revinsky (DART)
2016-09-26 20:27:31 +03:00
parent f740098f5c
commit 29cfdb0abf
12 changed files with 86 additions and 27 deletions

View File

@@ -2568,7 +2568,12 @@ webpackJsonp([0,3],{
* Created by andrew on 26/02/16.
*/
function parseResponse(response) {
var json = response.json();
var json = response.json().catch(function (err) {
if (err.toString().indexOf('SyntaxError: Unexpected end of JSON input') >= 0) {
return Promise.resolve({});
}
throw err;
});
if (response.status >= 200 && response.status < 300) {
return json;
} else {
@@ -7149,4 +7154,4 @@ webpackJsonp([0,3],{
/***/ }
});
//# sourceMappingURL=app.49212d324ec7c7726785.js.map
//# sourceMappingURL=app.3441ac93c60d32b5b228.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -13,7 +13,7 @@
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css"><link href="/style.b588c60da106277d78c8.css" rel="stylesheet"></head>
<body><div id="root"></div><script src="/manifest.b9df2a8cd9e9c60ecbfa.js"></script><script src="/vendor.85781b28c9410377534e.js"></script><script src="/style.b588c60da106277d78c8.js"></script><script src="/app.49212d324ec7c7726785.js"></script><script>
<body><div id="root"></div><script src="/manifest.6cefa3c1211f2dfff0d6.js"></script><script src="/vendor.85781b28c9410377534e.js"></script><script src="/style.b588c60da106277d78c8.js"></script><script src="/app.3441ac93c60d32b5b228.js"></script><script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
@@ -27,5 +27,5 @@
ga('send', 'pageview');
</script><!--{"files":{"publicPath":"/","chunks":{"manifest":{"size":0,"entry":"/manifest.b9df2a8cd9e9c60ecbfa.js","hash":"b9df2a8cd9e9c60ecbfa","css":[]},"vendor":{"size":1654379,"entry":"/vendor.85781b28c9410377534e.js","hash":"85781b28c9410377534e","css":[]},"style":{"size":122,"entry":"/style.b588c60da106277d78c8.js","hash":"b588c60da106277d78c8","css":["/style.b588c60da106277d78c8.css"]},"app":{"size":350661,"entry":"/app.49212d324ec7c7726785.js","hash":"49212d324ec7c7726785","css":[]}},"js":["/manifest.b9df2a8cd9e9c60ecbfa.js","/vendor.85781b28c9410377534e.js","/style.b588c60da106277d78c8.js","/app.49212d324ec7c7726785.js"],"css":["/style.b588c60da106277d78c8.css"]},"options":{"template":"/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/html-webpack-plugin/lib/loader.js!/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/public/index.ejs","filename":"index.html","hash":false,"inject":false,"compile":true,"favicon":false,"minify":false,"cache":true,"showErrors":true,"chunks":"all","excludeChunks":[],"title":"Money Transfer App","xhtml":false,"description":"ES Money Transfer App","appMountId":"root","googleAnalytics":{"trackingId":"UA-XXXX-XX","pageViewOnLoad":true},"mobile":true}}--></body>
</script><!--{"files":{"publicPath":"/","chunks":{"manifest":{"size":0,"entry":"/manifest.6cefa3c1211f2dfff0d6.js","hash":"6cefa3c1211f2dfff0d6","css":[]},"vendor":{"size":1654379,"entry":"/vendor.85781b28c9410377534e.js","hash":"85781b28c9410377534e","css":[]},"style":{"size":122,"entry":"/style.b588c60da106277d78c8.js","hash":"b588c60da106277d78c8","css":["/style.b588c60da106277d78c8.css"]},"app":{"size":350828,"entry":"/app.3441ac93c60d32b5b228.js","hash":"3441ac93c60d32b5b228","css":[]}},"js":["/manifest.6cefa3c1211f2dfff0d6.js","/vendor.85781b28c9410377534e.js","/style.b588c60da106277d78c8.js","/app.3441ac93c60d32b5b228.js"],"css":["/style.b588c60da106277d78c8.css"]},"options":{"template":"/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/html-webpack-plugin/lib/loader.js!/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/public/index.ejs","filename":"index.html","hash":false,"inject":false,"compile":true,"favicon":false,"minify":false,"cache":true,"showErrors":true,"chunks":"all","excludeChunks":[],"title":"Money Transfer App","xhtml":false,"description":"ES Money Transfer App","appMountId":"root","googleAnalytics":{"trackingId":"UA-XXXX-XX","pageViewOnLoad":true},"mobile":true}}--></body>
</html>

View File

@@ -76,7 +76,7 @@
/******/ script.charset = 'utf-8';
/******/ script.async = true;
/******/
/******/ script.src = __webpack_require__.p + "" + {"0":"49212d324ec7c7726785","1":"b588c60da106277d78c8","2":"85781b28c9410377534e"}[chunkId] + ".js";
/******/ script.src = __webpack_require__.p + "" + {"0":"3441ac93c60d32b5b228","1":"b588c60da106277d78c8","2":"85781b28c9410377534e"}[chunkId] + ".js";
/******/ head.appendChild(script);
/******/ }
/******/ };
@@ -92,4 +92,4 @@
/******/ })
/************************************************************************/
/******/ ([]);
//# sourceMappingURL=manifest.b9df2a8cd9e9c60ecbfa.js.map
//# sourceMappingURL=manifest.6cefa3c1211f2dfff0d6.js.map

View File

@@ -1 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap 8ce0279cca776845cbf8?"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uDAA+C,iFAAiF;AAChI;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA","file":"manifest.b9df2a8cd9e9c60ecbfa.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, callbacks = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId])\n \t\t\t\tcallbacks.push.apply(callbacks, installedChunks[chunkId]);\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);\n \t\twhile(callbacks.length)\n \t\t\tcallbacks.shift().call(null, __webpack_require__);\n \t\tif(moreModules[0]) {\n \t\t\tinstalledModules[0] = 0;\n \t\t\treturn __webpack_require__(0);\n \t\t}\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// \"0\" means \"already loaded\"\n \t// Array means \"loading\", array contains callbacks\n \tvar installedChunks = {\n \t\t3:0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId, callback) {\n \t\t// \"0\" is the signal for \"already loaded\"\n \t\tif(installedChunks[chunkId] === 0)\n \t\t\treturn callback.call(null, __webpack_require__);\n\n \t\t// an array means \"currently loading\".\n \t\tif(installedChunks[chunkId] !== undefined) {\n \t\t\tinstalledChunks[chunkId].push(callback);\n \t\t} else {\n \t\t\t// start chunk loading\n \t\t\tinstalledChunks[chunkId] = [callback];\n \t\t\tvar head = document.getElementsByTagName('head')[0];\n \t\t\tvar script = document.createElement('script');\n \t\t\tscript.type = 'text/javascript';\n \t\t\tscript.charset = 'utf-8';\n \t\t\tscript.async = true;\n\n \t\t\tscript.src = __webpack_require__.p + \"\" + {\"0\":\"49212d324ec7c7726785\",\"1\":\"b588c60da106277d78c8\",\"2\":\"85781b28c9410377534e\"}[chunkId] + \".js\";\n \t\t\thead.appendChild(script);\n \t\t}\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 8ce0279cca776845cbf8\n **/"],"sourceRoot":""}
{"version":3,"sources":["webpack:///webpack/bootstrap ee0048d3207bbfc1d857?"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uDAA+C,iFAAiF;AAChI;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA","file":"manifest.6cefa3c1211f2dfff0d6.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, callbacks = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId])\n \t\t\t\tcallbacks.push.apply(callbacks, installedChunks[chunkId]);\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);\n \t\twhile(callbacks.length)\n \t\t\tcallbacks.shift().call(null, __webpack_require__);\n \t\tif(moreModules[0]) {\n \t\t\tinstalledModules[0] = 0;\n \t\t\treturn __webpack_require__(0);\n \t\t}\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// \"0\" means \"already loaded\"\n \t// Array means \"loading\", array contains callbacks\n \tvar installedChunks = {\n \t\t3:0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId, callback) {\n \t\t// \"0\" is the signal for \"already loaded\"\n \t\tif(installedChunks[chunkId] === 0)\n \t\t\treturn callback.call(null, __webpack_require__);\n\n \t\t// an array means \"currently loading\".\n \t\tif(installedChunks[chunkId] !== undefined) {\n \t\t\tinstalledChunks[chunkId].push(callback);\n \t\t} else {\n \t\t\t// start chunk loading\n \t\t\tinstalledChunks[chunkId] = [callback];\n \t\t\tvar head = document.getElementsByTagName('head')[0];\n \t\t\tvar script = document.createElement('script');\n \t\t\tscript.type = 'text/javascript';\n \t\t\tscript.charset = 'utf-8';\n \t\t\tscript.async = true;\n\n \t\t\tscript.src = __webpack_require__.p + \"\" + {\"0\":\"3441ac93c60d32b5b228\",\"1\":\"b588c60da106277d78c8\",\"2\":\"85781b28c9410377534e\"}[chunkId] + \".js\";\n \t\t\thead.appendChild(script);\n \t\t}\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap ee0048d3207bbfc1d857\n **/"],"sourceRoot":""}

View File

@@ -2,7 +2,12 @@
* Created by andrew on 26/02/16.
*/
export function parseResponse (response) {
let json = response.json();
const json = response.json().catch(err => {
if (err.toString().indexOf('SyntaxError: Unexpected end of JSON input') >= 0) {
return Promise.resolve({});
}
throw err;
});
if (response.status >= 200 && response.status < 300) {
return json;
} else {

View File

@@ -1,4 +1,5 @@
export default {
url: 'http://localhost:8080/#/',
elements: {
instancesListDescription: {
selector: '//div[@class="description-field col-flex-1"]',

View File

@@ -1,11 +1,14 @@
const loginCommands = {
login(email, pass) {
return this
login({email, pass}) {
this
.waitForElementVisible('@emailInput')
.setValue('@emailInput', email)
.setValue('@passInput', pass)
.waitForElementVisible('@loginButton')
.click('@loginButton')
.setValue('@passInput', pass);
this.api.pause(500);
return this.waitForElementVisible('@loginButton')
.submitForm('@loginButton');
}
};
@@ -16,6 +19,9 @@ export default {
emailInput: {
selector: 'input[type=text]'
},
emailLoginPageInput: {
selector: 'input.email-sign-in-email.form-control'
},
passInput: {
selector: 'input[name=password]'
},

View File

@@ -1,29 +1,48 @@
const signupCommands = {
signup(email, pass, fName, lName, ssn) {
return this
.waitForElementVisible('@emailInput')
signup({fName, lName, email, pass, passConf, ssn}) {
this
.waitForElementVisible('@fNameInput')
.setValue('@fNameInput', fName)
.setValue('@lNameInput', lName)
.setValue('@emailInput', email)
.setValue('@passInput', pass)
.waitForElementVisible('@loginButton')
.click('@loginButton')
.setValue('@passConfirmInput', passConf)
.setValue('@ssnInput', ssn);
this.api.pause(500);
this.waitForElementVisible('@signupButton')
.submitForm('@signupButton');
this.api.pause(500);
return this.waitForElementNotPresent('@fNameInput');
}
};
export default {
url: 'http://localhost:8080/#/register',
commands: [loginCommands],
commands: [signupCommands],
elements: {
emailInput: {
selector: 'input[type=text][label=Email]'
fNameInput: {
selector: 'input[type=text][label="First name"]'
},
lNameInput: {
selector: 'input[type=text][label="Last name"]'
},
emailInput: {
selector: 'input[type=text][label="Last name"]'
selector: 'input[type=text][label=Email]'
},
passInput: {
selector: 'input[name=password]'
},
loginButton: {
selector: 'button[type=submit]'
passConfirmInput: {
selector: 'input[name=password-confirm]'
},
ssnInput: {
selector: 'input[type=text][label=SSN]'
},
signupButton: {
// selector: 'button[type=submit]'
selector: 'button[type=submit].email-sign-up-submit.btn.btn-default'
}
}
};

View File

@@ -0,0 +1,19 @@
export default {
'@tags': ['register', 'sanity'],
'User signs up': (client) => {
const page = client.page.signupPage();
const loginPage = client.page.loginPage();
const [fName, lName, email, pass, passConf, ssn] = 'Andrew|Revinsky|ar@gm.com|12345|12345|12345'.split('|');
page
.navigate()
.signup({
fName, lName, email, pass, passConf, ssn
});
loginPage.expect.element('@emailLoginPageInput').to.be.visible;
client.end();
}
};

View File

@@ -1,13 +1,17 @@
export default {
'@tags': ['login', 'sanity'],
'User Logs in': (client) => {
const loginPage = client.page.loginPage();
const instancesPage = client.page.instancesPage();
const [email, pass] = 'ar@gm.com|12345'.split('|');
loginPage
.navigate()
.login(process.env.EMAIL, process.env.PASSWORD);
.login({email, pass});
instancesPage.expect.element('@instancesListDescription').text.to.contain('Your first instance.');
instancesPage.expect.element('@instancesListDescription').to.be.visible;
client.end();
}