From 6d687d0105910649d7298ae8406b7a6bcb4bff54 Mon Sep 17 00:00:00 2001 From: Railag Date: Mon, 5 Nov 2018 16:22:26 +0300 Subject: [PATCH] EWC-313 postman QA flow section (#314) --- src/services/flow-service.js | 10 +- ...Controller Testing.postman_collection.json | 388 +++++++++++++++++- 2 files changed, 395 insertions(+), 3 deletions(-) diff --git a/src/services/flow-service.js b/src/services/flow-service.js index 41e7166d9..53612fccd 100644 --- a/src/services/flow-service.js +++ b/src/services/flow-service.js @@ -116,11 +116,17 @@ const _getUserFlows = async function (user, isCLI, transaction) { userId: user.id }; - return await FlowManager.findAllExcludeFields(flow, transaction) + const flows = await FlowManager.findAllExcludeFields(flow, transaction); + return { + flows: flows + } }; const _getAllFlows = async function (isCLI, transaction) { - return await FlowManager.findAll({}, transaction); + const flows = await FlowManager.findAll({}, transaction); + return { + flows: flows + } }; const _checkForDuplicateName = async function (name, item, userId, transaction) { diff --git a/tests/Controller Testing.postman_collection.json b/tests/Controller Testing.postman_collection.json index 43cba7644..30494c3e1 100644 --- a/tests/Controller Testing.postman_collection.json +++ b/tests/Controller Testing.postman_collection.json @@ -1732,6 +1732,392 @@ "response": [] } ] + }, + { + "name": "Flow", + "item": [ + { + "name": "Create user", + "event": [ + { + "listen": "test", + "script": { + "id": "954febdd-1a16-4db0-bdff-bd13fc50a451", + "exec": [ + "tests[\"Status code is 201\"] = responseCode.code === 201;", + "", + "var data = JSON.parse(responseBody);", + "", + "tests[\"Response validation passed\"] = data.hasOwnProperty('userId') && data.firstName && data.lastName && data.email && data.hasOwnProperty('emailActivated');" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"email\": \"user@domain.com\",\n \"password\": \"#Bugs4Fun\"\n}" + }, + "url": { + "raw": "{{host}}/api/v3/user/signup", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v3", + "user", + "signup" + ] + } + }, + "response": [] + }, + { + "name": "Login", + "event": [ + { + "listen": "test", + "script": { + "id": "4f7a9f52-12cc-49d0-9e2f-147b6f5cb6fa", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "var data = JSON.parse(responseBody);", + "", + "tests[\"Response validation passed\"] = data.accessToken;", + "", + "", + "postman.setGlobalVariable(\"user-token\", data.accessToken);", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"email\": \"user@domain.com\",\n \"password\": \"#Bugs4Fun\"\n}" + }, + "url": { + "raw": "{{host}}/api/v3/user/login", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v3", + "user", + "login" + ] + } + }, + "response": [] + }, + { + "name": "New Flow", + "event": [ + { + "listen": "test", + "script": { + "id": "4f7a9f52-12cc-49d0-9e2f-147b6f5cb6fa", + "exec": [ + "tests[\"Status code is 201\"] = responseCode.code === 201;", + "", + "var data = JSON.parse(responseBody);", + "", + "tests[\"Response validation passed\"] = data.hasOwnProperty('id');", + "", + "postman.setGlobalVariable(\"flow-id\", data.id);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{user-token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"Flow Name\",\n \"description\": \"Description\",\n \"isActivated\": true\n}" + }, + "url": { + "raw": "{{host}}/api/v3/flow", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v3", + "flow" + ] + } + }, + "response": [] + }, + { + "name": "Get Flows", + "event": [ + { + "listen": "test", + "script": { + "id": "4f7a9f52-12cc-49d0-9e2f-147b6f5cb6fa", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "var data = JSON.parse(responseBody);", + "", + "tests[\"Response validation passed\"] = data.hasOwnProperty('flows');" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{user-token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{host}}/api/v3/flow", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v3", + "flow" + ] + } + }, + "response": [] + }, + { + "name": "Get Flow By Id", + "event": [ + { + "listen": "test", + "script": { + "id": "4f7a9f52-12cc-49d0-9e2f-147b6f5cb6fa", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "var data = JSON.parse(responseBody);", + "", + "tests[\"Response validation passed\"] = data.hasOwnProperty('id') && data.name && data.description && data.hasOwnProperty('isActivated');" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{user-token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{host}}/api/v3/flow/{{flow-id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v3", + "flow", + "{{flow-id}}" + ] + } + }, + "response": [] + }, + { + "name": "Update Flow", + "event": [ + { + "listen": "test", + "script": { + "id": "4f7a9f52-12cc-49d0-9e2f-147b6f5cb6fa", + "exec": [ + "tests[\"Status code is 204\"] = responseCode.code === 204;" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PATCH", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{user-token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"Flow Name 22\",\n \"description\": \"Description\",\n \"isActivated\": true\n}" + }, + "url": { + "raw": "{{host}}/api/v3/flow/{{flow-id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v3", + "flow", + "{{flow-id}}" + ] + } + }, + "response": [] + }, + { + "name": "Delete Flow", + "event": [ + { + "listen": "test", + "script": { + "id": "4f7a9f52-12cc-49d0-9e2f-147b6f5cb6fa", + "exec": [ + "tests[\"Status code is 204\"] = responseCode.code === 204;" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "Authorization", + "value": "{{user-token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{host}}/api/v3/flow/{{flow-id}}", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v3", + "flow", + "{{flow-id}}" + ] + } + }, + "response": [] + }, + { + "name": "Delete user", + "event": [ + { + "listen": "test", + "script": { + "id": "954febdd-1a16-4db0-bdff-bd13fc50a451", + "exec": [ + "tests[\"Status code is 204\"] = responseCode.code === 204;" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [ + { + "key": "Authorization", + "value": "{{user-token}}" + }, + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{host}}/api/v3/user/profile", + "host": [ + "{{host}}" + ], + "path": [ + "api", + "v3", + "user", + "profile" + ] + } + }, + "response": [] + } + ] } ], "event": [ @@ -1758,7 +2144,7 @@ ], "variable": [ { - "id": "0cd8c928-a4e1-41ac-8c8f-a57d4e75ba89", + "id": "1a291aeb-b1ca-4099-9e67-89604a5093b1", "key": "host", "value": "localhost:51121", "type": "string"