Merge pull request #56 from dartandrevinsky/private-event-sourcing-examples-46

[WIP] Issue #46 - e2e test scenarios
This commit is contained in:
crcinc
2016-09-30 16:13:32 -07:00
committed by GitHub
28 changed files with 677 additions and 39 deletions

View File

@@ -8,4 +8,5 @@ dependencies {
compile "org.springframework.boot:spring-boot-starter-security:$springBootVersion"
testCompile "junit:junit:4.11"
testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
}

View File

@@ -1,12 +1,13 @@
package net.chrisrichardson.eventstore.javaexamples.banking.commonauth.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside.common.QuerySideCustomer;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.UserCredentials;
import net.chrisrichardson.eventstore.javaexamples.banking.commonauth.CustomerAuthService;
import net.chrisrichardson.eventstore.javaexamples.banking.commonauth.model.ErrorResponse;
import net.chrisrichardson.eventstore.javaexamples.banking.commonauth.model.User;
import net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside.common.QuerySideCustomer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.dao.IncorrectResultSizeDataAccessException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -46,7 +47,7 @@ public class AuthController {
}
@ResponseStatus(value = HttpStatus.NOT_FOUND)
@ExceptionHandler(IncorrectResultSizeDataAccessException.class)
@ExceptionHandler({EmptyResultDataAccessException.class, IncorrectResultSizeDataAccessException.class})
public ErrorResponse customersNotFound() {
return new ErrorResponse("Customer not found");
}

View File

@@ -0,0 +1,80 @@
package net.chrisrichardson.eventstore.javaexamples.banking.commonauth.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.Address;
import net.chrisrichardson.eventstore.javaexamples.banking.common.customers.Name;
import net.chrisrichardson.eventstore.javaexamples.banking.commonauth.CustomerAuthService;
import net.chrisrichardson.eventstore.javaexamples.banking.commonauth.model.User;
import net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside.common.QuerySideCustomer;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.http.MediaType;
import org.springframework.security.core.token.DefaultToken;
import org.springframework.security.core.token.TokenService;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = AuthControllerIntegrationTestConfiguration.class)
@IntegrationTest
@WebAppConfiguration
public class AuthControllerIntegrationTest {
private MockMvc mockMvc;
@Mock
TokenService tokenService;
@Mock
CustomerAuthService customerAuthService;
@InjectMocks
AuthController authController;
private static ObjectMapper om = new ObjectMapper();
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
this.mockMvc = MockMvcBuilders.standaloneSetup(authController).build();
}
@Test
public void shouldLogin() throws Exception {
when(customerAuthService.findByEmailAndPassword("my@email.com", "my_password")).thenReturn(new QuerySideCustomer("id", new Name("test", "test"), "my@email.com", "my_password", "ssn", "", new Address(), null));
when(customerAuthService.findByEmailAndPassword("not_my@email.com", "not_my_password")).thenThrow(new EmptyResultDataAccessException(1));
when(tokenService.allocateToken(om.writeValueAsString(new User("my@email.com")))).thenReturn(new DefaultToken("key", System.currentTimeMillis(), ""));
mockMvc.perform(post("/api/login")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"email\" : \"my@email.com\", \"password\" : \"my_password\"}")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(result -> {
assertTrue(result.getResponse().getContentAsString().contains("id"));
assertTrue(result.getResponse().getContentAsString().contains("my@email.com"));
assertTrue(result.getResponse().getContentAsString().contains("my_password"));
});
mockMvc.perform(post("/api/login")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"email\" : \"not_my@email.com\", \"password\" : \"not_my_password\"}")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isNotFound());
}
}

View File

@@ -0,0 +1,12 @@
package net.chrisrichardson.eventstore.javaexamples.banking.commonauth.controller;
import net.chrisrichardson.eventstore.javaexamples.banking.commonauth.AuthConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Import(AuthConfiguration.class)
@EnableAutoConfiguration
public class AuthControllerIntegrationTestConfiguration {
}

View File

