{ "collection": { "info": { "_postman_id": "abd11111-afc1-1a11-ab11-fb1b111aae1b", "name": "crAPI Accepted", "description": "crAPI Training Scripts", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "updatedAt": "2024-05-21T09:06:43.000Z", "uid": "11111111-abd11111-afc1-1a11-ab11-fb1b111aae1b", "createdAt": null, "lastUpdatedBy": null }, "item": [ { "name": "Signup example.com", "event": [ { "listen": "test", "script": { "id": "212edd4c-4269-4ec5-84f7-bcddae94fbf2", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "d91fc02a-4d94-4f60-a834-1508ba0d69a7", "exec": [ "const {Property} = require('postman-collection');", "var xff = Property.replaceSubstitutions('{{$randomIP}}');", "pm.collectionVariables.set(\"X-Forwarded-For\", xff);", "pm.request.headers.remove('X-Forwarded-For');", "pm.request.headers.add({ ", " // These keys appears when you set a header by hand. Just for fun they are here", " disabled: false,", " // Your header, effectively", " key: 'X-Forwarded-For', ", " value: xff", "});", "let name = Property.replaceSubstitutions('{{$randomFirstName}}.{{$randomLastName}}');", "pm.collectionVariables.set(\"name\", name);", "let newName = Property.replaceSubstitutions('{{$randomFirstName}}.{{$randomLastName}}');", "pm.collectionVariables.set(\"new_name\", newName);", "let email = name+\"@example.com\";", "let newEmail = newName+\"@example.com\";", "let pass = Property.replaceSubstitutions(\"{{$randomPassword}}\");", "let phone = Property.replaceSubstitutions(\"{{$randomPhoneNumber}}\").replace(/-/g,'');", "pm.collectionVariables.set(\"email\", email);", "pm.collectionVariables.set(\"new_email\", newEmail);", "pm.collectionVariables.set(\"password\", pass);", "pm.collectionVariables.set(\"name\", name);", "pm.collectionVariables.set(\"phone\", phone);", "console.log(email, newEmail, pass, phone);", "console.log(name );" ], "type": "text/javascript" } } ], "id": "73c92330-9c81-4526-a720-242a647bd1fa", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [ { "key": "User-Agent", "value": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36" }, { "key": "Content-Type", "value": "application/json" }, { "key": "Accept", "value": "*/*" } ], "body": { "mode": "raw", "raw": "{\"name\":\"{{name}}\",\"email\":\"{{email}}\",\"number\":\"{{phone}}\",\"password\":\"{{password}}\"}" }, "url": { "raw": "{{url}}/identity/api/auth/signup", "host": [ "{{url}}" ], "path": [ "identity", "api", "auth", "signup" ] } }, "response": [], "uid": "13872198-73c92330-9c81-4526-a720-242a647bd1fa" }, { "name": "Login", "event": [ { "listen": "test", "script": { "id": "fc0cb347-ad16-46de-9985-207c5146d7c5", "exec": [ "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", " var jsonData = JSON.parse(responseBody);", " pm.collectionVariables.set(\"token\", jsonData.token);", " var token = pm.collectionVariables.get(\"token\");", " pm.test(\"Token is set\", function () {", " pm.expect(jsonData.token).to.eql(token);", " });", "});", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "c0a43741-3b36-48c0-be1a-9e5595f57c11", "exec": [ "const {Property} = require('postman-collection');\r", "var xff = pm.collectionVariables.get('X-Forwarded-For');\r", "if (!xff){\r", " xff = Property.replaceSubstitutions('{{$randomIP}}');\r", " console.log(\"X-Forwarded-For setting XFF to \"+xff);\r", " \r", "}\r", "console.log(\"X-Forwarded-For setting XFF to \"+xff);\r", "pm.collectionVariables.set(\"X-Forwarded-For\", xff);\r", "pm.request.headers.remove('X-Forwarded-For');\r", "pm.request.headers.add({ \r", " // These keys appears when you set a header by hand. Just for fun they are here\r", " disabled: false,\r", " // Your header, effectively\r", " key: 'X-Forwarded-For', \r", " value: xff\r", "});\r", "" ], "type": "text/javascript" } } ], "id": "5f9c7b75-681c-43aa-9d80-448f7907669c", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [ { "key": "User-Agent", "value": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36" }, { "key": "Content-Type", "value": "application/json" }, { "key": "Accept", "value": "*/*" } ], "body": { "mode": "raw", "raw": "{\"email\":\"{{email}}\",\"password\":\"{{password}}\"}" }, "url": { "raw": "{{url}}/identity/api/auth/login", "host": [ "{{url}}" ], "path": [ "identity", "api", "auth", "login" ] } }, "response": [], "uid": "13872198-5f9c7b75-681c-43aa-9d80-448f7907669c" }, { "name": "Verify JWT Token", "event": [ { "listen": "test", "script": { "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript", "id": "ed5c1a2a-44dd-4cd7-8adc-d094cd7fdae8" } } ], "id": "c4ffff4d-e81c-405d-a8c0-caf9299b8020", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"token\": \"{{token}}\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{url}}/identity/api/auth/verify", "host": [ "{{url}}" ], "path": [ "identity", "api", "auth", "verify" ] } }, "response": [], "uid": "13872198-c4ffff4d-e81c-405d-a8c0-caf9299b8020" }, { "name": "Forgot Password", "event": [ { "listen": "test", "script": { "exec": [ "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", " var jsonData = JSON.parse(responseBody);", " pm.test(\"Body matches string\", function () {", " pm.expect(pm.response.text()).to.include(\"OTP Sent\");", " });", "});", "" ], "type": "text/javascript", "id": "01bbbbc5-87cd-4337-af44-5a9433e4bf1c" } }, { "listen": "prerequest", "script": { "exec": [ "const {Property} = require('postman-collection');\r", "var xff = pm.collectionVariables.get('X-Forwarded-For');\r", "if (!xff){\r", " xff = Property.replaceSubstitutions('{{$randomIP}}');\r", " console.log(\"X-Forwarded-For setting XFF to \"+xff);\r", " \r", "}\r", "pm.collectionVariables.set(\"X-Forwarded-For\", xff);\r", "pm.request.headers.remove('X-Forwarded-For');\r", "pm.request.headers.add({ \r", " // These keys appears when you set a header by hand. Just for fun they are here\r", " disabled: false,\r", " // Your header, effectively\r", " key: 'X-Forwarded-For', \r", " value: xff\r", "});" ], "type": "text/javascript", "id": "902385be-d824-4990-8e17-022fe8a0313f" } } ], "id": "fff7f353-9fbc-457f-97c1-42b7fa4b1024", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [ { "key": "User-Agent", "value": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36" }, { "key": "Content-Type", "value": "application/json" }, { "key": "Accept", "value": "*/*" } ], "body": { "mode": "raw", "raw": "{\"email\":\"{{email}}\"}" }, "url": { "raw": "{{url}}/identity/api/auth/forget-password", "host": [ "{{url}}" ], "path": [ "identity", "api", "auth", "forget-password" ] } }, "response": [], "uid": "13872198-fff7f353-9fbc-457f-97c1-42b7fa4b1024" }, { "name": "SearchMailOTP", "event": [ { "listen": "test", "script": { "id": "eed6b360-55c8-43f2-ad6a-4f8e1e8a1da3", "exec": [ "", "", "function dynamicSort(property) {", " var sortOrder = 1;", " if(property[0] === \"-\") {", " sortOrder = -1;", " property = property.substr(1);", " }", " return function (a,b) {", " /* next line works with strings and numbers, ", " * and you may want to customize it to your needs", " */", " var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;", " return result * sortOrder;", " }", "}", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", " var jsonData = JSON.parse(responseBody);", " var mails = jsonData.items;", "", " pm.test(\"Get OTP\", function () {", " pm.expect(mails.length).to.be.gt(0);", " var mail = mails[0];", " console.log(mail);", " //mails.sort(dynamicSort(\"Created\"));", " var mail = mails[0];", " var mbody = mail['Raw']['Data'].replace(/[^a-zA-Z0-9<>:]*\\n/g, \"\");", " console.log(mail);", " var otpmatch = mbody.match(/generated otp is: ([0-9]+)/);", " console.log(otpmatch);", " var otp = otpmatch[1]", " console.log(\"OTP: \"+ otp);", " pm.collectionVariables.set(\"OTP\", otp);", " });", " ", "});", "" ], "type": "text/javascript", "packages": {} } }, { "listen": "prerequest", "script": { "id": "42443fb8-3a72-4d37-ab36-597308aff3d2", "exec": [ "const {Property} = require('postman-collection');\r", "var xff = pm.collectionVariables.get('X-Forwarded-For');\r", "if (!xff){\r", " xff = Property.replaceSubstitutions('{{$randomIP}}');\r", " console.log(\"X-Forwarded-For setting XFF to \"+xff);\r", " \r", "}\r", "pm.collectionVariables.set(\"X-Forwarded-For\", xff);\r", "pm.request.headers.remove('X-Forwarded-For');\r", "pm.request.headers.add({ \r", " // These keys appears when you set a header by hand. Just for fun they are here\r", " disabled: false,\r", " // Your header, effectively\r", " key: 'X-Forwarded-For', \r", " value: xff\r", "});" ], "type": "text/javascript", "packages": {} } } ], "id": "437e1354-581b-4a26-94a8-1ff508ac8420", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "method": "GET", "header": [ { "key": "User-Agent", "value": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36" }, { "key": "Content-Type", "value": "application/json" }, { "key": "Accept", "value": "*/*" } ], "url": { "raw": "{{url_mail}}/api/v2/search?kind=to&query={{email}}&limit=10", "host": [ "{{url_mail}}" ], "path": [ "api", "v2", "search" ], "query": [ { "key": "kind", "value": "to" }, { "key": "query", "value": "{{email}}" }, { "key": "limit", "value": "10" } ] } }, "response": [], "uid": "13872198-437e1354-581b-4a26-94a8-1ff508ac8420" }, { "name": "Check OTP", "event": [ { "listen": "test", "script": { "exec": [ "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "" ], "type": "text/javascript", "id": "a8af689c-e601-43b1-bb64-0b8224908bce" } }, { "listen": "prerequest", "script": { "exec": [ "const {Property} = require('postman-collection');\r", "var xff = pm.collectionVariables.get('X-Forwarded-For');\r", "if (!xff){\r", " xff = Property.replaceSubstitutions('{{$randomIP}}');\r", " console.log(\"X-Forwarded-For setting XFF to \"+xff);\r", " \r", "}\r", "pm.collectionVariables.set(\"X-Forwarded-For\", xff);\r", "pm.request.headers.remove('X-Forwarded-For');\r", "pm.request.headers.add({ \r", " // These keys appears when you set a header by hand. Just for fun they are here\r", " disabled: false,\r", " // Your header, effectively\r", " key: 'X-Forwarded-For', \r", " value: xff\r", "});" ], "type": "text/javascript", "id": "ba8abbec-945d-48f3-9f9a-d407cfbc2571" } } ], "id": "a45abeb7-f6c3-405d-bd01-3c79786d321b", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "auth": { "type": "noauth" }, "method": "POST", "header": [ { "key": "User-Agent", "value": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36" }, { "key": "Content-Type", "value": "application/json" }, { "key": "Accept", "value": "*/*" } ], "body": { "mode": "raw", "raw": "{\n \"email\": \"{{email}}\",\n \"otp\": \"{{OTP}}\",\n \"password\": \"{{password}}\"\n}" }, "url": { "raw": "{{url}}/identity/api/auth/v3/check-otp", "host": [ "{{url}}" ], "path": [ "identity", "api", "auth", "v3", "check-otp" ] } }, "response": [], "uid": "13872198-a45abeb7-f6c3-405d-bd01-3c79786d321b" }, { "name": "Resend vehicle email", "event": [ { "listen": "test", "script": { "id": "9c1dc5cd-e1d6-4c3b-8bfd-52ae448c4595", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "3eebacdf-ed5a-43f7-9ed5-fce2bd2447ce", "exec": [ "const {Property} = require('postman-collection');\r", "var xff = pm.collectionVariables.get('X-Forwarded-For');\r", "if (!xff){\r", " xff = Property.replaceSubstitutions('{{$randomIP}}');\r", " console.log(\"X-Forwarded-For setting XFF to \"+xff);\r", " \r", "}\r", "pm.collectionVariables.set(\"X-Forwarded-For\", xff);\r", "pm.request.headers.remove('X-Forwarded-For');\r", "pm.request.headers.add({ \r", " // These keys appears when you set a header by hand. Just for fun they are here\r", " disabled: false,\r", " // Your header, effectively\r", " key: 'X-Forwarded-For', \r", " value: xff\r", "});" ], "type": "text/javascript" } } ], "id": "598598c0-9905-4291-beef-3199c4a80ef7", "protocolProfileBehavior": { "disableBodyPruning": true }, "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "User-Agent", "value": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36" }, { "key": "Content-Type", "value": "application/json" }, { "key": "Accept", "value": "*/*" } ], "url": { "raw": "{{url}}/identity/api/v2/vehicle/resend_email", "host": [ "{{url}}" ], "path": [ "identity", "api", "v2", "vehicle", "resend_email" ] } }, "response": [], "uid": "13872198-598598c0-9905-4291-beef-3199c4a80ef7" }, { "name": "SearchMailVehicle", "event": [ { "listen": "test", "script": { "exec": [ "", "function dynamicSort(property) {", " var sortOrder = 1;", " if(property[0] === \"-\") {", " sortOrder = -1;", " property = property.substr(1);", " }", " return function (a,b) {", " /* next line works with strings and numbers, ", " * and you may want to customize it to your needs", " */", " var result = (a[property] < b[property]) ? -1 : (a[property] > b[property]) ? 1 : 0;", " return result * sortOrder;", " }", "}", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", " var jsonData = JSON.parse(responseBody);", " var mails = jsonData.items;", "", " pm.test(\"Your test name\", function () {", " pm.expect(mails.length).to.be.gt(0);", " console.log(mails[0]);", " //mails.sort(dynamicSort(\"Created\"));", " console.log(mails[0]);", " var mail = mails[0];", " var mbody = mail['Raw']['Data'].replace(/[^a-zA-Z0-9<>:]*\\n/g, \"\");", " var vintext = mbody.match(/VIN(.*)Pincode/i);", " console.log(vintext);", " var VIN = vintext[1].match(/>([A-Za-z0-9]+)([0-9]+) b[property]) ? 1 : 0;", " return result * sortOrder;", " }", "}", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", " var jsonData = JSON.parse(responseBody);", " var mails = jsonData.items;", "", " pm.test(\"Get Token\", function () {", " pm.expect(mails.length).to.be.gt(0);", " //mails.sort(dynamicSort(\"Created\"));", " var mail = mails[0];", " var mbody = mail['Raw']['Data'].replace(/[^a-zA-Z0-9<>:]*\\n/g, \"\");", " console.log(mbody);", " var tokentext = mbody.match(/token:\\s*[^\\s]+/i);", " console.log(tokentext);", " var email_token = tokentext[0].match(/>([A-Za-z0-9]+) b[property]) ? 1 : 0;", " return result * sortOrder;", " }", "}", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", " var jsonData = JSON.parse(responseBody);", " var mails = jsonData.items;", "", " pm.test(\"Get Token\", function () {", " pm.expect(mails.length).to.be.gt(0);", " //mails.sort(dynamicSort(\"Created\"));", " var mail = mails[0];", " var mbody = mail['Raw']['Data'].replace(/[^a-zA-Z0-9<>:]*\\n/g, \"\");", " console.log(mbody);", " var tokentext = mbody.match(/token:\\s*[^\\s]+/i);", " console.log(tokentext);", " var email_token = tokentext[0].match(/>([A-Za-z0-9]+)