Commit 6fdc6526 by Lee Daehyun

Communication_API_TEST実装 roomAction,messageAction

parent 2e376d07
{
"info": {
"_postman_id": "f558c7b6-5cd6-4100-acc1-5103957b29f2",
"name": "AbookCheck_communication",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "LoginAPI",
"item": [
{
"name": "AppStoreNewLoginAction",
"event": [
{
"listen": "test",
"script": {
"id": "42eed0cf-da5a-4deb-980a-35f1164bbf57",
"exec": [
"var jsonData = pm.response.json();\r",
"pm.globals.set(\"sid\",jsonData.sid);"
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"id": "3a0ede3a-2473-4577-b99e-a598ab388241",
"exec": [
"pm.globals.set(\"JOIN\",\"1\");\r",
"pm.globals.set(\"JOINROOM\",\"2\");\r",
"pm.globals.set(\"INVITEUSERS\",\"3\");\r",
"pm.globals.set(\"GETGROUPLIST\",\"4\");\r",
"pm.globals.set(\"GETUSERLISTINGROUP\",\"5\");\r",
"\r",
"pm.globals.set(\"getRoomList\",\"1\");\r",
"pm.globals.set(\"createNewRoom\",\"2\");\r",
"pm.globals.set(\"exitRoom\",\"3\");\r",
"pm.globals.set(\"disconnect\",\"4\");\r",
"\r",
"pm.globals.set(\"createMessage\",\"1\");\r",
"pm.globals.set(\"getMessages\",\"2\");\r",
"pm.globals.set(\"roomSearch\",\"3\");\r",
"\r",
"pm.globals.set(\"getPushMessage\",\"1\");\r",
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"user-agent": true
}
},
"request": {
"method": "POST",
"header": [
{
"key": "User-Agent",
"value": "Android",
"type": "text"
}
],
"url": {
"raw": "https://chatdev2.abook.bz/acms/nuabvapi/appStoreNewLogin?appId=3&appVersion=1.2.360&deviceToken=dxDH1UITl-E%3AAPA91bHwZrP6-fXgAXiiApiPdH7Ai1cQFrc1FiTwWz85w5spAK56O1VHk0aV7BrB0uCvAccd2pkWaVQU-HORHLVpRt54xvyWKdh9mJ3Pg06tDFqFw0X6xaVTQ20rA8zeUdX6ZS-BVtzc&deviceTypeId=3&language=en&loginId=api_test1&ma&password=111111&uid=578529ca22cab829.androidid&urlPath=fermi",
"protocol": "https",
"host": [
"chatdev2",
"abook",
"bz"
],
"path": [
"acms",
"nuabvapi",
"appStoreNewLogin"
],
"query": [
{
"key": "appId",
"value": "3"
},
{
"key": "appVersion",
"value": "1.2.360"
},
{
"key": "deviceToken",
"value": "dxDH1UITl-E%3AAPA91bHwZrP6-fXgAXiiApiPdH7Ai1cQFrc1FiTwWz85w5spAK56O1VHk0aV7BrB0uCvAccd2pkWaVQU-HORHLVpRt54xvyWKdh9mJ3Pg06tDFqFw0X6xaVTQ20rA8zeUdX6ZS-BVtzc"
},
{
"key": "deviceTypeId",
"value": "3"
},
{
"key": "language",
"value": "en"
},
{
"key": "loginId",
"value": "api_test1"
},
{
"key": "ma",
"value": null
},
{
"key": "password",
"value": "111111"
},
{
"key": "uid",
"value": "578529ca22cab829.androidid"
},
{
"key": "urlPath",
"value": "fermi"
}
]
}
},
"response": []
}
],
"protocolProfileBehavior": {}
},
{
"name": "ChatAPI",
"item": [
{
"name": "userAction",
"event": [
{
"listen": "test",
"script": {
"id": "41fb3c92-8196-422a-a12a-39e36a1f5216",
"exec": [
"//成功確認コード\r",
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"\r",
"switch(pm.globals.get(\"cmd\")){\r",
" //JOIN_TEST\r",
" case pm.globals.get(\"JOIN\") : \r",
" //ユーザー情報確認\r",
" pm.test(\"test userInfo\", function () {\r",
" var jsonData = pm.response.json();\r",
" pm.expect(jsonData.body.userInfo.shopMemberId).to.eq(935)\r",
" pm.expect(jsonData.body.userInfo.shopId).to.eq(59)\r",
" });\r",
"\r",
" //ルーム情報\r",
" pm.test(\"test chatRoomCount\", function () {\r",
" var jsonData = pm.response.json().body.chatRoomList;\r",
" pm.expect(jsonData.length).to.eq(3)\r",
" });\r",
"\r",
" pm.test(\"test roomInfo\",function(){\r",
" var jsonData = pm.response.json().body.chatRoomList; \r",
" for(var i = 0; i < jsonData.length; i++){\r",
" switch(i){\r",
" case 0 :\r",
" pm.expect(jsonData[i].roomId).to.eq(98);\r",
" pm.expect(jsonData[i].roomName).to.eq(\"chatRoom1\");\r",
" pm.expect(jsonData[i].message).to.eq(\"hello \");\r",
" pm.expect(jsonData[i].userCnt).to.eq(2);\r",
" break;\r",
"\r",
" case 1 :\r",
" pm.expect(jsonData[i].roomId).to.eq(100);\r",
" pm.expect(jsonData[i].roomName).to.eq(\"ChatRoom3\");\r",
" pm.expect(jsonData[i].message).to.eq(\"good morning \");\r",
" pm.expect(jsonData[i].userCnt).to.eq(3);\r",
" break;\r",
"\r",
" case 2 :\r",
" pm.expect(jsonData[i].roomId).to.eq(99);\r",
" pm.expect(jsonData[i].roomName).to.eq(\"ChatRoom2\");\r",
" pm.expect(jsonData[i].message).to.eq(\"こんにちは \");\r",
" pm.expect(jsonData[i].userCnt).to.eq(2);\r",
" break;\r",
" }\r",
" }\r",
" });\r",
" break;\r",
"\r",
"\r",
" //JOINROOM_TEST\r",
" case pm.globals.get(\"JOINROOM\") :\r",
" //以前ルームのユーザーloginId\r",
" pm.test(\"test userListBeforeExit\", function(){\r",
" var jsonData = pm.response.json();\r",
" var loginId = jsonData.body.userListBeforeExit;\r",
" \r",
" pm.expect(loginId.length).to.eq(2);\r",
" for(var i = 0; loginId.lenght; i ++){\r",
" switch(i){\r",
" case 0 : \r",
" pm.expect(loginId[i]).eq(\"api_test1\")\r",
" break;\r",
" case 1 : \r",
" pm.expect(loginId[i]).eq(\"api_test2\")\r",
" break;\r",
" }\r",
" }\r",
" })\r",
" //参加するルームのユーザーloginId\r",
" pm.test(\"test userListNewRoom\", function(){\r",
" var jsonData = pm.response.json();\r",
" var loginId = jsonData.body.userListNewRoom;\r",
" \r",
" pm.expect(loginId.length).to.eq(3);\r",
" for(var i = 0; loginId.lenght; i ++) {\r",
" switch(i) {\r",
" case 0 : \r",
" pm.expect(loginId[i]).eq(\"api_test1\")\r",
" break;\r",
" case 1 : \r",
" pm.expect(loginId[i]).eq(\"api_test2\")\r",
" break;\r",
" case 2 :\r",
" pm.expect(loginId[i]).eq(\"api_test3\")\r",
" }\r",
" }\r",
" })\r",
"\r",
" //メッセージリスト\r",
" pm.test(\"test messageList\", function(){\r",
" var jsonData = pm.response.json();\r",
" var message = jsonData.body.messageList;\r",
" pm.expect(message[0].messageId).to.eq(744)\r",
" pm.expect(message[0].message).to.eq(\"おはようございます!! \")\r",
" });\r",
" break;\r",
"\r",
" case pm.globals.get(\"INVITEUSERS\") :\r",
" break;\r",
" \r",
" //\r",
" case pm.globals.get(\"GETGROUPLIST\") :\r",
" pm.test(\"test groupList\", function(){\r",
" var jsonData = pm.response.json().body;\r",
" for(var i = 0; i < jsonData.groupList.length; i++){\r",
" switch(i){\r",
" case 0 :\r",
" pm.expect(jsonData.groupList[i].groupId).eq(1371);\r",
" pm.expect(jsonData.groupList[i].groupName).eq(\"全社\");\r",
" pm.expect(jsonData.groupList[i].memberCnt).eq(1);\r",
" break;\r",
" case 1 :\r",
" pm.expect(jsonData.groupList[i].groupId).eq(1372);\r",
" pm.expect(jsonData.groupList[i].groupName).eq(\"A\");\r",
" pm.expect(jsonData.groupList[i].memberCnt).eq(9);\r",
" break;\r",
" case 2 :\r",
" pm.expect(jsonData.groupList[i].groupId).eq(1373);\r",
" pm.expect(jsonData.groupList[i].groupName).eq(\"B\");\r",
" pm.expect(jsonData.groupList[i].memberCnt).eq(3);\r",
" break;\r",
" case 3 :\r",
" pm.expect(jsonData.groupList[i].groupId).eq(1374);\r",
" pm.expect(jsonData.groupList[i].groupName).eq(\"C\");\r",
" pm.expect(jsonData.groupList[i].memberCnt).eq(1);\r",
" break;\r",
" case 4 :\r",
" pm.expect(jsonData.groupList[i].groupId).eq(1408);\r",
" pm.expect(jsonData.groupList[i].groupName).eq(\"D\");\r",
" pm.expect(jsonData.groupList[i].memberCnt).eq(1);\r",
" break;\r",
" case 5 :\r",
" pm.expect(jsonData.groupList[i].groupId).eq(1410);\r",
" pm.expect(jsonData.groupList[i].groupName).eq(\"Bのサブ\");\r",
" pm.expect(jsonData.groupList[i].memberCnt).eq(1);\r",
" break;\r",
" }\r",
" break;\r",
" }\r",
" })\r",
" case pm.globals.get(\"GETUSERLISTINGROUP\") :\r",
" pm.test(\"test userInfoInGroup\",function() {\r",
" var jsonData = pm.response.json().body.groupUserList;\r",
" console.log(jsonData.length);\r",
" for (var i = 0; i < jsonData.length; i++) {\r",
" switch (i) {\r",
" case 0 :\r",
" pm.expect(jsonData[i].shopMemberId).eq(\"889\")\r",
" pm.expect(jsonData[i].loginId).eq(\"fermi5\")\r",
" //pm.expect(jsonData[i].timeStamp).eq(\"20201208105930\")\r",
" pm.expect(jsonData[i].groupName).eq(\"B\")\r",
" break; \r",
" case 1 :\r",
" pm.expect(jsonData[i].shopMemberId).eq(\"926\")\r",
" pm.expect(jsonData[i].loginId).eq(\"kim-p1\")\r",
" //pm.expect(jsonData[i].timeStamp).eq(0)\r",
" pm.expect(jsonData[i].groupName).eq(\"B\")\r",
" break;\r",
" case 2 :\r",
" pm.expect(jsonData[i].shopMemberId).eq(\"929\")\r",
" pm.expect(jsonData[i].loginId).eq(\"kimp1\")\r",
" //pm.expect(jsonData[i].timeStamp).eq(\"20201130162142\")\r",
" pm.expect(jsonData[i].groupName).eq(\"B\")\r",
" break;\r",
" }\r",
" }\r",
" });\r",
"\r",
" break;\r",
"}\r",
""
],
"type": "text/javascript"
}
},
{
"listen": "prerequest",
"script": {
"id": "52a775f0-e5d4-4baa-a4e2-c590329d688d",
"exec": [
"pm.test(\"cmd\",function(){\r",
" var url = request.url;\r",
" let map = new Map();\r",
" var parameters = (url.slice(url.indexOf('?') + 1, url.length)).split('&');\r",
" for (var i = 0; i < parameters.length; i++) { \r",
" var param = parameters[i].split('=');\r",
" map.set(param[0],param[1])\r",
" }\r",
" pm.globals.set(\"cmd\",map.get(\"cmd\"));\r",
"});\r",
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {}
},
"request": {
"method": "POST",
"header": [
{
"key": "User-Agent",
"value": "Android",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "raw",
"raw": "",
"options": {
"raw": {
"language": "javascript"
}
}
},
"url": {
"raw": "https://chatdev2.abook.bz/acms/fermi/chatapi/user?sid={{sid}}&cmd=1",
"protocol": "https",
"host": [
"chatdev2",
"abook",
"bz"
],
"path": [
"acms",
"fermi",
"chatapi",
"user"
],
"query": [
{
"key": "sid",
"value": "{{sid}}"
},
{
"key": "cmd",
"value": "1"
},
{
"key": "beforeRoomId",
"value": "99",
"disabled": true
},
{
"key": "loginIdList",
"value": null,
"disabled": true
},
{
"key": "groupId",
"value": "1373",
"disabled": true
},
{
"key": "newRoomName",
"value": "",
"disabled": true
},
{
"key": "newRoomId",
"value": "100",
"disabled": true
}
]
}
},
"response": []
},
{
"name": "roomAction",
"event": [
{
"listen": "prerequest",
"script": {
"id": "e9c615e6-f547-4d46-ae79-c939ad10c138",
"exec": [
"pm.test(\"cmd\",function(){\r",
" var url = request.url;\r",
" let map = new Map();\r",
" var parameters = (url.slice(url.indexOf('?') + 1, url.length)).split('&');\r",
" for (var i = 0; i < parameters.length; i++) { \r",
" var param = parameters[i].split('=');\r",
" map.set(param[0],param[1])\r",
" }\r",
" pm.globals.set(\"cmd\", map.get(\"cmd\"));\r",
" pm.globals.set(\"isOrberByUnread\", map.get(\"isOrberByUnread\"))\r",
"});\r",
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"id": "39225fb9-3620-4e53-ae56-a666c8183f06",
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"\r",
"switch(pm.globals.get(\"cmd\")){\r",
" //該当ユーザのチャット一覧\r",
" case pm.globals.get(\"getRoomList\") :\r",
" var jsonData = pm.response.json().body.roomList\r",
" var isOrberByUnread = pm.globals.get(\"isOrberByUnread\")\r",
" //ルームの情報\r",
" pm.test(\"test RoomList\",function() {\r",
" //既読されてないルームが最初整列\r",
" if (isOrberByUnread == \"true\") {\r",
" for (var i = 0; i < jsonData.length; i++) {\r",
" switch(i) {\r",
" case 0 :\r",
" pm.expect(jsonData[i].roomId).eq(100)\r",
" pm.expect(jsonData[i].roomName).eq(\"ChatRoom3\")\r",
" pm.expect(jsonData[i].message).eq(\"good morning \")\r",
" pm.expect(jsonData[i].userCnt).eq(3)\r",
" pm.expect(jsonData[i].unreadCnt).eq(1)\r",
" pm.expect(jsonData[i].unreadFirst).eq(1)\r",
" break;\r",
"\r",
" case 1 :\r",
" pm.expect(jsonData[i].roomId).eq(98)\r",
" pm.expect(jsonData[i].roomName).eq(\"chatRoom1\")\r",
" pm.expect(jsonData[i].message).eq(\"hello \")\r",
" pm.expect(jsonData[i].userCnt).eq(2)\r",
" pm.expect(jsonData[i].unreadFirst).eq(2)\r",
" break;\r",
"\r",
" case 2 :\r",
" pm.expect(jsonData[i].roomId).eq(99)\r",
" pm.expect(jsonData[i].roomName).eq(\"ChatRoom2\")\r",
" pm.expect(jsonData[i].message).eq(\"こんにちは \")\r",
" pm.expect(jsonData[i].userCnt).eq(2)\r",
" pm.expect(jsonData[i].unreadFirst).eq(2)\r",
" break;\r",
" }\r",
" }\r",
" //メッセージの送信時間順で整列\r",
" } else if (isOrberByUnread == \"false\") {\r",
" for (var i = 0; i < jsonData.length; i++) {\r",
" switch(i) {\r",
" case 0 :\r",
" pm.expect(jsonData[i].roomId).eq(98)\r",
" pm.expect(jsonData[i].roomName).eq(\"chatRoom1\")\r",
" pm.expect(jsonData[i].message).eq(\"hello \")\r",
" pm.expect(jsonData[i].userCnt).eq(2)\r",
" break;\r",
"\r",
" case 1 :\r",
" pm.expect(jsonData[i].roomId).eq(100)\r",
" pm.expect(jsonData[i].roomName).eq(\"ChatRoom3\")\r",
" pm.expect(jsonData[i].message).eq(\"good morning \")\r",
" pm.expect(jsonData[i].userCnt).eq(3)\r",
" pm.expect(jsonData[i].unreadCnt).eq(1)\r",
" break;\r",
"\r",
" case 2 :\r",
" pm.expect(jsonData[i].roomId).eq(99)\r",
" pm.expect(jsonData[i].roomName).eq(\"ChatRoom2\")\r",
" pm.expect(jsonData[i].message).eq(\"こんにちは \")\r",
" pm.expect(jsonData[i].userCnt).eq(2)\r",
" break;\r",
" }\r",
" }\r",
" }\r",
" })\r",
" break;\r",
" case pm.globals.get(\"createNewRoom\") :\r",
" break;\r",
" case pm.globals.get(\"exitRoom\") :\r",
" break;\r",
" \r",
" case pm.globals.get(\"disconnect\") :\r",
" var jsonData = pm.response.json().body.userList;\r",
" pm.test(\"test userList\", function(){\r",
" for (var i = 0; i < jsonData.length; i++){\r",
" switch (i) {\r",
" case 0 :\r",
" pm.expect(jsonData[i].loginId).eq(\"api_test1\")\r",
" pm.expect(jsonData[i].imageClearFlg).eq(0)\r",
" pm.expect(jsonData[i].shopMemberId).eq(935)\r",
" break;\r",
" case 1 :\r",
" pm.expect(jsonData[i].loginId).eq(\"api_test2\")\r",
" pm.expect(jsonData[i].imageClearFlg).eq(0)\r",
" pm.expect(jsonData[i].shopMemberId).eq(936)\r",
" break;\r",
" case 2 :\r",
" pm.expect(jsonData[i].loginId).eq(\"api_test3\")\r",
" pm.expect(jsonData[i].imageClearFlg).eq(0)\r",
" pm.expect(jsonData[i].shopMemberId).eq(937)\r",
" break;\r",
" }\r",
" }\r",
" })\r",
" break;\r",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "https://chatdev2.abook.bz/acms/fermi/chatapi/room?sid={{sid}}&cmd=4&roomId=100",
"protocol": "https",
"host": [
"chatdev2",
"abook",
"bz"
],
"path": [
"acms",
"fermi",
"chatapi",
"room"
],
"query": [
{
"key": "sid",
"value": "{{sid}}"
},
{
"key": "cmd",
"value": "4"
},
{
"key": "isOrberByUnread",
"value": "true",
"disabled": true
},
{
"key": "loginIdList",
"value": null,
"disabled": true
},
{
"key": "newRoomName",
"value": null,
"disabled": true
},
{
"key": "roomId",
"value": "100"
}
]
}
},
"response": []
},
{
"name": "messageAction",
"event": [
{
"listen": "prerequest",
"script": {
"id": "645c2387-8265-47f3-90fa-e8934d78b2d3",
"exec": [
"pm.test(\"cmd\",function(){\r",
" var url = request.url;\r",
" let map = new Map();\r",
" var parameters = (url.slice(url.indexOf('?') + 1, url.length)).split('&');\r",
" for (var i = 0; i < parameters.length; i++) { \r",
" var param = parameters[i].split('=');\r",
" map.set(param[0],param[1])\r",
" }\r",
" pm.globals.set(\"cmd\", map.get(\"cmd\"));\r",
"});\r",
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"id": "0025f620-8347-4888-8d01-0b9fa63e11f7",
"exec": [
"pm.test(\"Status code is 200\", function () {\r",
" pm.response.to.have.status(200);\r",
"});\r",
"\r",
"switch (pm.globals.get(\"cmd\")) {\r",
" case pm.globals.get(\"createMessage\") :\r",
" pm.test(\"test createMessage\", function(){\r",
" \r",
" })\r",
" break;\r",
" case pm.globals.get(\"getMessages\") :\r",
" pm.test(\"test getMessages\", function(){\r",
" var jsonData = pm.response.json().body;\r",
" pm.test(\"messageList\", function(){\r",
" for (var i = 0; i < jsonData.messageList.length; i++) {\r",
" switch (i) {\r",
" case 0 :\r",
" pm.expect(jsonData.messageList[i].message).eq(\"Hello \")\r",
" pm.expect(jsonData.messageList[i].shopId).eq(59)\r",
" pm.expect(jsonData.messageList[i].loginId).eq(\"api_test2\")\r",
" pm.expect(jsonData.messageList[i].shopMemberId).eq(936)\r",
" break;\r",
" \r",
" case 1 :\r",
" pm.expect(jsonData.messageList[i].message).eq(\"こんばんは \")\r",
" pm.expect(jsonData.messageList[i].shopId).eq(59)\r",
" pm.expect(jsonData.messageList[i].loginId).eq(\"api_test1\")\r",
" pm.expect(jsonData.messageList[i].shopMemberId).eq(935)\r",
" break;\r",
" }\r",
" }\r",
" })\r",
" pm.test(\"userList\", function(){\r",
" for (var i = 0; i < jsonData.userList.length; i++) {\r",
" switch (i) {\r",
" case 0:\r",
" pm.expect(jsonData.userList[i].loginId).eq(\"api_test1\")\r",
" pm.expect(jsonData.userList[i].shopMemberId).eq(\"935\")\r",
" break;\r",
" \r",
" case 1:\r",
" pm.expect(jsonData.userList[i].loginId).eq(\"api_test2\")\r",
" pm.expect(jsonData.userList[i].shopMemberId).eq(\"936\")\r",
" break;\r",
"\r",
" }\r",
" }\r",
" })\r",
" })\r",
" break;\r",
" case pm.globals.get(\"roomSearch\") :\r",
" pm.test(\"test roomSearch\", function(){\r",
" var jsonData = pm.response.json().body;\r",
" pm.test(\"searchResultList\", function(){\r",
" for (var i = 0; i < jsonData.searchResultList; i++){\r",
" switch (i) {\r",
" case 0 : \r",
" pm.expect(jsonData[i].message).eq(2)\r",
" pm.expect(jsonData[i].roomName).eq(\"chatRoom1\")\r",
" pm.expect(jsonData[i].roomId).eq(98)\r",
" break;\r",
" }\r",
" }\r",
" \r",
" })\r",
" })\r",
" break;\r",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"url": {
"raw": "https://chatdev2.abook.bz/acms/fermi/chatapi/message?sid={{sid}}&cmd=3&keyword=h",
"protocol": "https",
"host": [
"chatdev2",
"abook",
"bz"
],
"path": [
"acms",
"fermi",
"chatapi",
"message"
],
"query": [
{
"key": "sid",
"value": "{{sid}}"
},
{
"key": "cmd",
"value": "3"
},
{
"key": "message",
"value": null,
"disabled": true
},
{
"key": "roomId",
"value": "98",
"disabled": true
},
{
"key": "userListInRoom",
"value": null,
"disabled": true
},
{
"key": "lineNum",
"value": "1",
"disabled": true
},
{
"key": "keyword",
"value": "h"
},
{
"key": "imageFlag",
"value": null,
"disabled": true
}
]
}
},
"response": []
}
],
"protocolProfileBehavior": {}
}
],
"protocolProfileBehavior": {}
}
\ No newline at end of file
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