@@ -1,6 +1,7 @@
package net.chrisrichardson.eventstore.javaexamples.banking.commonauth;
import net.chrisrichardson.eventstore.javaexamples.banking.web.customers.queryside.common.QuerySideCustomer;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.dao.support.DataAccessUtils;
/**
@@ -14,10 +15,18 @@ public class CustomerAuthService {
}
public QuerySideCustomer findByEmail(String email) {
return DataAccessUtils.uniqueResult(customerAuthRepository.findByEmail(email));
QuerySideCustomer result = DataAccessUtils.uniqueResult(customerAuthRepository.findByEmail(email));
if (result==null)
throw new EmptyResultDataAccessException(1);
return result;
}
public QuerySideCustomer findByEmailAndPassword(String email, String password) {
return DataAccessUtils.uniqueResult(customerAuthRepository.findByEmailAndPassword(email, password));
QuerySideCustomer result = DataAccessUtils.uniqueResult(customerAuthRepository.findByEmailAndPassword(email, password));
if (result==null)
throw new EmptyResultDataAccessException(1);
return result;
}
}

View File

@@ -1,3 +1,4 @@
{
"presets": ["es2015", "stage-0", "react"]
"presets": ["es2015", "stage-0", "react"],
"plugins": ["add-module-exports"]
}

View File

@@ -432,7 +432,8 @@ webpackJsonp([0,3],{
});
exports.default = mainReducer;
module.exports = exports['default'];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "index.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -473,7 +474,8 @@ webpackJsonp([0,3],{
* Created by andrew on 25/02/16.
*/
exports.default = authStateReducer;
module.exports = exports['default'];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "index.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -610,7 +612,8 @@ webpackJsonp([0,3],{
}
});
module.exports = exports['default'];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "ACTION_TYPES.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -1046,7 +1049,8 @@ webpackJsonp([0,3],{
};
exports.default = createFormReducer;
module.exports = exports["default"];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "createFormReducer.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -1241,7 +1245,8 @@ webpackJsonp([0,3],{
* Created by andrew on 15/03/16.
*/
exports.default = dataReducer;
module.exports = exports['default'];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "index.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -1661,7 +1666,8 @@ webpackJsonp([0,3],{
* Created by andrew on 25/02/16.
*/
exports.default = uiReducer;
module.exports = exports['default'];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "index.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -2233,7 +2239,8 @@ webpackJsonp([0,3],{
// even though this code shouldn't be used server-side, node will throw
// errors if "window" is used
exports.default = Function("return this")() || (42, eval)("this");
module.exports = exports["default"];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "root.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -2478,6 +2485,8 @@ webpackJsonp([0,3],{
return resp;
}
module.exports = exports["default"];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "fetch.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -2560,6 +2569,13 @@ webpackJsonp([0,3],{
*/
function parseResponse(response) {
var 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 {
@@ -3099,7 +3115,8 @@ webpackJsonp([0,3],{
return { defaultEndpointKey: defaultEndpointKey, currentEndpoint: currentEndpoint };
}
module.exports = exports["default"];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "parseEndpointConfig.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -3284,7 +3301,8 @@ webpackJsonp([0,3],{
}
return read(src[pathItem], rest.join('.'), defaultVal);
}
module.exports = exports['default'];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "readProp.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -3803,7 +3821,8 @@ webpackJsonp([0,3],{
var name = _user$name === undefined ? {} : _user$name;
var _user$phoneNumber = user.phoneNumber;
var phoneNumber = _user$phoneNumber === undefined ? '' : _user$phoneNumber;
var address = user.address;
var _user$address = user.address;
var address = _user$address === undefined ? {} : _user$address;
var toAccounts = user.toAccounts;
@@ -4095,7 +4114,8 @@ webpackJsonp([0,3],{
error: app.ui.error
};
})(MyAccounts);
module.exports = exports["default"];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "MyAccounts.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -4471,7 +4491,7 @@ webpackJsonp([0,3],{
null,
_react2.default.createElement(
"form",
null,
{ className: "account-create-ref clearfix" },
_react2.default.createElement(
"div",
{ className: "form-group", style: {
@@ -4708,7 +4728,8 @@ webpackJsonp([0,3],{
style: {}
};
exports.default = ButtonLoader;
module.exports = exports["default"];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "ButtonLoader.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -4820,7 +4841,8 @@ webpackJsonp([0,3],{
errors: []
};
exports.default = AuthInput;
module.exports = exports["default"];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "Input.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -4914,7 +4936,8 @@ webpackJsonp([0,3],{
errors: []
};
exports.default = AuxErrorLabel;
module.exports = exports["default"];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "AuxErrorLabel.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -7019,7 +7042,8 @@ webpackJsonp([0,3],{
var app = _ref.app;
return { auth: app.auth };
})(EmailSignUpForm);
module.exports = exports["default"];
/* REACT HOT LOADER */ }).call(this); } finally { if (false) { (function () { var foundReactClasses = module.hot.data && module.hot.data.foundReactClasses || false; if (module.exports && module.makeHot) { var makeExportsHot = require("/Users/andrew/dev/clients/ES/code/event-sourcing-examples/js-frontend/node_modules/react-hot-loader/makeExportsHot.js"); if (makeExportsHot(module, require("react"))) { foundReactClasses = true; } var shouldAcceptModule = true && foundReactClasses; if (shouldAcceptModule) { module.hot.accept(function (err) { if (err) { console.error("Cannot not apply hot update to " + "EmailSignUpForm.js" + ": " + err.message); } }); } } module.hot.dispose(function (data) { data.makeHot = module.makeHot; data.foundReactClasses = foundReactClasses; }); })(); } }
/***/ },
@@ -7133,4 +7157,4 @@ webpackJsonp([0,3],{
/***/ }
});
//# sourceMappingURL=app.497ed0e9fa8411cbbf1d.js.map
//# sourceMappingURL=app.30980d75b78111237ddf.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.15c5d6172500c36b3280.js"></script><script src="/vendor.85781b28c9410377534e.js"></script><script src="/style.b588c60da106277d78c8.js"></script><script src="/app.497ed0e9fa8411cbbf1d.js"></script><script>
<body><div id="root"></div><script src="/manifest.2790e4278ac45db31919.js"></script><script src="/vendor.85781b28c9410377534e.js"></script><script src="/style.b588c60da106277d78c8.js"></script><script src="/app.30980d75b78111237ddf.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.15c5d6172500c36b3280.js","hash":"15c5d6172500c36b3280","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":350105,"entry":"/app.497ed0e9fa8411cbbf1d.js","hash":"497ed0e9fa8411cbbf1d","css":[]}},"js":["/manifest.15c5d6172500c36b3280.js","/vendor.85781b28c9410377534e.js","/style.b588c60da106277d78c8.js","/app.497ed0e9fa8411cbbf1d.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.2790e4278ac45db31919.js","hash":"2790e4278ac45db31919","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":350969,"entry":"/app.30980d75b78111237ddf.js","hash":"30980d75b78111237ddf","css":[]}},"js":["/manifest.2790e4278ac45db31919.js","/vendor.85781b28c9410377534e.js","/style.b588c60da106277d78c8.js","/app.30980d75b78111237ddf.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":"497ed0e9fa8411cbbf1d","1":"b588c60da106277d78c8","2":"85781b28c9410377534e"}[chunkId] + ".js";
/******/ script.src = __webpack_require__.p + "" + {"0":"30980d75b78111237ddf","1":"b588c60da106277d78c8","2":"85781b28c9410377534e"}[chunkId] + ".js";
/******/ head.appendChild(script);
/******/ }
/******/ };
@@ -92,4 +92,4 @@
/******/ })
/************************************************************************/
/******/ ([]);
//# sourceMappingURL=manifest.15c5d6172500c36b3280.js.map
//# sourceMappingURL=manifest.2790e4278ac45db31919.js.map

View File

@@ -1 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap ee51b0824572a7d4b9ec?"],"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.15c5d6172500c36b3280.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\":\"497ed0e9fa8411cbbf1d\",\"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 ee51b0824572a7d4b9ec\n **/"],"sourceRoot":""}
{"version":3,"sources":["webpack:///webpack/bootstrap 639cbdef3a3cb57e8b8a?"],"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.2790e4278ac45db31919.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\":\"30980d75b78111237ddf\",\"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 639cbdef3a3cb57e8b8a\n **/"],"sourceRoot":""}

View File

@@ -0,0 +1,3 @@
require('babel-core/register');
module.exports = require('./nightwatch.json');

View File

@@ -0,0 +1,33 @@
{
"src_folders": ["tests/e2e-tests"],
"output_folder": "reports",
"custom_commands_path": "",
"custom_assertions_path": "",
"page_objects_path": "tests/e2e-pages",
"globals_path": "tests/e2e-globals/globals.js",
"selenium": {
"start_process": true,
"server_path": "./node_modules/selenium-standalone/.selenium/selenium-server/2.53.1-server.jar",
"log_path": "./reports",
"host": "127.0.0.1",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver": "./node_modules/selenium-standalone/.selenium/chromedriver/2.24-x64-chromedriver",
"webdriver.firefox.driver": "./node_modules/selenium-standalone/.selenium/geckodriver/0.10.0-x64-geckodriver"
}
},
"test_settings": {
"default": {
"launch_url": "http://localhost:8080",
"selenium_port": 4444,
"selenium_host": "localhost",
"silent": true,
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
}
}
}

View File

@@ -7,23 +7,22 @@
"license": "MIT",
"main": "static",
"scripts": {
"start": "gulp serve",
"open": "gulp open",
"gulp": "gulp",
"build": "webpack",
"watch": "webpack --progress --colors --watch --display-error-details --display-chunks --profile",
"start-dev": "export PORT=3000 && webpack-dev-server --host 0.0.0.0"
"start-dev": "export PORT=3000 && webpack-dev-server --host 0.0.0.0",
"e2e-setup": "node_modules/selenium-standalone/bin/selenium-standalone install",
"test-e2e": "nightwatch"
},
"devDependencies": {
"autoprefixer-loader": "^2.0.0",
"babel-plugin-add-module-exports": "^0.1.2",
"babel-plugin-transform-runtime": "^6.12.0",
"babel-cli": "^6.7.7",
"babel-core": "^6.10.4",
"babel-eslint": "^4.1.6",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-runtime": "^6.12.0",
"babel-polyfill": "^6.2.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.1.2",
"clean-webpack-plugin": "^0.1.10",
@@ -37,12 +36,14 @@
"json-loader": "^0.5.4",
"less": "^2.5.3",
"less-loader": "^2.2.0",
"nightwatch": "^0.9.8",
"node-libs-browser": "^0.5.2",
"open": "0.0.5",
"purifycss-webpack-plugin": "^2.0.3",
"react-hot-loader": "^1.3.0",
"redux-devtools": "^2.1.5",
"run-sequence": "^1.1.0",
"selenium-standalone": "^5.7.1",
"style-loader": "^0.12.3",
"url-loader": "^0.5.6",
"webpack": "^1.9.10",

View File

View File

@@ -2,7 +2,14 @@
* 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

@@ -140,7 +140,7 @@ class MyAccounts extends React.Component {
ssn = '',
name = {},
phoneNumber = '',
address,
address = {},
toAccounts
} = user;

View File

@@ -102,7 +102,7 @@ export class Add3rdPartyAccountModal extends React.Component {
<BS.Modal.Title>Add 3rd Party Account</BS.Modal.Title>
</BS.Modal.Header>
<BS.Modal.Body>
<form>
<form className="account-create-ref clearfix">
<div className="form-group" style={{
display: formErrors ? 'block' : 'none'
}}>

View File

@@ -89,7 +89,7 @@ export class NewAccountModal extends React.Component {
<BS.Modal.Title>New Account</BS.Modal.Title>
</BS.Modal.Header>
<BS.Modal.Body>
<form className='account-create-form clearfix'
<form className="account-create-form clearfix"
onSubmit={this.handleSubmit.bind(this)}>
<Input type="text"

View File

@@ -0,0 +1,55 @@
const salt = Math.random().toString().substr(2, 6);
const userData = (() => {
const [ fName, lName, email, pass, passConf, ssn ] = 'John|Doe|jd@em.com|12345|12345|12345'.split('|').map(k => `${k}_${salt}`);
return {
fName, lName, email, pass, passConf, ssn
}
})();
const otherUserData = (() => {
const [ fName, lName, email, pass, passConf, ssn ] = 'Jane|Dole|janed@ail.com|56789|56789|56789'.split('|').map(k => `${k}_${salt}`);
return {
fName, lName, email, pass, passConf, ssn
}
})();
const accountOne = (() => {
const [ title, amount, description ] = 'InitialAccount|100|One hundred'.split('|');
return {
title,
amount,
description
}
})();
const accountTwo = (() => {
const [ title, amount, description ] = 'SecondaryAccount|200|Two hundred'.split('|');
return {
title,
amount,
description
}
})();
export default {
waitForConditionTimeout: 10000,
userData,
otherUserData,
accountOne,
accountTwo
};

View File

@@ -0,0 +1,140 @@
const mainCommands = {
createAccount({ title, amount, description }, waitToHide) {
this
.waitForElementVisible('@modalCreateAccountHook')
.click('@modalCreateAccountHook');
this.api.pause(500);
this.waitForElementVisible('@modalCreateAccountModal')
.waitForElementVisible('@modalCreateAccountForm')
.setValue('@modalCreateAccountTitle', title)
.setValue('@modalCreateAccountAmount', amount)
.setValue('@modalCreateAccountDescription', description)
.click('@modalCreateAccountSubmit');
if (waitToHide) {
this.waitForElementNotPresent('@modalCreateAccountModal');
this.api.pause(1500);
}
return this;
},
createRef({ userQuery, accountQuery, title, description }, waitToHide) {
this
.waitForElementVisible('@modalCreateRefHook')
.click('@modalCreateRefHook');
this.api.pause(500);
this.waitForElementVisible('@modalCreateRefModal')
.waitForElementVisible('@modalCreateRefForm')
.waitForElementVisible('@modalCreateRefCustomerField')
.click('@modalCreateRefCustomerField')
.waitForElementVisible('@modealCreateRefCustomerOpen')
.waitForElementVisible('@modalCreateRefCustomerInput')
.setValue('@modalCreateRefCustomerInput', userQuery)
.waitForElementVisible('@modealCreateRefDDOption')
.click('@modealCreateRefDDOption')
.setValue('@modalCreateRefAccount', accountQuery)
.setValue('@modalCreateRefTitle', title)
.setValue('@modalCreateRefDescription', description)
.click('@modalCreateRefSubmit');
if (waitToHide) {
this.waitForElementNotPresent('@modalCreateRefModal');
this.api.pause(1500);
}
return this;
},
signOut() {
this
.waitForElementVisible('@signOutLink')
.click('@signOutLink');
return this.waitForElementNotPresent('@signOutLink');
}
};
export default {
url: 'http://localhost:8080/#/',
commands: [ mainCommands ],
elements: {
signOutLink: {
selector: '//li/a[text()=\'Sign Out\']',
locateStrategy: 'xpath'
},
modalCreateAccountHook: {
selector: '//div/button[1][text()=\'Create Account\']',
locateStrategy: 'xpath'
},
modalCreateAccountModal: {
selector: '.modal-dialog'
},
modalCreateAccountForm: {
selector: 'form.account-create-form'
},
modalCreateAccountTitle: {
selector: 'form.account-create-form input[name=title]'
},
modalCreateAccountAmount: {
selector: 'form.account-create-form input[name=balance]'
},
modalCreateAccountDescription: {
selector: 'form.account-create-form textarea[name=description]'
},
modalCreateAccountSubmit: {
selector: '.modal-dialog button[type=submit]'
},
modalCreateAccountErrors: {
selector: 'form.account-create-form .inline-error-item'
},
modalCreateRefHook: {
selector: '//div/button[2][text()=\'Add 3rd Party Recipients\']',
locateStrategy: 'xpath'
},
modalCreateRefModal: {
selector: '.modal-dialog'
},
modalCreateRefForm: {
selector: 'form.account-create-ref'
},
modalCreateRefCustomerField: {
selector: 'form.account-create-ref .Select.is-searchable div.Select-input'
},
modalCreateRefCustomerInput: {
selector: 'form.account-create-ref .Select.is-searchable div.Select-input > input'
},
modealCreateRefCustomerOpen: {
selector: 'form.account-create-ref .Select.is-searchable.is-open.is-focused div.Select-menu-outer > div.Select-menu' //has-value
},
modealCreateRefDDOption: {
selector: 'form.account-create-ref .Select.is-searchable.is-open.is-focused div.Select-menu-outer > div.Select-menu > div.Select-option' //has-value
},
modalCreateRefAccount: {
selector: 'form.account-create-ref .Select:not(.is-searchable) div.Select-input'
},
modalCreateRefTitle: {
selector: 'form.account-create-ref input[name=title]'
},
modalCreateRefDescription: {
selector: 'form.account-create-ref textarea[name=description]'
},
modalCreateRefSubmit: {
selector: '.modal-dialog button[type=submit]'
},
modalCreateRefErrors: {
selector: 'form.account-create-ref .inline-error-item'
},
accountLink: {
selector: 'a[href^=\'#/account/\']'
},
firstAccountLink: {
selector: '(//a[starts-with(@href, "#/account/")])[1]',
locateStrategy: 'xpath'
},
secondAccountLink: {
selector: '(//a[starts-with(@href, "#/account/")])[2]',
locateStrategy: 'xpath'
},
}
};

View File

@@ -0,0 +1,44 @@
const loginCommands = {
login({ email, pass }) {
this
.waitForElementVisible('@emailInput', 500);
this
.clearValue('@emailInput')
.setValue('@emailInput', email)
.clearValue('@passInput')
.setValue('@passInput', pass);
this.getValue('@emailInput', (result) => {
this.assert.equal(result.value, email);
});
return this.waitForElementVisible('@loginButton')
.click('@loginButton')
.submitForm('@loginButton');
}
};
export default {
url: 'http://localhost:8080/#/signin',
commands: [loginCommands],
elements: {
emailInput: {
selector: 'input[type=text]'
},
emailLoginPageInput: {
selector: 'input.email-sign-in-email.form-control'
},
passInput: {
selector: 'input[name=password]'
},
loginButton: {
selector: 'button[type=submit]'
},
formError: {
selector: '.control-label.inline-error-item'
}
}
};

View File

@@ -0,0 +1,54 @@
const signupCommands = {
signup({fName, lName, email, pass, passConf, ssn}, waitForNext) {
this
.waitForElementVisible('@fNameInput')
.setValue('@fNameInput', fName)
.setValue('@lNameInput', lName)
.setValue('@emailInput', email)
.setValue('@passInput', pass)
.setValue('@passConfirmInput', passConf)
.setValue('@ssnInput', ssn);
this.waitForElementVisible('@signupButton')
.submitForm('@signupButton');
if (waitForNext) {
return this.waitForElementNotPresent('@signupButton');
}
return this;
}
};
export default {
url: 'http://localhost:8080/#/register',
commands: [signupCommands],
elements: {
fNameInput: {
selector: 'input[type=text][label="First name"]'
},
lNameInput: {
selector: 'input[type=text][label="Last name"]'
},
emailInput: {
selector: 'input[type=text][label=Email]'
},
passInput: {
selector: 'input[name=password]'
},
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'
},
formError: {
selector: '.control-label.inline-error-item'
}
}
};

View File

@@ -0,0 +1,27 @@
import globals from '../e2e-globals/globals';
export default {
'@tags': ['register', 'sanity'],
'User signs up': (client) => {
const signupPage = client.page.signupPage();
const loginPage = client.page.loginPage();
const [ fName, lName, email, pass, passConf, ssn ] = '|||||'.split('|');
signupPage
.navigate()
.signup({
fName, lName, email, pass, passConf, ssn
}, false);
signupPage.expect.element('@formError').to.be.visible;
signupPage
.navigate()
.signup(globals.userData, true);
loginPage.expect.element('@emailLoginPageInput').to.be.visible;
client.end();
}
};

View File

@@ -0,0 +1,32 @@
import globals from '../e2e-globals/globals';
export default {
'@tags': ['login', 'sanity'],
'User Logs in': (client) => {
const loginPage = client.page.loginPage();
const instancesPage = client.page.instancesPage();
const [email, pass] = '|'.split('|');
loginPage
.navigate()
.login({email, pass});
loginPage.expect.element('@formError').to.be.visible;
loginPage
.navigate()
.login(globals.userData);
instancesPage.expect.element('@signOutLink').to.be.visible;
instancesPage
.navigate()
.signOut();
client.assert.urlContains('/#/signin');
client.end();
}
};

View File

@@ -0,0 +1,49 @@
/**
* Created by andrew on 9/28/16.
*/
import globals from '../e2e-globals/globals';
export default {
'@tags': ['create accounts', 'sanity'],
'User Creates Accounts': (client) => {
const loginPage = client.page.loginPage();
const instancesPage = client.page.instancesPage();
const [ title, amount, description ] = '||'.split('|');
loginPage
.navigate()
.login(globals.userData);
instancesPage
.navigate()
.createAccount({ title, amount, description }, false);
instancesPage.expect.element('@modalCreateAccountErrors').to.be.visible;
instancesPage
.createAccount(globals.accountOne, true);
instancesPage.expect.element('@modalCreateAccountErrors').to.not.be.present;
instancesPage.expect.element('@modalCreateAccountForm').to.not.be.present;
instancesPage.expect.element('@accountLink').to.be.visible;
instancesPage.expect.element('@firstAccountLink').to.be.visible;
instancesPage.expect.element('@secondAccountLink').to.not.be.present;
instancesPage.expect.element('@firstAccountLink').text.to.contain(globals.accountOne.title);
instancesPage
.createAccount(globals.accountTwo, true);
instancesPage.expect.element('@firstAccountLink').to.be.visible;
instancesPage.expect.element('@secondAccountLink').to.be.visible;
instancesPage.expect.element('@firstAccountLink').text.to.contain(globals.accountOne.title);
instancesPage.expect.element('@secondAccountLink').text.to.contain(globals.accountTwo.title);
client.end();
}
};

View File

@@ -0,0 +1,65 @@
/**
* Created by andrew on 9/28/16.
*/
import globals from '../e2e-globals/globals';
export default {
'@tags': ['create 3rd party accounts', 'sanity'],
'User Creates 3rd Party Accounts': (client) => {
const loginPage = client.page.loginPage();
const signupPage = client.page.signupPage();
const instancesPage = client.page.instancesPage();
// Step 1: Setup 3rd Party & Accounts
signupPage
.navigate();
client.assert.urlContains('/#/register');
signupPage
.signup(globals.otherUserData, true);
client.assert.urlContains('/#/signin');
loginPage
.navigate()
.login(globals.otherUserData);
client.end();
return;
//todo: solve select changing
const [ userQuery, accountQuery, title, description ] = '|||'.split('|');
instancesPage
.navigate()
.createRef({ userQuery, accountQuery, title, description }, false);
instancesPage.expect.element('@modalCreateRefErrors').to.be.visible;
instancesPage.expect.element('@modalCreateRefForm').to.be.visible;
const [ refAccountTitle, refAccountDescription ] = 'Johns`s Initial Account|Johns`s Initial Account'.split('|');;
instancesPage
.createRef({
userQuery: globals.userData.email,
accountQuery: globals.accountOne.title,
title: refAccountTitle,
description: refAccountDescription
}, true);
instancesPage.expect.element('@modalCreateRefErrors').to.not.be.present;
instancesPage.expect.element('@modalCreateRefForm').to.not.be.present;
instancesPage.expect.element('@accountLink').to.be.visible;
instancesPage.expect.element('@firstAccountLink').to.be.visible;
instancesPage.expect.element('@secondAccountLink').to.not.be.present;
instancesPage.expect.element('@firstAccountLink').text.to.contain(refAccountTitle);
client.end();
}
};