{ "info": { "_postman_id": "ccd6117a-6d61-4617-a6a1-7115db4d4d92", "name": "WAVE Server REST API Tests", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "Read Available Tests", "item": [ { "name": "Read Available Tests", "event": [ { "listen": "test", "script": { "id": "051bef94-5544-4ddb-9d85-167677ebecb2", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var availableTests = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(typeof availableTests).to.equal(\"object\");", " for (var api of Object.keys(availableTests)) {", " pm.expect(availableTests[api]).to.be.an.instanceof(Array);", " var apiRegExp = new RegExp(\"^/\" + api, \"i\");", " for (var test of availableTests[api]) {", " pm.expect(test).to.match(apiRegExp);", " }", " }", "});", "", "var includedTests = [];", "var excludedTests = [];", "var specialTimeoutTest = \"\";", "", "var apis = Object.keys(availableTests);", "for(var api of apis) {", " if (availableTests[api].length > 50) {", " var subDirs = availableTests[api].map(test => test.split(\"/\").filter(part => !!part).join(\"/\").split(\"/\")[1]).reduce((acc, curr) => acc.indexOf(curr) === -1 ? acc.concat([curr]) : acc, []);", " if (subDirs.length > 2) {", " includedTests.push(\"/\" + api);", " excludedTests.push(\"/\" + api + \"/\" + subDirs[0]);", " specialTimeoutTest = availableTests[api][availableTests[api].length - 1];", " break;", " }", " ", " }", "}", "", "pm.globals.set(\"available_tests\", JSON.stringify(availableTests));", "pm.globals.set(\"included_tests\", JSON.stringify(includedTests));", "pm.globals.set(\"excluded_tests\", JSON.stringify(excludedTests));", "pm.globals.set(\"special_timeout_test\", specialTimeoutTest.replace(\".\", \"\"));" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests" ] } }, "response": [] } ], "protocolProfileBehavior": {} }, { "name": "Create and Read Sessions", "item": [ { "name": "Start expiring session remove expiration date", "item": [ { "name": "Create Session With Expiration", "event": [ { "listen": "test", "script": { "id": "a8bf3e41-a7df-4c6b-8a20-3a1e6d8a51d9", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "4370546f-b08c-4f77-9bd9-1cd14400665e", "exec": [ "var expirationDate = Date.now() + 10000;", "pm.globals.set(\"expiration_date\", expirationDate);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n\t\"expiration_date\": {{expiration_date}}\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "3dcb5b6c-9151-49f7-a1a6-74475927b304", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"JSON structure contains expiration date\", function () {", " pm.expect(jsonData).to.have.property(\"expiration_date\");", "});", "", "var expirationDate = pm.globals.get(\"expiration_date\");", "", "pm.test(\"Expiration date is as specified\", function () {", " pm.expect(Date.parse(jsonData.expiration_date)).to.equal(expirationDate);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] }, { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "8d05578a-e2d6-41e9-a2a4-aa7d92bfbbce", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "4c5e3ba4-e27b-4341-8cf8-74ed047a8747", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"JSON structure contains expiration date\", function () {", " pm.expect(jsonData).to.have.property(\"expiration_date\");", "});", "", "pm.test(\"Expiration date is null\", function () {", " pm.expect(jsonData.expiration_date).to.be.null;", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] }, { "name": "Clean Up", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {} }, { "name": "Read Public Sessions", "item": [ { "name": "Read Public Sessions", "event": [ { "listen": "test", "script": { "id": "1081afd8-a772-4565-b03d-b58f773cbb65", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Response is JSON Array\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.be.an.instanceof(Array);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/public", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "public" ] } }, "response": [] } ], "protocolProfileBehavior": {} }, { "name": "Find Session", "item": [ { "name": "Create Session No Configuration", "event": [ { "listen": "test", "script": { "id": "268e8a31-87bb-4ec5-81d5-87dc74096828", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Find Session Token", "event": [ { "listen": "prerequest", "script": { "id": "625fcc2a-f7b1-403c-b5c5-56db7c5bcee5", "exec": [ "const token = pm.globals.get(\"session_token\");", "pm.globals.set(\"session_token_fragment\", token.split(\"-\").shift());" ], "type": "text/javascript" } }, { "listen": "test", "script": { "id": "8e04212f-e259-413f-98ee-e366cd3adfdd", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const sessionToken = pm.globals.get(\"session_token\");", "", "pm.test(\"Found token is original token\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.token).to.equal(sessionToken);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token_fragment}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token_fragment}}" ] } }, "response": [] }, { "name": "Clean Up", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Find Session Too Short Fragment", "event": [ { "listen": "prerequest", "script": { "id": "6f8429e3-9c12-423c-baaf-8f8de0e4ea49", "exec": [ "const token = pm.globals.get(\"session_token\");", "pm.globals.set(\"session_token_fragment\", token.split(\"-\").shift());" ], "type": "text/javascript" } }, { "listen": "test", "script": { "id": "7f6ef567-274e-4f9d-b7fc-50f8240547e9", "exec": [ "pm.test(\"Status code is 404\", function () {", " pm.response.to.have.status(404);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/1234567", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "1234567" ] } }, "response": [] } ], "protocolProfileBehavior": {} }, { "name": "Read Next Test", "item": [ { "name": "Clean Up", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Next Test of Invalid Session", "event": [ { "listen": "test", "script": { "id": "11f5c620-dc3b-4a8c-8d2f-f9663025c79f", "exec": [ "pm.test(\"Status code is 404\", function () {", " pm.response.to.have.status(404);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "next" ] } }, "response": [] }, { "name": "Create Session \\w Configuration", "event": [ { "listen": "test", "script": { "id": "c67cde7e-7237-479c-a0c6-b84a533c3b1e", "exec": [ "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "24b38d64-5c24-415f-b6f6-f8d252d69ac8", "exec": [ "var automaticTimeout = 120000;", "var manualTimeout = 1000000;", "var specialTimeout = 2000;", "", "pm.globals.set(\"automatic_timeout\", automaticTimeout);", "pm.globals.set(\"manual_timeout\", manualTimeout);", "pm.globals.set(\"special_timeout\", specialTimeout);", "", "const availableTests = JSON.parse(pm.globals.get(\"available_tests\"));", "const test1 = availableTests[Object.keys(availableTests)[0]][0];", "", "pm.globals.set(\"single_test_1\", test1);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"tests\": {\n \"include\": [\"{{single_test_1}}\"]\n },\n \"types\": [\n \"automatic\",\n \"manual\"\n ]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read Next Test of Pending Session", "event": [ { "listen": "test", "script": { "id": "0806e4e0-bd1b-40ba-a7d5-74d41473a141", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const nextTest = jsonData.next_test;", "const test = \"/\" + nextTest.split(\"/\").slice(3).join(\"/\").split(\"?\")[0];", "", "const web_root = pm.environment.get(\"web_root\");", "", "pm.test(\"Returned test is new session page\", function () {", " pm.expect(test).to.equal(\"/\" + web_root + \"/newsession.html\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "next" ] } }, "response": [] }, { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "9b1f2dec-9949-49ff-b466-f602b11dde5d", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Read Next Test of Running Session", "event": [ { "listen": "test", "script": { "id": "7fea2977-5ccb-49ee-8f07-79a7f2245f9c", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const nextTest = jsonData.next_test;", "const parameters = nextTest.split(\"?\")[1].split(\"&\");", "let test = parameters.find(parameter => parameter.split(\"=\")[0] === \"test_url\").split(\"=\")[1];", "test = decodeURIComponent(test);", "test = \"/\" + test.split(\"/\").slice(3).join(\"/\").split(\"?\")[0];", "const api = test.split(\"/\").filter(part => !!part)[0]", "const availableTests = JSON.parse(pm.globals.get(\"available_tests\"));", "", "pm.test(\"Returned test is valid test\", function () {", " pm.expect(availableTests).to.have.property(api);", " pm.expect(availableTests[api]).to.contain(test)", "});", "", "", "setTimeout(function () {}, 1000);" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "next" ] } }, "response": [] }, { "name": "Create Result", "event": [ { "listen": "test", "script": { "id": "7cc27ee8-2f06-4e25-98fb-9872c6cf0d93", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"test\": \"{{current_test}}\",\n \"status\": \"OK\",\n \"message\": null,\n \"subtests\": [\n {\n \"name\": \"Subtest testing feature xy\",\n \"status\": \"FAIL\",\n \"message\": \"Error message\"\n }\n ]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Next Test of Completed Session", "event": [ { "listen": "test", "script": { "id": "0a73a5eb-3edb-4d15-924d-260dd22bd831", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const nextTest = jsonData.next_test;", "const test = \"/\" + nextTest.split(\"/\").slice(3).join(\"/\").split(\"?\")[0];", "", "const web_root = pm.environment.get(\"web_root\");", "", "pm.test(\"Returned test is new session page\", function () {", " pm.expect(test).to.equal(\"/\" + web_root + \"/finish.html\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "next" ] } }, "response": [] }, { "name": "Clean Up", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Create Session \\w Configuration Copy", "event": [ { "listen": "test", "script": { "id": "94877ec6-70ea-4c78-acb5-20060a535653", "exec": [ "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "dcc29092-b7a1-40fc-8359-ecc655dba482", "exec": [ "var automaticTimeout = 120000;", "var manualTimeout = 1000000;", "var specialTimeout = 2000;", "", "pm.globals.set(\"automatic_timeout\", automaticTimeout);", "pm.globals.set(\"manual_timeout\", manualTimeout);", "pm.globals.set(\"special_timeout\", specialTimeout);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"tests\": {\n \"include\": {{included_tests}},\n \"exclude\": {{excluded_tests}}\n },\n \"types\": [\n \"automatic\",\n \"manual\"\n ],\n \"timeouts\": {\n \"automatic\": 1000\n },\n \"labels\": [\"label1\", \"label2\"]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "8f6e2bf2-6c1e-434e-83c5-9bcc57880692", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Pause Session", "event": [ { "listen": "test", "script": { "id": "a0a80c05-a2ca-430a-8bed-46ad7978c684", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/pause", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "pause" ] } }, "response": [] }, { "name": "Read Next Test of Aborted Session", "event": [ { "listen": "test", "script": { "id": "00d823e0-2059-4cab-81d6-8d1de9e5b62a", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const nextTest = jsonData.next_test;", "const test = \"/\" + nextTest.split(\"/\").slice(3).join(\"/\").split(\"?\")[0];", "", "const web_root = pm.environment.get(\"web_root\");", "", "pm.test(\"Returned test is new session page\", function () {", " pm.expect(test).to.equal(\"/\" + web_root + \"/pause.html\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "next" ] } }, "response": [] }, { "name": "Stop Session", "event": [ { "listen": "test", "script": { "id": "b8211c13-667d-4970-aedc-6398c25cc40c", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/stop", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "stop" ] } }, "response": [] }, { "name": "Read Next Test of Aborted Session", "event": [ { "listen": "test", "script": { "id": "8aad813d-53fe-49fd-bdfc-f16ce2233ae2", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const nextTest = jsonData.next_test;", "const test = \"/\" + nextTest.split(\"/\").slice(3).join(\"/\").split(\"?\")[0];", "", "const web_root = pm.environment.get(\"web_root\");", "", "pm.test(\"Returned test is new session page\", function () {", " pm.expect(test).to.equal(\"/\" + web_root + \"/finish.html\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "next" ] } }, "response": [] }, { "name": "Clean Up", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {} }, { "name": "Control Session", "item": [ { "name": "Setup", "item": [ { "name": "Create Session No Configuration", "event": [ { "listen": "test", "script": { "id": "305cb915-8496-4577-b17a-e8189d66c3d1", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Pause Pending Session", "item": [ { "name": "Pause Session", "event": [ { "listen": "test", "script": { "id": "9d903165-9667-43b0-b210-a950d0fa1fa2", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/pause", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "pause" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "0307919b-6630-48ff-ac18-10c0a47ea254", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is pending\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"pending\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Start Pending Session", "item": [ { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "f66408d5-5438-4d4f-9bfc-6d24b15e5a90", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "bae5542d-446b-4064-88ff-cc355a8f4f62", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "pm.test(\"Status is running\", function () {", " pm.expect(jsonData.status).to.equal(\"running\");", "});", "", "pm.test(\"Start date is set\", function () {", " pm.expect(Date.parse(jsonData.date_started)).to.be.below(Date.now());", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Start Running Session", "item": [ { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "3b386952-8a37-471a-9192-f28974d975a3", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "8e56d842-325b-4356-ae1a-2465e9efe188", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is running\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"running\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Pause Running Session", "item": [ { "name": "Pause Session", "event": [ { "listen": "test", "script": { "id": "a183cb0b-31f0-48f6-9c20-605a16488d7d", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/pause", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "pause" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "f2610594-813a-4079-afae-1510486efab4", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is paused\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"paused\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Pause Paused Session", "item": [ { "name": "Pause Session", "event": [ { "listen": "test", "script": { "id": "6b8ec98a-ad91-4d5c-aa07-6b3cc1255902", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/pause", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "pause" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "91a38eb8-a501-457f-a9f4-b63221c957f6", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is paused\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"paused\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Start Paused Session", "item": [ { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "6e3a8c64-04cb-4c4f-b23d-64655f6e4d22", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "dcf7f6f4-6eef-4a90-a63d-df70446eb209", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is running\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"running\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Stop Running Session", "item": [ { "name": "Stop Session", "event": [ { "listen": "test", "script": { "id": "bee7a70d-af1f-4ad1-9c40-7abdbcc983ae", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/stop", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "stop" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "217ed267-1ddb-496a-a7c5-6e29bad97c60", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "pm.test(\"Status is aborted\", function () {", " pm.expect(jsonData.status).to.equal(\"aborted\");", "});", "", "pm.test(\"Finish date is set\", function () {", " pm.expect(Date.parse(jsonData.date_finished)).to.be.below(Date.now());", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Stop Aborted Session", "item": [ { "name": "Stop Session", "event": [ { "listen": "test", "script": { "id": "a255ea61-5c5a-4f0d-8a67-c244510a608c", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/stop", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "stop" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "9cc7599b-d378-4b04-bada-9d76f6ca610f", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is aborted\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"aborted\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "id": "81e44e3f-5d91-42a7-b0ab-4704eb121868", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "a44180cb-3b13-421b-b146-82901f2b45bd", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Start Aborted Session", "item": [ { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "47fb1fa9-4849-4ea9-b36e-fcec8decf62e", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "1923ced4-4361-4a4a-bf7c-4fcdf3df50f6", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is aborted\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"aborted\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "id": "226043e5-1a81-4d36-aa7f-67b10bf407af", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "840bf970-0984-452e-9076-b6f66d0b4511", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Pause Aborted Session", "item": [ { "name": "Pause Session", "event": [ { "listen": "test", "script": { "id": "88c4072f-538b-4d68-9d61-f0fb017e544c", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/pause", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "pause" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "2ae00eb3-49e8-4487-b27f-e7c7955fe4f4", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is aborted\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"aborted\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "id": "70e0c783-c405-481c-b9c8-5c8bee392f97", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "85c45e3b-fae6-4a90-afd0-97678769e32c", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Setup", "item": [ { "name": "Clean Up", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Create Session No Configuration", "event": [ { "listen": "test", "script": { "id": "df4a00d1-d4f8-4b0b-892d-21528165a2cf", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "id": "4fa59617-c922-4826-abc6-6d910e918ea4", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "d83f449d-4a2e-41c8-b2cd-5cf0cd1c404e", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Stop Pending Session", "item": [ { "name": "Stop Session", "event": [ { "listen": "test", "script": { "id": "98da2b86-4f9f-47dd-afc9-22ce96e73e84", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/stop", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "stop" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "6d8a8202-c85d-4ada-b443-45108a372aea", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is aborted\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"aborted\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Setup", "item": [ { "name": "Clean Up", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Create Session No Configuration", "event": [ { "listen": "test", "script": { "id": "0f9df486-91cd-46fc-a711-5cf9bebb2706", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "80ee91fd-98ca-4b8e-83b6-32bf3e55a295", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Pause Session", "event": [ { "listen": "test", "script": { "id": "47f4d26a-84c2-4980-984d-dac0e95503e1", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/pause", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "pause" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "id": "6bd9e85f-eb73-47be-83b0-01be77868899", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "43ebfadb-dc68-4c41-b34e-462e427dc2ef", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Stop Paused Session Copy", "item": [ { "name": "Stop Session", "event": [ { "listen": "test", "script": { "id": "029ec84b-e41b-4744-8745-58c50e52bb11", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/stop", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "stop" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "071d757c-41aa-4b52-9ab4-6c2afd6ed2af", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is aborted\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"aborted\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "id": "305720a0-2c84-43d3-8fe5-55f8fdf511d8", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "84e4ab04-5acc-4428-a81a-c0b0c53b5fd9", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Setup", "item": [ { "name": "Clean Up", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Create Session One Test", "event": [ { "listen": "test", "script": { "id": "b7a9d459-9b39-40b2-abdc-fd8fe8b21d61", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "fcbfb0e3-a10d-4ff8-afed-f5f3c9d52090", "exec": [ "const availableTests = JSON.parse(pm.globals.get(\"available_tests\"));", "const test = availableTests[Object.keys(availableTests)[0]][0]", "", "pm.globals.set(\"single_test\", test);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"tests\": {\n \"include\": [\"{{single_test}}\"]\n }\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "937ef61d-d6d6-4e24-bc3a-696a23cc95d6", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Read Next Test of Session", "event": [ { "listen": "test", "script": { "id": "29f0554b-66f5-4e26-80ff-39b3faba920a", "exec": [ "const response = pm.response.json();", "const nextTest = response.next_test;", "pm.globals.set(\"current_test_url\", nextTest);", "if (!nextTest) return;", "const parameters = nextTest.split(\"?\")[1].split(\"&\");", "let test = parameters.find(parameter => parameter.split(\"=\")[0] === \"test_url\").split(\"=\")[1];", "test = decodeURIComponent(test);", "test = \"/\" + test.split(\"/\").slice(3).join(\"/\").split(\"?\")[0];", "pm.globals.set(\"current_test\", test);" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "next" ] } }, "response": [] }, { "name": "Create Result", "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"test\": \"{{current_test}}\",\n \"status\": \"OK\",\n \"message\": null,\n \"subtests\": [\n {\n \"name\": \"Subtest testing feature xy\",\n \"status\": \"FAIL\",\n \"message\": \"Error message\"\n }\n ]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "id": "9bf66427-6f39-4f0a-b065-1849d679eee6", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "8d1f3837-1f05-47e4-897c-b7c74da9bd43", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Start Completed Session", "item": [ { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "9bf0fb70-24a0-4136-99fe-8e0e488afd1e", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "7e3184bf-1741-44c8-8cd3-cff30c2deca1", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is completed\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"completed\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Pause Completed Session", "item": [ { "name": "Pause Session", "event": [ { "listen": "test", "script": { "id": "e323c6af-d4e5-4a05-b203-09ba67f77d28", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/pause", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "pause" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "40cd04ce-850f-4903-bc24-2e62a4df98fe", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is completed\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"completed\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Stop Completed Session", "item": [ { "name": "Stop Session", "event": [ { "listen": "test", "script": { "id": "db7d5209-37b2-46bd-88ab-ce4e241401b2", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/stop", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "stop" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "477dc63d-0b43-4226-b86e-163e2de92b67", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Status is completed\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData.status).to.equal(\"completed\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Clean Up", "item": [ { "name": "Clean Up", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {} }, { "name": "Update and Read Sessions", "item": [ { "name": "Create Default", "item": [ { "name": "Create Session No Configuration", "event": [ { "listen": "test", "script": { "id": "b923d95e-a7b4-49d4-ab2a-1f435c454387", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read Session Configuration", "event": [ { "listen": "test", "script": { "id": "81f36759-7ae2-42b9-81d2-79f57046b46e", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"tests\");", " pm.expect(typeof jsonData.tests).to.equal(\"object\");", " pm.expect(jsonData.tests).to.have.property(\"include\");", " pm.expect(jsonData.tests.include).to.be.an.instanceof(Array);", " pm.expect(jsonData.tests).to.have.property(\"exclude\");", " pm.expect(jsonData.tests.exclude).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"types\");", " pm.expect(jsonData.types).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"user_agent\");", " pm.expect(typeof jsonData.user_agent).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"timeouts\");", " pm.expect(typeof jsonData.timeouts).to.equal(\"object\")", " pm.expect(jsonData.timeouts).to.have.property(\"automatic\");", " pm.expect(typeof jsonData.timeouts.automatic).to.equal(\"number\");", " pm.expect(jsonData.timeouts).to.have.property(\"manual\");", " pm.expect(typeof jsonData.timeouts.manual).to.equal(\"number\");", " pm.expect(jsonData).to.have.property(\"browser\");", " pm.expect(typeof jsonData.browser).to.equal(\"object\");", " pm.expect(jsonData.browser).to.have.property(\"name\");", " pm.expect(typeof jsonData.browser.name).to.equal(\"string\");", " pm.expect(jsonData.browser).to.have.property(\"version\");", " pm.expect(typeof jsonData.browser.version).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"reference_tokens\");", " pm.expect(jsonData.reference_tokens).to.be.an.instanceof(Array);", "});", "", "pm.test(\"Configuration is default\", function () {", " pm.expect(jsonData.token).to.match(tokenRegex);", " pm.expect(jsonData.tests.include).to.include(\"/\");", " pm.expect(jsonData.types).to.include(\"automatic\");", " pm.expect(jsonData.types).to.include(\"manual\");", " pm.expect(jsonData.user_agent).to.include(\"PostmanRuntime\");", " pm.expect(jsonData.timeouts.automatic).to.equal(60000);", " pm.expect(jsonData.timeouts.manual).to.equal(300000);", " pm.expect(jsonData.browser.name).to.equal(\"Other\");", " pm.expect(jsonData.browser.version).to.equal(\"0\");", " pm.expect(jsonData.is_public).to.equal(false);", " pm.expect(jsonData.reference_tokens).to.be.empty;", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "2873d554-9816-41f0-9051-fb2cb1272a76", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"status\");", " pm.expect(typeof jsonData.status).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"expiration_date\");", " pm.expect(jsonData.expiration_date).to.be.null;", " pm.expect(jsonData).to.have.property(\"date_started\");", " pm.expect(jsonData.date_started).to.satisfy(value => !value || typeof value === \"number\");", " pm.expect(jsonData).to.have.property(\"date_finished\");", " pm.expect(jsonData.date_finished).to.satisfy(value => !value || typeof value === \"number\");", "});", "", "pm.test(\"Session status is pending\", function () {", " pm.expect(jsonData.status).to.equal(\"pending\");", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] }, { "name": "Read Tests of Session", "event": [ { "listen": "test", "script": { "id": "53605764-d4f0-4b32-9a30-67e84dd104d9", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"pending_tests\");", " pm.expect(typeof jsonData.pending_tests).to.equal(\"object\");", " pm.expect(jsonData).to.have.property(\"running_tests\");", " pm.expect(typeof jsonData.running_tests).to.equal(\"object\");", "});", "", "pm.test(\"All tests are pending tests\", function () {", " pm.expect(Object.keys(jsonData.pending_tests)).to.not.have.lengthOf(0);", " pm.expect(Object.keys(jsonData.running_tests)).to.have.lengthOf(0);", "})", "", "console.log(pm.globals.get(\"available_tests\"))", "const availableTests = JSON.parse(pm.globals.get(\"available_tests\"));", "", "pm.test(\"All available tests are part of the session\", function () {", " for (var api of Object.keys(jsonData.pending_tests)) {", " for (var test of jsonData.pending_tests[api]) {", " pm.expect(availableTests[api]).to.include(test);", " }", " }", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "id": "cf165ae9-1c44-483c-8fe4-bd7cdaa20710", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "6938d456-afd5-431b-a95f-a2c45a3ac479", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Update With Configuration", "item": [ { "name": "Update Session", "event": [ { "listen": "test", "script": { "id": "657be5b3-4a99-4415-a1ef-9dfdcf541e46", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "093a0019-a84c-44fc-b890-36369d51b7d5", "exec": [ "var automaticTimeout = 120000;", "var manualTimeout = 1000000;", "var specialTimeout = 2000;", "", "pm.globals.set(\"automatic_timeout\", automaticTimeout);", "pm.globals.set(\"manual_timeout\", manualTimeout);", "pm.globals.set(\"special_timeout\", specialTimeout);" ], "type": "text/javascript" } } ], "request": { "method": "PUT", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"tests\": {\n \"include\": {{included_tests}},\n \"exclude\": {{excluded_tests}}\n },\n \"types\": [\n \"automatic\",\n \"manual\"\n ],\n \"timeouts\": {\n \"automatic\": {{automatic_timeout}},\n \"manual\": {{manual_timeout}},\n \"{{special_timeout_test}}\": {{special_timeout}}\n }\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Session Configuration", "event": [ { "listen": "test", "script": { "id": "4ac55601-9bdf-41f8-9d59-ff1ee20fa471", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"tests\");", " pm.expect(typeof jsonData.tests).to.equal(\"object\");", " pm.expect(jsonData.tests).to.have.property(\"include\");", " pm.expect(jsonData.tests.include).to.be.an.instanceof(Array);", " pm.expect(jsonData.tests).to.have.property(\"exclude\");", " pm.expect(jsonData.tests.exclude).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"types\");", " pm.expect(jsonData.types).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"user_agent\");", " pm.expect(typeof jsonData.user_agent).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"timeouts\");", " pm.expect(typeof jsonData.timeouts).to.equal(\"object\")", " pm.expect(jsonData.timeouts).to.have.property(\"automatic\");", " pm.expect(typeof jsonData.timeouts.automatic).to.equal(\"number\");", " pm.expect(jsonData.timeouts).to.have.property(\"manual\");", " pm.expect(typeof jsonData.timeouts.manual).to.equal(\"number\");", " pm.expect(jsonData).to.have.property(\"browser\");", " pm.expect(typeof jsonData.browser).to.equal(\"object\");", " pm.expect(jsonData.browser).to.have.property(\"name\");", " pm.expect(typeof jsonData.browser.name).to.equal(\"string\");", " pm.expect(jsonData.browser).to.have.property(\"version\");", " pm.expect(typeof jsonData.browser.version).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"reference_tokens\");", " pm.expect(jsonData.reference_tokens).to.be.an.instanceof(Array);", "});", "", "var includedTests = JSON.parse(pm.globals.get(\"included_tests\"));", "var excludedTests = JSON.parse(pm.globals.get(\"excluded_tests\"));", "var automaticTimeout = pm.globals.get(\"automatic_timeout\");", "var manualTimeout = pm.globals.get(\"manual_timeout\");", "var specialTimeout = pm.globals.get(\"special_timeout\");", "var specialTimeoutTest = pm.globals.get(\"special_timeout_test\");", "", "pm.test(\"Configuration is as specified\", function () {", " pm.expect(jsonData.token).to.match(tokenRegex);", " for (var test of includedTests) {", " pm.expect(jsonData.tests.include).to.include(test);", " }", " for (var test of excludedTests) {", " pm.expect(jsonData.tests.exclude).to.include(test);", " }", " pm.expect(jsonData.types).to.include(\"automatic\");", " pm.expect(jsonData.types).to.include(\"manual\");", " pm.expect(jsonData.user_agent).to.include(\"PostmanRuntime\");", " pm.expect(jsonData.timeouts.automatic).to.equal(automaticTimeout);", " pm.expect(jsonData.timeouts.manual).to.equal(manualTimeout);", " pm.expect(jsonData.timeouts[specialTimeoutTest]).to.equal(specialTimeout);", " pm.expect(jsonData.browser.name).to.equal(\"Other\");", " pm.expect(jsonData.browser.version).to.equal(\"0\");", " pm.expect(jsonData.is_public).to.equal(false);", " pm.expect(jsonData.reference_tokens).to.be.empty;", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Tests of Session", "event": [ { "listen": "test", "script": { "id": "0b49c01b-e943-4879-b441-4093836d05e9", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"pending_tests\");", " pm.expect(typeof jsonData.pending_tests).to.equal(\"object\");", " pm.expect(jsonData).to.have.property(\"running_tests\");", " pm.expect(typeof jsonData.running_tests).to.equal(\"object\");", "});", "", "pm.test(\"All tests are pending tests\", function () {", " pm.expect(Object.keys(jsonData.pending_tests)).to.not.have.lengthOf(0);", " pm.expect(Object.keys(jsonData.running_tests)).to.have.lengthOf(0);", "})", "", "const availableTests = pm.globals.get(\"available_tests\");", "const includedTests = pm.globals.get(\"included_tests\");", "const excludedTests = pm.globals.get(\"excluded_tests\");", "", "pm.test(\"Selected subset of tests are part of the session\", function () {", " for (var api of Object.keys(jsonData.pending_tests)) {", " for (var includedTest of includedTests) {", " if (includedTest.split(\"/\").find(part => !!part) === api) {", " var includeRegExp = new RegExp(\"^\" + includedTest, \"i\");", " for (var test of jsonData.pending_tests[api]) {", " pm.expect(test).to.match(regex);", " }", " break;", " }", " }", " for (var excludedTest of excludedTests) {", " if (excludedTest.split(\"/\").find(part => !!part) === api) {", " var excludeRegExp = new RegExp(\"^\" + excludedTest, \"i\");", " for (var test of jsonData.pending_tests[api]) {", " pm.expect(test).to.not.match(regex);", " }", " break;", " }", " }", " }", "});", "", "const sessionTests = jsonData.pending_tests;", "", "pm.globals.set(\"session_tests\", JSON.stringify(sessionTests));" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "b9cba19f-88d2-41f6-940a-a0979da05500", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"status\");", " pm.expect(typeof jsonData.status).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"expiration_date\");", " pm.expect(jsonData.expiration_date).to.be.null;", " pm.expect(jsonData).to.have.property(\"date_started\");", " pm.expect(jsonData.date_started).to.satisfy(value => !value || typeof value === \"number\");", " pm.expect(jsonData).to.have.property(\"date_finished\");", " pm.expect(jsonData.date_finished).to.satisfy(value => !value || typeof value === \"number\");", "});", "", "pm.test(\"Session status is pending\", function () {", " pm.expect(jsonData.status).to.equal(\"pending\");", "})", "", "pm.test(\"Start and Finish date not set\", function () {", " pm.expect(jsonData.date_started).to.be.null;", " pm.expect(jsonData.date_finished).to.be.null;", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] }, { "name": "Clean Up", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "id": "3669c70a-88bc-4854-abac-5cb80a21c392", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "1a81f5c5-28d8-4935-b8ae-822e33c23da9", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {} }, { "name": "Update Session Labels", "item": [ { "name": "Create Session \\w Configuration Copy", "event": [ { "listen": "test", "script": { "id": "9de9321c-ae78-4abd-a740-6634e2cbb9b9", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "739284e7-17ac-4c34-baa1-933353eb7ecc", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"labels\": [\"label1\", \"label2\"]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read Session Configuration", "event": [ { "listen": "test", "script": { "id": "5b15f338-c773-4f48-8f78-1d7c926beb81", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"tests\");", " pm.expect(typeof jsonData.tests).to.equal(\"object\");", " pm.expect(jsonData.tests).to.have.property(\"include\");", " pm.expect(jsonData.tests.include).to.be.an.instanceof(Array);", " pm.expect(jsonData.tests).to.have.property(\"exclude\");", " pm.expect(jsonData.tests.exclude).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"types\");", " pm.expect(jsonData.types).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"user_agent\");", " pm.expect(typeof jsonData.user_agent).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"timeouts\");", " pm.expect(typeof jsonData.timeouts).to.equal(\"object\")", " pm.expect(jsonData.timeouts).to.have.property(\"automatic\");", " pm.expect(typeof jsonData.timeouts.automatic).to.equal(\"number\");", " pm.expect(jsonData.timeouts).to.have.property(\"manual\");", " pm.expect(typeof jsonData.timeouts.manual).to.equal(\"number\");", " pm.expect(jsonData).to.have.property(\"browser\");", " pm.expect(typeof jsonData.browser).to.equal(\"object\");", " pm.expect(jsonData.browser).to.have.property(\"name\");", " pm.expect(typeof jsonData.browser.name).to.equal(\"string\");", " pm.expect(jsonData.browser).to.have.property(\"version\");", " pm.expect(typeof jsonData.browser.version).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"reference_tokens\");", " pm.expect(jsonData.reference_tokens).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"labels\");", " pm.expect(jsonData.labels).to.be.an.instanceof(Array);", "});", "", "pm.test(\"Configuration is default\", function () {", " pm.expect(jsonData.token).to.match(tokenRegex);", " pm.expect(jsonData.tests.include).to.include(\"/\");", " pm.expect(jsonData.types).to.include(\"automatic\");", " pm.expect(jsonData.types).to.include(\"manual\");", " pm.expect(jsonData.user_agent).to.include(\"PostmanRuntime\");", " pm.expect(jsonData.timeouts.automatic).to.equal(60000);", " pm.expect(jsonData.timeouts.manual).to.equal(300000);", " pm.expect(jsonData.browser.name).to.equal(\"Other\");", " pm.expect(jsonData.browser.version).to.equal(\"0\");", " pm.expect(jsonData.is_public).to.equal(false);", " pm.expect(jsonData.reference_tokens).to.be.empty;", " pm.expect(jsonData.labels).to.include(\"label1\");", " pm.expect(jsonData.labels).to.include(\"label2\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Update Labels Copy", "event": [ { "listen": "test", "script": { "id": "e69b7188-b3c9-4f66-8c6c-3f3348f84f6a", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "PUT", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n\t\"labels\": [\"new\", \"labels\"]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/labels", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "labels" ] } }, "response": [] }, { "name": "Read Session Configuration", "event": [ { "listen": "test", "script": { "id": "86e20c4d-5797-4b6e-a8cc-14e284e7c491", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"tests\");", " pm.expect(typeof jsonData.tests).to.equal(\"object\");", " pm.expect(jsonData.tests).to.have.property(\"include\");", " pm.expect(jsonData.tests.include).to.be.an.instanceof(Array);", " pm.expect(jsonData.tests).to.have.property(\"exclude\");", " pm.expect(jsonData.tests.exclude).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"types\");", " pm.expect(jsonData.types).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"user_agent\");", " pm.expect(typeof jsonData.user_agent).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"timeouts\");", " pm.expect(typeof jsonData.timeouts).to.equal(\"object\")", " pm.expect(jsonData.timeouts).to.have.property(\"automatic\");", " pm.expect(typeof jsonData.timeouts.automatic).to.equal(\"number\");", " pm.expect(jsonData.timeouts).to.have.property(\"manual\");", " pm.expect(typeof jsonData.timeouts.manual).to.equal(\"number\");", " pm.expect(jsonData).to.have.property(\"browser\");", " pm.expect(typeof jsonData.browser).to.equal(\"object\");", " pm.expect(jsonData.browser).to.have.property(\"name\");", " pm.expect(typeof jsonData.browser.name).to.equal(\"string\");", " pm.expect(jsonData.browser).to.have.property(\"version\");", " pm.expect(typeof jsonData.browser.version).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"reference_tokens\");", " pm.expect(jsonData.reference_tokens).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"labels\");", " pm.expect(jsonData.labels).to.be.an.instanceof(Array);", "});", "", "pm.test(\"Configuration is default\", function () {", " pm.expect(jsonData.token).to.match(tokenRegex);", " pm.expect(jsonData.tests.include).to.include(\"/\");", " pm.expect(jsonData.types).to.include(\"automatic\");", " pm.expect(jsonData.types).to.include(\"manual\");", " pm.expect(jsonData.user_agent).to.include(\"PostmanRuntime\");", " pm.expect(jsonData.timeouts.automatic).to.equal(60000);", " pm.expect(jsonData.timeouts.manual).to.equal(300000);", " pm.expect(jsonData.browser.name).to.equal(\"Other\");", " pm.expect(jsonData.browser.version).to.equal(\"0\");", " pm.expect(jsonData.is_public).to.equal(false);", " pm.expect(jsonData.reference_tokens).to.be.empty;", " pm.expect(jsonData.labels).to.include(\"new\");", " pm.expect(jsonData.labels).to.include(\"labels\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Clean Up", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {} }, { "name": "Delete Session", "item": [ { "name": "Setup", "item": [ { "name": "Create Session No Configuration", "event": [ { "listen": "test", "script": { "id": "e85fd539-4598-47a9-8768-656656f29fec", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Delete Session", "event": [ { "listen": "test", "script": { "id": "8e9fe4af-0d50-49eb-8a4a-00e13021b4a6", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Session Configuration", "event": [ { "listen": "test", "script": { "id": "9418112a-03f6-4641-893e-076c8922c0af", "exec": [ "pm.test(\"Status code is 404\", function () {", " pm.response.to.have.status(404);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {} }, { "name": "Create and Read Results", "item": [ { "name": "Create Session", "item": [ { "name": "Create Session Two Tests", "event": [ { "listen": "test", "script": { "id": "a6995ff1-d626-4f4f-a1e0-567f3429bf52", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "85c7ad8d-5fc9-403d-8715-c65d5ff1323e", "exec": [ "const availableTests = JSON.parse(pm.globals.get(\"available_tests\"));", "const keys = Object.keys(availableTests).sort();", "const test1 = availableTests[keys[0]][0];", "const test2 = availableTests[keys[1]][0];", "", "console.log(test1, test2)", "", "pm.globals.set(\"single_test_1\", test1);", "pm.globals.set(\"single_test_2\", test2);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"tests\": {\n \"include\": [\"{{single_test_1}}\", \"{{single_test_2}}\"]\n }\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "35cf4745-0301-4c9c-b6b3-40945299533f", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Read Results", "event": [ { "listen": "test", "script": { "id": "6dc082ef-80ff-407a-a562-e25e37476eee", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Responds with no results\", function () {", " var jsonData = pm.response.json();", " pm.expect(typeof jsonData).to.equal(\"object\");", " pm.expect(Object.keys(jsonData)).to.be.empty;", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}" ], "query": [ { "key": "path", "value": "/2dcontext/drawing-images-to-the-canvas", "disabled": true }, { "key": "path", "value": "/2dcontext/conformance-requirements", "disabled": true }, { "key": "path", "value": "/2dcontext/conformance-requirements/2d.missingargs.html", "disabled": true } ] } }, "response": [] }, { "name": "Read Results Compact", "event": [ { "listen": "test", "script": { "id": "fcade663-dbd8-42c9-8344-53ae1feb6fcb", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var singleTest1 = pm.globals.get(\"single_test_1\");", "var singleTest2 = pm.globals.get(\"single_test_2\");", "", "var api1 = singleTest1.split(\"/\").find(part => !!part);", "var api2 = singleTest2.split(\"/\").find(part => !!part);", "", "pm.test(\"Responds with no results\", function () {", " var jsonData = pm.response.json();", " pm.expect(typeof jsonData).to.equal(\"object\");", " pm.expect(jsonData).to.have.property(api1);", " pm.expect(jsonData).to.have.property(api2);", " pm.expect(jsonData[api1].complete).to.equal(0);", " pm.expect(jsonData[api2].complete).to.equal(0);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}/compact", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}", "compact" ] } }, "response": [] }, { "name": "Read Last Completed Tests of Session", "event": [ { "listen": "test", "script": { "id": "36d70d08-3caa-4312-9bbd-aed15fd238dd", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", " ", "pm.test(\"JSON format is as expected\", function () {", " pm.expect(Object.keys(jsonData)).to.have.lengthOf(3);", " pm.expect(jsonData).to.have.property(\"pass\");", " pm.expect(jsonData).to.have.property(\"fail\");", " pm.expect(jsonData).to.have.property(\"timeout\");", " for (var key of Object.keys(jsonData)) {", " pm.expect(jsonData[key]).to.be.an.instanceof(Array);", " }", "});", "", "pm.test(\"Responds with no last completed tests\", function () {", " for (var key of Object.keys(jsonData)) {", " pm.expect(jsonData[key]).to.be.empty;", " }", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/last_completed", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "last_completed" ] } }, "response": [] }, { "name": "Read Tests of Session", "event": [ { "listen": "test", "script": { "id": "211adcf7-d71a-4b0f-94ab-d285fc8367df", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"pending_tests\");", " pm.expect(typeof jsonData.pending_tests).to.equal(\"object\");", " pm.expect(jsonData).to.have.property(\"running_tests\");", " pm.expect(typeof jsonData.running_tests).to.equal(\"object\");", "});", "", "const sessionTests = jsonData.pending_tests;", "", "pm.globals.set(\"session_tests\", JSON.stringify(sessionTests));" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Create First Result", "item": [ { "name": "Read Next Test of Session", "event": [ { "listen": "test", "script": { "id": "5410c9c2-ebbe-4bc1-ac12-e2602d8ade57", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const response = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(Object.keys(response)).to.have.lengthOf(1);", " pm.expect(response).to.have.property(\"next_test\");", " pm.expect(typeof response.next_test).to.equal(\"string\");", "});", "", "const nextTest = response.next_test;", "pm.globals.set(\"current_test_url\", nextTest);", "if (!nextTest) return;", "", "const parameters = nextTest.split(\"?\")[1].split(\"&\");", "let test = parameters.find(parameter => parameter.split(\"=\")[0] === \"test_url\").split(\"=\")[1];", "test = decodeURIComponent(test);", "test = \"/\" + test.split(\"/\").slice(3).join(\"/\").split(\"?\")[0];", "", "pm.globals.set(\"current_test\", test);", "", "const test1 = pm.globals.get(\"single_test_1\");", "", "pm.test(\"Returned test is first of two specified tests\", function () {", " console.log(test);", " console.log(test1);", " console.log(pm.globals.get(\"single_test_2\"))", " pm.expect(test).to.equal(test1);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "next" ] } }, "response": [] }, { "name": "Read Tests of Session", "event": [ { "listen": "test", "script": { "id": "e4f9a03f-c731-4192-a9a9-aa9e315c3c44", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"pending_tests\");", " pm.expect(typeof jsonData.pending_tests).to.equal(\"object\");", " pm.expect(jsonData).to.have.property(\"running_tests\");", " pm.expect(typeof jsonData.running_tests).to.equal(\"object\");", "});", "", "const test1 = pm.globals.get(\"single_test_1\");", "const test2 = pm.globals.get(\"single_test_2\");", "", "pm.test(\"One test is pending, one test is running\", function () {", " pm.expect(Object.keys(jsonData.pending_tests)).to.have.lengthOf(1);", " var api = Object.keys(jsonData.pending_tests)[0];", " pm.expect(jsonData.pending_tests[api]).to.have.lengthOf(1);", " pm.expect(jsonData.pending_tests[api]).to.include(test2);", " pm.expect(Object.keys(jsonData.running_tests)).to.have.lengthOf(1);", " api = Object.keys(jsonData.running_tests)[0];", " pm.expect(jsonData.running_tests[api]).to.have.lengthOf(1);", " pm.expect(jsonData.running_tests[api]).to.include(test1);", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}" ] } }, "response": [] }, { "name": "Create Result", "event": [ { "listen": "test", "script": { "id": "9f684f77-4ed0-4cd2-99a4-b1c134432e9f", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"test\": \"{{current_test}}\",\n \"status\": \"OK\",\n \"message\": null,\n \"subtests\": [\n {\n \"name\": \"Subtest testing feature xy\",\n \"status\": \"FAIL\",\n \"message\": \"Error message\"\n }\n ]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Tests of Session", "event": [ { "listen": "test", "script": { "id": "33601dd0-6786-4c8a-a6b5-7f1386129de7", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"pending_tests\");", " pm.expect(typeof jsonData.pending_tests).to.equal(\"object\");", " pm.expect(jsonData).to.have.property(\"running_tests\");", " pm.expect(typeof jsonData.running_tests).to.equal(\"object\");", "});", "", "", "const test1 = pm.globals.get(\"single_test_1\");", "const test2 = pm.globals.get(\"single_test_2\");", "", "pm.test(\"One test is pending, one test is completed\", function () {", " pm.expect(Object.keys(jsonData.pending_tests)).to.have.lengthOf(1);", " var api = Object.keys(jsonData.pending_tests)[0];", " pm.expect(jsonData.pending_tests[api]).to.have.lengthOf(1);", " pm.expect(jsonData.pending_tests[api]).to.include(test2);", " pm.expect(Object.keys(jsonData.running_tests)).to.have.lengthOf(0);", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "97be92f1-a8d1-41ea-b41d-0ca08113e6e1", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"status\");", " pm.expect(typeof jsonData.status).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"expiration_date\");", " pm.expect(jsonData.expiration_date).to.be.null;", " pm.expect(jsonData).to.have.property(\"date_started\");", " pm.expect(jsonData).to.have.property(\"date_finished\");", "});", "", "pm.test(\"Session status is running\", function () {", " pm.expect(jsonData.status).to.equal(\"running\");", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] }, { "name": "Read Last Completed Tests of Session", "event": [ { "listen": "test", "script": { "id": "24ec2b79-c266-473f-8579-7b694079d640", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", " ", "pm.test(\"JSON format is as expected\", function () {", " pm.expect(Object.keys(jsonData)).to.have.lengthOf(3);", " pm.expect(jsonData).to.have.property(\"pass\");", " pm.expect(jsonData).to.have.property(\"fail\");", " pm.expect(jsonData).to.have.property(\"timeout\");", " for (var key of Object.keys(jsonData)) {", " pm.expect(jsonData[key]).to.be.an.instanceof(Array);", " }", "});", "", "const test1 = pm.globals.get(\"single_test_1\");", "", "pm.test(\"Responds with one last completed tests as failed\", function () {", " pm.expect(jsonData[\"pass\"]).to.be.empty;", " pm.expect(jsonData[\"fail\"]).to.have.lengthOf(1);", " pm.expect(jsonData[\"fail\"][0]).to.equal(test1);", " pm.expect(jsonData[\"timeout\"]).to.be.empty;", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/last_completed", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "last_completed" ] } }, "response": [] }, { "name": "Read Results", "event": [ { "listen": "test", "script": { "id": "1f47b39f-727f-43b4-934d-c7f62b268baa", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON format is as expected\", function () {", " for (var api of Object.keys(jsonData)) {", " pm.expect(jsonData[api]).to.be.an.instanceof(Array);", " for (var result of jsonData[api]) {", " pm.expect(typeof result).to.equal(\"object\");", " pm.expect(Object.keys(result)).to.have.lengthOf(4);", " pm.expect(result).to.have.property(\"test\");", " pm.expect(typeof result.test).to.equal(\"string\");", " pm.expect(result).to.have.property(\"status\");", " pm.expect(typeof result.status).to.equal(\"string\");", " pm.expect(result).to.have.property(\"message\");", " pm.expect(result.message).to.satisfy(message => !message || typeof message === \"string\");", " pm.expect(result).to.have.property(\"subtests\");", " pm.expect(result.subtests).to.be.an.instanceof(Array);", " for (var subtest of result.subtests) {", " pm.expect(typeof subtest).to.equal(\"object\");", " pm.expect(Object.keys(subtest)).to.have.lengthOf(3);", " pm.expect(subtest).to.have.property(\"name\");", " pm.expect(typeof subtest.name).to.equal(\"string\");", " pm.expect(subtest).to.have.property(\"status\");", " pm.expect(typeof subtest.status).to.equal(\"string\");", " pm.expect(subtest).to.have.property(\"message\");", " pm.expect(subtest.message).to.satisfy(message => !message || typeof message === \"string\");", " }", " }", " }", "});", "", "const test1 = pm.globals.get(\"single_test_1\");", "", "pm.test(\"Test is first test, successful run and failed\", function () {", " var api = Object.keys(jsonData)[0];", " pm.expect(api).to.equal(test1.split(\"/\").find(part => !!part))", " var result = jsonData[api][0];", " pm.expect(result.test).to.equal(test1);", " pm.expect(result.status).to.equal(\"OK\");", " pm.expect(result.message).to.be.null;", " var subtest = result.subtests[0];", " pm.expect(subtest.status).to.equal(\"FAIL\");", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}" ], "query": [ { "key": "path", "value": "/2dcontext/drawing-images-to-the-canvas", "disabled": true }, { "key": "path", "value": "/2dcontext/conformance-requirements", "disabled": true }, { "key": "path", "value": "/2dcontext/conformance-requirements/2d.missingargs.html", "disabled": true } ] } }, "response": [] }, { "name": "Read Results Compact", "event": [ { "listen": "test", "script": { "id": "e734f074-a0c2-4e54-b427-2827fa732843", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "var test = pm.globals.get(\"single_test_1\");", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(typeof jsonData).to.equal(\"object\");", " for (var api of Object.keys(jsonData)) {", " pm.expect(jsonData[api]).to.have.property(\"pass\");", " pm.expect(typeof jsonData[api].pass).to.equal(\"number\");", " pm.expect(jsonData[api]).to.have.property(\"fail\");", " pm.expect(typeof jsonData[api].fail).to.equal(\"number\");", " pm.expect(jsonData[api]).to.have.property(\"timeout\");", " pm.expect(typeof jsonData[api].timeout).to.equal(\"number\");", " pm.expect(jsonData[api]).to.have.property(\"not_run\");", " pm.expect(typeof jsonData[api].not_run).to.equal(\"number\");", " }", "})", "", "pm.test(\"Responds with one test failed\", function () {", " var api = test.split(\"/\").find(part => !!part);", " pm.expect(jsonData[api].pass).to.equal(0);", " pm.expect(jsonData[api].fail).to.equal(1);", " pm.expect(jsonData[api].timeout).to.equal(0);", " pm.expect(jsonData[api].not_run).to.equal(0);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}/compact", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}", "compact" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Create Last Result", "item": [ { "name": "Read Next Test of Session", "event": [ { "listen": "test", "script": { "id": "fd2c11ee-5eca-43f3-89a7-133602c8034a", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const response = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(Object.keys(response)).to.have.lengthOf(1);", " pm.expect(response).to.have.property(\"next_test\");", " pm.expect(typeof response.next_test).to.equal(\"string\");", "});", "", "const nextTest = response.next_test;", "pm.globals.set(\"current_test_url\", nextTest);", "if (!nextTest) return;", "", "const parameters = nextTest.split(\"?\")[1].split(\"&\");", "let test = parameters.find(parameter => parameter.split(\"=\")[0] === \"test_url\").split(\"=\")[1];", "test = decodeURIComponent(test);", "test = \"/\" + test.split(\"/\").slice(3).join(\"/\").split(\"?\")[0];", "", "pm.globals.set(\"current_test\", test);", "", "const test2 = pm.globals.get(\"single_test_2\");", "", "pm.test(\"Returned test is second of two specified tests\", function () {", " pm.expect(test).to.equal(test2);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "next" ] } }, "response": [] }, { "name": "Read Tests of Session", "event": [ { "listen": "test", "script": { "id": "112ee3d5-d4e0-4838-879e-f74c38d0218c", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"pending_tests\");", " pm.expect(typeof jsonData.pending_tests).to.equal(\"object\");", " pm.expect(jsonData).to.have.property(\"running_tests\");", " pm.expect(typeof jsonData.running_tests).to.equal(\"object\");", "});", "", "const test1 = pm.globals.get(\"single_test_1\");", "const test2 = pm.globals.get(\"single_test_2\");", "", "pm.test(\"One test is running\", function () {", " pm.expect(Object.keys(jsonData.pending_tests)).to.have.lengthOf(0);", " pm.expect(Object.keys(jsonData.running_tests)).to.have.lengthOf(1);", " var api = Object.keys(jsonData.running_tests)[0];", " pm.expect(jsonData.running_tests[api]).to.have.lengthOf(1);", " pm.expect(jsonData.running_tests[api]).to.include(test2);", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}" ] } }, "response": [] }, { "name": "Create Result", "event": [ { "listen": "test", "script": { "id": "79a84ed9-bb07-493d-ab34-8e7693b3ebbd", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"test\": \"{{current_test}}\",\n \"status\": \"OK\",\n \"message\": null,\n \"subtests\": [\n {\n \"name\": \"Subtest testing feature xy\",\n \"status\": \"PASS\",\n \"message\": \"Error message\"\n }\n ]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "c1829043-18dd-4cc1-8091-41981349f4e3", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"status\");", " pm.expect(typeof jsonData.status).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"expiration_date\");", " pm.expect(jsonData.expiration_date).to.be.null;", " pm.expect(jsonData).to.have.property(\"date_started\");", " pm.expect(jsonData).to.have.property(\"date_finished\");", "});", "", "pm.test(\"Session status is completed\", function () {", " pm.expect(jsonData.status).to.equal(\"completed\");", "})", "", "pm.test(\"Finish date is set\", function () {", " pm.expect(Date.parse(jsonData.date_finished)).to.be.below(Date.now());", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] }, { "name": "Read Tests of Session", "event": [ { "listen": "test", "script": { "id": "59fee9df-9945-4fdf-a102-9c1b92d915c1", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"pending_tests\");", " pm.expect(typeof jsonData.pending_tests).to.equal(\"object\");", " pm.expect(jsonData).to.have.property(\"running_tests\");", " pm.expect(typeof jsonData.running_tests).to.equal(\"object\");", "});", "", "const test1 = pm.globals.get(\"single_test_1\");", "const test2 = pm.globals.get(\"single_test_2\");", "", "var test1Api = test1.split(\"/\").find(part => !!part);", "var test2Api = test1.split(\"/\").find(part => !!part);", "", "pm.test(\"One test is pending, one test is completed\", function () {", " pm.expect(Object.keys(jsonData.pending_tests)).to.have.lengthOf(0);", " pm.expect(Object.keys(jsonData.running_tests)).to.have.lengthOf(0);", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Last Completed Tests of Session", "event": [ { "listen": "test", "script": { "id": "91fa38ac-3b06-488a-892e-59458e88a4da", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", " ", "pm.test(\"JSON format is as expected\", function () {", " pm.expect(Object.keys(jsonData)).to.have.lengthOf(3);", " pm.expect(jsonData).to.have.property(\"pass\");", " pm.expect(jsonData).to.have.property(\"fail\");", " pm.expect(jsonData).to.have.property(\"timeout\");", " for (var key of Object.keys(jsonData)) {", " pm.expect(jsonData[key]).to.be.an.instanceof(Array);", " }", "});", "", "const test1 = pm.globals.get(\"single_test_1\");", "const test2 = pm.globals.get(\"single_test_2\");", "", "pm.test(\"Responds with one last completed tests as failed and one last completed test as passed\", function () {", " pm.expect(jsonData[\"pass\"]).to.have.lengthOf(1);", " pm.expect(jsonData[\"pass\"][0]).to.equal(test2);", " pm.expect(jsonData[\"fail\"]).to.have.lengthOf(1);", " pm.expect(jsonData[\"fail\"][0]).to.equal(test1);", " pm.expect(jsonData[\"timeout\"]).to.be.empty;", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/last_completed", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "last_completed" ] } }, "response": [] }, { "name": "Read Results", "event": [ { "listen": "test", "script": { "id": "dca0b42e-9054-4354-87e5-e8d236216050", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON format is as expected\", function () {", " for (var api of Object.keys(jsonData)) {", " pm.expect(jsonData[api]).to.be.an.instanceof(Array);", " for (var result of jsonData[api]) {", " pm.expect(typeof result).to.equal(\"object\");", " pm.expect(Object.keys(result)).to.have.lengthOf(4);", " pm.expect(result).to.have.property(\"test\");", " pm.expect(typeof result.test).to.equal(\"string\");", " pm.expect(result).to.have.property(\"status\");", " pm.expect(typeof result.status).to.equal(\"string\");", " pm.expect(result).to.have.property(\"message\");", " pm.expect(result.message).to.satisfy(message => !message || typeof message === \"string\");", " pm.expect(result).to.have.property(\"subtests\");", " pm.expect(result.subtests).to.be.an.instanceof(Array);", " for (var subtest of result.subtests) {", " pm.expect(typeof subtest).to.equal(\"object\");", " pm.expect(Object.keys(subtest)).to.have.lengthOf(3);", " pm.expect(subtest).to.have.property(\"name\");", " pm.expect(typeof subtest.name).to.equal(\"string\");", " pm.expect(subtest).to.have.property(\"status\");", " pm.expect(typeof subtest.status).to.equal(\"string\");", " pm.expect(subtest).to.have.property(\"message\");", " pm.expect(subtest.message).to.satisfy(message => !message || typeof message === \"string\");", " }", " }", " }", "});", "", "const test1 = pm.globals.get(\"single_test_1\");", "const test2 = pm.globals.get(\"single_test_2\");", "", "pm.test(\"Test is first and second test, successful run and failed, and successful run and passed\", function () {", " var api = Object.keys(jsonData)[0];", " for (var result of jsonData[api]) {", " if (result.test === test1) {", " pm.expect(result.test).to.equal(test1); ", " pm.expect(result.status).to.equal(\"OK\");", " pm.expect(result.message).to.be.null;", " var subtest = result.subtests[0];", " pm.expect(subtest.status).to.equal(\"FAIL\");", " } else {", " pm.expect(result.test).to.equal(test2); ", " pm.expect(result.status).to.equal(\"OK\");", " pm.expect(result.message).to.be.null;", " subtest = result.subtests[0];", " pm.expect(subtest.status).to.equal(\"PASS\");", " }", " }", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}" ], "query": [ { "key": "path", "value": "/2dcontext/drawing-images-to-the-canvas", "disabled": true }, { "key": "path", "value": "/2dcontext/conformance-requirements", "disabled": true }, { "key": "path", "value": "/2dcontext/conformance-requirements/2d.missingargs.html", "disabled": true } ] } }, "response": [] }, { "name": "Read Results Compact", "event": [ { "listen": "test", "script": { "id": "14ec9254-5a40-4c86-9a7f-72f43a35a79b", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(typeof jsonData).to.equal(\"object\");", " for (var api of Object.keys(jsonData)) {", " pm.expect(jsonData[api]).to.have.property(\"pass\");", " pm.expect(typeof jsonData[api].pass).to.equal(\"number\");", " pm.expect(jsonData[api]).to.have.property(\"fail\");", " pm.expect(typeof jsonData[api].fail).to.equal(\"number\");", " pm.expect(jsonData[api]).to.have.property(\"timeout\");", " pm.expect(typeof jsonData[api].timeout).to.equal(\"number\");", " pm.expect(jsonData[api]).to.have.property(\"not_run\");", " pm.expect(typeof jsonData[api].not_run).to.equal(\"number\");", " }", "})", "", "const test1 = pm.globals.get(\"single_test_1\");", "const test2 = pm.globals.get(\"single_test_2\");", "", "var test1Api = test1.split(\"/\").find(part => !!part);", "var test2Api = test1.split(\"/\").find(part => !!part);", "", "pm.test(\"Responds with one test failed\", function () {", " pm.expect(Object.keys(jsonData)).to.have.lengthOf(2);", " var api = Object.keys(jsonData)[0];", " if (api === test1Api) {", " pm.expect(jsonData[api].pass).to.equal(0);", " pm.expect(jsonData[api].fail).to.equal(1);", " } else {", " pm.expect(jsonData[api].pass).to.equal(1);", " pm.expect(jsonData[api].fail).to.equal(0);", " }", " pm.expect(jsonData[api].timeout).to.equal(0);", " pm.expect(jsonData[api].not_run).to.equal(0);", " api = Object.keys(jsonData)[1];", " if (api === test1Api) {", " pm.expect(jsonData[api].pass).to.equal(0);", " pm.expect(jsonData[api].fail).to.equal(1);", " } else {", " pm.expect(jsonData[api].pass).to.equal(1);", " pm.expect(jsonData[api].fail).to.equal(0);", " }", " pm.expect(jsonData[api].timeout).to.equal(0);", " pm.expect(jsonData[api].not_run).to.equal(0);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}/compact", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}", "compact" ] } }, "response": [] }, { "name": "Read Next Test of Session", "event": [ { "listen": "test", "script": { "id": "132574dc-3688-47e3-8f50-3235f18806f7", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const response = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(Object.keys(response)).to.have.lengthOf(1);", " pm.expect(response).to.have.property(\"next_test\");", " pm.expect(typeof response.next_test).to.equal(\"string\");", "});", "", "const nextTest = response.next_test;", "pm.globals.set(\"current_test_url\", nextTest);", "if (!nextTest) return;", "const test = \"/\" + nextTest.split(\"/\").slice(3).join(\"/\").split(\"?\")[0];", "pm.globals.set(\"current_test\", test);", "", "const web_root = pm.environment.get(\"web_root\");", "", "pm.test(\"Returned test finish page\", function () {", " pm.expect(test).to.equal(\"/\" + web_root + \"/finish.html\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "next" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Clean Up", "item": [ { "name": "Delete Session", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {} }, { "name": "Viewing and Downloading Reports", "item": [ { "name": "Create Sessions", "item": [ { "name": "First Session", "item": [ { "name": "Create Session One Tests", "event": [ { "listen": "test", "script": { "id": "2f233dcf-d934-4479-8908-b1349e6ea54d", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "2930a821-2c6e-47b9-89d9-90ebe1cff52a", "exec": [ "const availableTests = JSON.parse(pm.globals.get(\"available_tests\"));", "const keys = Object.keys(availableTests).sort();", "const test1 = availableTests[keys[0]][0];", "const test2 = availableTests[keys[1]][0];", "const apiName = test1.split(\"/\").find(part => !!part);", "", "pm.globals.set(\"single_test_1\", test1);", "pm.globals.set(\"single_test_2\", test2);", "pm.globals.set(\"api_name\", apiName);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"tests\": {\n \"include\": [\"{{single_test_1}}\"]\n }\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "12f3616b-707e-4a71-8db8-89fc195c1fcd", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Read Next Test of Session", "event": [ { "listen": "test", "script": { "id": "f35f1509-383f-49af-a30e-41e1df4efa04", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const response = pm.response.json();", "", "const nextTest = response.next_test;", "pm.globals.set(\"current_test_url\", nextTest);", "if (!nextTest) return;", "", "const parameters = nextTest.split(\"?\")[1].split(\"&\");", "let test = parameters.find(parameter => parameter.split(\"=\")[0] === \"test_url\").split(\"=\")[1];", "test = decodeURIComponent(test);", "test = \"/\" + test.split(\"/\").slice(3).join(\"/\").split(\"?\")[0];", "", "pm.globals.set(\"current_test\", test);", "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "next" ] } }, "response": [] }, { "name": "Create Result", "event": [ { "listen": "test", "script": { "id": "b015f161-e390-4224-9f26-92395f44c772", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"test\": \"{{current_test}}\",\n \"status\": \"OK\",\n \"message\": null,\n \"subtests\": [\n {\n \"name\": \"Subtest testing feature xy\",\n \"status\": \"FAIL\",\n \"message\": \"Error message\"\n }\n ]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Second Session", "item": [ { "name": "Create Session One Tests", "event": [ { "listen": "test", "script": { "id": "da3d0c17-6b2b-4d61-ad01-dba736425388", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token_comp\", token);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "7da81e81-d344-4459-b700-19b93d49d3c9", "exec": [ "const availableTests = JSON.parse(pm.globals.get(\"available_tests\"));", "const keys = Object.keys(availableTests).sort();", "const test1 = availableTests[keys[0]][0];", "", "pm.globals.set(\"single_test_1\", test1);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"tests\": {\n \"include\": [\"{{single_test_1}}\"]\n }\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "3296c7ba-67a6-405d-a78a-51dd64432301", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token_comp}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token_comp}}", "start" ] } }, "response": [] }, { "name": "Read Next Test of Session", "event": [ { "listen": "test", "script": { "id": "72deb55c-4583-4741-9cf8-97713762b894", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const response = pm.response.json();", "", "const nextTest = response.next_test;", "pm.globals.set(\"current_test_url\", nextTest);", "if (!nextTest) return;", "", "const parameters = nextTest.split(\"?\")[1].split(\"&\");", "let test = parameters.find(parameter => parameter.split(\"=\")[0] === \"test_url\").split(\"=\")[1];", "test = decodeURIComponent(test);", "test = \"/\" + test.split(\"/\").slice(3).join(\"/\").split(\"?\")[0];", "", "pm.globals.set(\"current_test\", test);", "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token_comp}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token_comp}}", "next" ] } }, "response": [] }, { "name": "Create Result", "event": [ { "listen": "test", "script": { "id": "d695f300-a773-4654-b346-95c536cad19e", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"test\": \"{{current_test}}\",\n \"status\": \"OK\",\n \"message\": null,\n \"subtests\": [\n {\n \"name\": \"Subtest testing feature xy\",\n \"status\": \"FAIL\",\n \"message\": \"Error message\"\n }\n ]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token_comp}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token_comp}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Download reports", "item": [ { "name": "Download Results Overview", "event": [ { "listen": "test", "script": { "id": "6838965f-7a27-48d5-8c27-f55d4756588f", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}/overview", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}", "overview" ] } }, "response": [] }, { "name": "Download All Apis Json", "event": [ { "listen": "test", "script": { "id": "bcc2c8c4-94c0-4227-a627-3e0d5be2e7b8", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}/json", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}", "json" ] } }, "response": [] }, { "name": "Download WPT Multi Report Url", "event": [ { "listen": "test", "script": { "id": "7b370723-0506-4b5e-941a-f31a628a29f6", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Uri returned\", function () {", " var jsonData = pm.response.json();", " pm.expect(typeof jsonData.uri).to.equal(\"string\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{api_name}}/reporturl?tokens={{session_token}},{{session_token_comp}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{api_name}}", "reporturl" ], "query": [ { "key": "tokens", "value": "{{session_token}},{{session_token_comp}}" } ] } }, "response": [] }, { "name": "Download Results Api Json", "event": [ { "listen": "test", "script": { "id": "b5243979-b63a-4bbf-bd51-1529da1e1f6d", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "81f3da29-8a0c-4403-929d-86590b01ef2f", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}/{{api_name}}/json", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}", "{{api_name}}", "json" ] } }, "response": [] }, { "name": "Download WPT Report Copy", "event": [ { "listen": "test", "script": { "id": "0168ea3f-9bf7-4ea7-a3ad-745c2704d97e", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Uri returned\", function () {", " var jsonData = pm.response.json();", " pm.expect(typeof jsonData.uri).to.equal(\"string\");", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "e4efdac9-2d00-4853-b145-18a6d44ff139", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}/{{api_name}}/reporturl", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}", "{{api_name}}", "reporturl" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {} }, { "name": "Malfunctioning List", "item": [ { "name": "Create Session \\w Configuration Copy", "event": [ { "listen": "test", "script": { "id": "e685a989-8ef7-4e8f-a3c7-b579c66430f9", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "8517360b-2e66-4ca9-9339-017622c39888", "exec": [ "var automaticTimeout = 120000;", "var manualTimeout = 1000000;", "var specialTimeout = 2000;", "", "pm.globals.set(\"automatic_timeout\", automaticTimeout);", "pm.globals.set(\"manual_timeout\", manualTimeout);", "pm.globals.set(\"special_timeout\", specialTimeout);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"tests\": {\n \"include\": {{included_tests}},\n \"exclude\": {{excluded_tests}}\n },\n \"types\": [\n \"automatic\"\n ],\n \"timeouts\": {\n \"automatic\": {{automatic_timeout}},\n \"manual\": {{manual_timeout}},\n \"{{special_timeout_test}}\": {{special_timeout}}\n },\n \"labels\": [\"label1\", \"label2\"]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read Session Malfunctioning Empty", "event": [ { "listen": "test", "script": { "id": "4e85ecaf-4364-4681-ab8a-221d40681c44", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"Return empty array\", function() {", " pm.expect(jsonData).to.be.an.instanceof(Array)", " pm.expect(jsonData).to.have.length(0)", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/malfunctioning", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "malfunctioning" ] } }, "response": [] }, { "name": "Update Session Malfunctioning Insert Two", "event": [ { "listen": "test", "script": { "id": "a6221560-9eba-4fb4-a7cb-a1570a37425d", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "PUT", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "[\n\t\"/test/file/one.html\",\n\t\"/test/file/two.html\"\n]", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/malfunctioning", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "malfunctioning" ] } }, "response": [] }, { "name": "Read Session Malfunctioning Two Tests", "event": [ { "listen": "test", "script": { "id": "77d14567-4600-44fd-98e4-99e113da6781", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"Return array with two tests\", function() {", " pm.expect(jsonData).to.be.an.instanceof(Array)", " pm.expect(jsonData).to.have.length(2)", " pm.expect(jsonData).to.include(\"/test/file/one.html\")", " pm.expect(jsonData).to.include(\"/test/file/two.html\")", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/malfunctioning", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "malfunctioning" ] } }, "response": [] }, { "name": "Update Session Malfunctioning Empty Array", "event": [ { "listen": "test", "script": { "id": "55b486da-c5ae-49d4-b11a-247387267c9a", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "PUT", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "[]", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/malfunctioning", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "malfunctioning" ] } }, "response": [] }, { "name": "Read Session Malfunctioning Empty", "event": [ { "listen": "test", "script": { "id": "953002ec-d8df-477a-a0dc-f4e4a2efd031", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"Return empty array\", function() {", " pm.expect(jsonData).to.be.an.instanceof(Array)", " pm.expect(jsonData).to.have.length(0)", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/malfunctioning", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "malfunctioning" ] } }, "response": [] } ], "protocolProfileBehavior": {} }, { "name": "Sessions API", "item": [ { "name": "create session", "item": [ { "name": "With Defaults", "item": [ { "name": "Prep: Read Available Tests", "event": [ { "listen": "test", "script": { "id": "fc15d329-d132-4abf-90e4-f549eee99b60", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var availableTests = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(typeof availableTests).to.equal(\"object\");", " for (var api of Object.keys(availableTests)) {", " pm.expect(availableTests[api]).to.be.an.instanceof(Array);", " var apiRegExp = new RegExp(\"^/\" + api, \"i\");", " for (var test of availableTests[api]) {", " pm.expect(test).to.match(apiRegExp);", " }", " }", "});", "", "var includedTests = [];", "var excludedTests = [];", "var specialTimeoutTest = \"\";", "", "var apis = Object.keys(availableTests);", "for(var api of apis) {", " if (availableTests[api].length > 50) {", " var subDirs = availableTests[api].map(test => test.split(\"/\").filter(part => !!part).join(\"/\").split(\"/\")[1]).reduce((acc, curr) => acc.indexOf(curr) === -1 ? acc.concat([curr]) : acc, []);", " if (subDirs.length > 2) {", " includedTests.push(\"/\" + api);", " excludedTests.push(\"/\" + api + \"/\" + subDirs[0]);", " specialTimeoutTest = availableTests[api][availableTests[api].length - 1];", " break;", " }", " ", " }", "}", "", "pm.globals.set(\"available_tests\", availableTests);", "pm.globals.set(\"included_tests\", JSON.stringify(includedTests));", "pm.globals.set(\"excluded_tests\", JSON.stringify(excludedTests));", "pm.globals.set(\"special_timeout_test\", specialTimeoutTest.replace(\".\", \"\"));" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests" ] } }, "response": [] }, { "name": "Create Session No Configuration", "event": [ { "listen": "test", "script": { "id": "ebb192ce-48e5-4aac-b99d-68894378eac8", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read Session Configuration", "event": [ { "listen": "test", "script": { "id": "159976cd-de00-4f88-8f9f-47db13ca4a30", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Configuration is default\", function () {", " pm.expect(jsonData.token).to.match(tokenRegex);", " pm.expect(jsonData.tests.include).to.include(\"/\");", " pm.expect(jsonData.types).to.include(\"automatic\");", " pm.expect(jsonData.types).to.include(\"manual\");", " pm.expect(jsonData.user_agent).to.include(\"PostmanRuntime\");", " pm.expect(jsonData.timeouts.automatic).to.equal(60000);", " pm.expect(jsonData.timeouts.manual).to.equal(300000);", " pm.expect(jsonData.browser.name).to.equal(\"Other\");", " pm.expect(jsonData.browser.version).to.equal(\"0\");", " pm.expect(jsonData.is_public).to.equal(false);", " pm.expect(jsonData.reference_tokens).to.be.empty;", " pm.expect(jsonData.labels).to.be.empty;", " pm.expect(new Date(jsonData.date_created).getTime()).to.be.below(Date.now());", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "5058b07b-5e55-44e0-ad88-5c7b5884fa3c", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "", "var jsonData = pm.response.json();", "", "pm.test(\"Session status is pending\", function () {", " pm.expect(jsonData.status).to.equal(\"pending\");", "})", "", "pm.test(\"Start, Finish and Expiration date not set\", function () {", " pm.expect(jsonData.date_started).to.be.null;", " pm.expect(jsonData.date_finished).to.be.null;", " pm.expect(jsonData.expiration_date).to.be.null;", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] }, { "name": "Read Tests of Session", "event": [ { "listen": "test", "script": { "id": "62a8c853-bf0b-47b0-9cee-7611d2b48cde", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"pending_tests\");", " pm.expect(typeof jsonData.pending_tests).to.equal(\"object\");", " pm.expect(jsonData).to.have.property(\"running_tests\");", " pm.expect(typeof jsonData.running_tests).to.equal(\"object\");", "});", "", "pm.test(\"All tests are pending tests\", function () {", " pm.expect(Object.keys(jsonData.pending_tests)).to.not.have.lengthOf(0);", " pm.expect(Object.keys(jsonData.running_tests)).to.have.lengthOf(0);", "})", "", "const availableTests = pm.globals.get(\"available_tests\");", "", "pm.test(\"All available tests are part of the session\", function () {", " for (var api of Object.keys(jsonData.pending_tests)) {", " for (var test of jsonData.pending_tests[api]) {", " pm.expect(availableTests[api]).to.include(test);", " }", " }", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}" ] } }, "response": [] }, { "name": "Clean up: Delete session", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "id": "878420c3-575a-4194-9a72-cebe07823674", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "6672030f-5a8a-4bea-9792-c24b980392e9", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "With Configuration", "item": [ { "name": "Prep: Read Available Tests", "event": [ { "listen": "test", "script": { "id": "504b76ca-6870-443c-8c33-0cccc52cddae", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var availableTests = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(typeof availableTests).to.equal(\"object\");", " for (var api of Object.keys(availableTests)) {", " pm.expect(availableTests[api]).to.be.an.instanceof(Array);", " var apiRegExp = new RegExp(\"^/\" + api, \"i\");", " for (var test of availableTests[api]) {", " pm.expect(test).to.match(apiRegExp);", " }", " }", "});", "", "var includedTests = [];", "var excludedTests = [];", "var specialTimeoutTest = \"\";", "", "var apis = Object.keys(availableTests).sort();", "for(var api of apis) {", " if (availableTests[api].length > 50) {", " var subDirs = availableTests[api].map(test => test.split(\"/\").filter(part => !!part).join(\"/\").split(\"/\")[1]).reduce((acc, curr) => acc.indexOf(curr) === -1 ? acc.concat([curr]) : acc, []);", " if (subDirs.length > 2) {", " includedTests.push(\"/\" + api);", " excludedTests.push(\"/\" + api + \"/\" + subDirs[0]);", " specialTimeoutTest = availableTests[api][availableTests[api].length - 1];", " break;", " }", " ", " }", "}", "", "pm.globals.set(\"available_tests\", availableTests);", "pm.globals.set(\"included_tests\", JSON.stringify(includedTests));", "pm.globals.set(\"excluded_tests\", JSON.stringify(excludedTests));", "pm.globals.set(\"special_timeout_test\", specialTimeoutTest.replace(\".\", \"\"));" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests" ] } }, "response": [] }, { "name": "Create Session \\w Configuration", "event": [ { "listen": "test", "script": { "id": "fa956871-503a-421c-9822-4e2a11e1cf1c", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "213bdf59-9f98-4b5e-bacc-ae3cb31ae26a", "exec": [ "var automaticTimeout = 120000;", "var manualTimeout = 1000000;", "var specialTimeout = 2000;", "", "pm.globals.set(\"automatic_timeout\", automaticTimeout);", "pm.globals.set(\"manual_timeout\", manualTimeout);", "pm.globals.set(\"special_timeout\", specialTimeout);", "", "const availableTests = pm.globals.get(\"available_tests\");", "const apiNames = Object.keys(availableTests).sort();", "const apiName = apiNames[0];", "", "pm.globals.set(\"api_name\", apiName);", "pm.globals.set(\"special_timeout_test\", \"/\" + apiName);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"tests\": {\n \"include\": [\"/{{api_name}}\"]\n },\n \"timeouts\": {\n \"automatic\": {{automatic_timeout}},\n \"manual\": {{manual_timeout}},\n \"{{special_timeout_test}}\": {{special_timeout}}\n },\n \"labels\": [\"label1\", \"label2\"]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read Session Configuration", "event": [ { "listen": "test", "script": { "id": "a0434a56-04b8-4987-8f44-2d71b440ef03", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "var includedTests = JSON.parse(pm.globals.get(\"included_tests\"));", "var excludedTests = JSON.parse(pm.globals.get(\"excluded_tests\"));", "var automaticTimeout = pm.globals.get(\"automatic_timeout\");", "var manualTimeout = pm.globals.get(\"manual_timeout\");", "var specialTimeout = pm.globals.get(\"special_timeout\");", "var specialTimeoutTest = pm.globals.get(\"special_timeout_test\");", "", "pm.test(\"Configuration is as specified\", function () {", " pm.expect(jsonData.token).to.match(tokenRegex);", " for (var test of includedTests) {", " pm.expect(jsonData.tests.include).to.include(test);", " }", " for (var test of excludedTests) {", " pm.expect(jsonData.tests.exclude).to.include(test);", " }", " pm.expect(jsonData.types).to.include(\"automatic\");", " pm.expect(jsonData.types).to.include(\"manual\");", " pm.expect(jsonData.user_agent).to.include(\"PostmanRuntime\");", " pm.expect(jsonData.timeouts.automatic).to.equal(automaticTimeout);", " pm.expect(jsonData.timeouts.manual).to.equal(manualTimeout);", " pm.expect(jsonData.timeouts[specialTimeoutTest]).to.equal(specialTimeout);", " pm.expect(jsonData.browser.name).to.equal(\"Other\");", " pm.expect(jsonData.browser.version).to.equal(\"0\");", " pm.expect(jsonData.is_public).to.equal(false);", " pm.expect(jsonData.reference_tokens).to.be.empty;", " pm.expect(jsonData.labels).to.include(\"label1\");", " pm.expect(jsonData.labels).to.include(\"label2\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "2a7524e5-7394-4177-8267-42d5b32bc474", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "", "var jsonData = pm.response.json();", "", "pm.test(\"Session status is pending\", function () {", " pm.expect(jsonData.status).to.equal(\"pending\");", "})", "", "pm.test(\"Start and Finish date not set\", function () {", " pm.expect(jsonData.date_started).to.be.null;", " pm.expect(jsonData.date_finished).to.be.null;", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] }, { "name": "Read Tests of Session", "event": [ { "listen": "test", "script": { "id": "448b6a0c-135d-42ef-8bc0-b4b1ce4ab8a0", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"All tests are pending tests\", function () {", " pm.expect(Object.keys(jsonData.pending_tests)).to.not.have.lengthOf(0);", " pm.expect(Object.keys(jsonData.running_tests)).to.have.lengthOf(0);", "})", "", "const availableTests = pm.globals.get(\"available_tests\");", "const includedTests = pm.globals.get(\"included_tests\");", "const excludedTests = pm.globals.get(\"excluded_tests\");", "", "pm.test(\"Selected subset of tests are part of the session\", function () {", " for (var api of Object.keys(jsonData.pending_tests)) {", " for (var includedTest of includedTests) {", " if (includedTest.split(\"/\").find(part => !!part) === api) {", " var includeRegExp = new RegExp(\"^\" + includedTest, \"i\");", " for (var test of jsonData.pending_tests[api]) {", " pm.expect(test).to.match(regex);", " }", " break;", " }", " }", " for (var excludedTest of excludedTests) {", " if (excludedTest.split(\"/\").find(part => !!part) === api) {", " var excludeRegExp = new RegExp(\"^\" + excludedTest, \"i\");", " for (var test of jsonData.pending_tests[api]) {", " pm.expect(test).to.not.match(regex);", " }", " break;", " }", " }", " }", "});", "", "const sessionTests = jsonData.pending_tests;", "", "pm.globals.set(\"session_tests\", JSON.stringify(sessionTests));" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}" ] } }, "response": [] }, { "name": "Clean up: Delete session", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "id": "a16eac8e-9609-4314-abd8-a5c470537b52", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "5df55957-0bbb-4db8-9ab9-d8a70ce37bc5", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "With Expiration", "item": [ { "name": "Create Session With Expiration", "event": [ { "listen": "test", "script": { "id": "6c4aa702-ae3a-44a4-b886-b3e883de4d32", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "893672a9-c666-4790-b6a7-e0ce7afda482", "exec": [ "var expirationDate = Date.now() + 3000;", "pm.globals.set(\"expiration_date\", expirationDate);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n\t\"expiration_date\": {{expiration_date}}\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read Expired Session", "event": [ { "listen": "test", "script": { "id": "f6b31d37-a98b-4110-80a2-f78db6f2e26f", "exec": [ "pm.test(\"Status code is 404\", function () {", " pm.response.to.have.status(404);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "d41cf31b-c8e8-455f-aa69-527af5fbd66b", "exec": [ "var expirationDate = pm.globals.get(\"expiration_date\");", "", "var timeout = expirationDate - Date.now() + 1000", "", "console.log(timeout)", "", "setTimeout(function () {}, timeout);" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Clean up: Delete session", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "read session", "item": [ { "name": "Prep: Create Session No Configuration", "event": [ { "listen": "test", "script": { "id": "090ca1bc-cbee-4d7b-b19f-fc1f4bb879a0", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read Session Configuration", "event": [ { "listen": "test", "script": { "id": "232aff11-3cdc-4994-af42-5e3574583814", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"tests\");", " pm.expect(typeof jsonData.tests).to.equal(\"object\");", " pm.expect(jsonData.tests).to.have.property(\"include\");", " pm.expect(jsonData.tests.include).to.be.an.instanceof(Array);", " pm.expect(jsonData.tests).to.have.property(\"exclude\");", " pm.expect(jsonData.tests.exclude).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"types\");", " pm.expect(jsonData.types).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"user_agent\");", " pm.expect(typeof jsonData.user_agent).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"timeouts\");", " pm.expect(typeof jsonData.timeouts).to.equal(\"object\")", " pm.expect(jsonData.timeouts).to.have.property(\"automatic\");", " pm.expect(typeof jsonData.timeouts.automatic).to.equal(\"number\");", " pm.expect(jsonData.timeouts).to.have.property(\"manual\");", " pm.expect(typeof jsonData.timeouts.manual).to.equal(\"number\");", " pm.expect(jsonData).to.have.property(\"browser\");", " pm.expect(typeof jsonData.browser).to.equal(\"object\");", " pm.expect(jsonData.browser).to.have.property(\"name\");", " pm.expect(typeof jsonData.browser.name).to.equal(\"string\");", " pm.expect(jsonData.browser).to.have.property(\"version\");", " pm.expect(typeof jsonData.browser.version).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"reference_tokens\");", " pm.expect(jsonData.reference_tokens).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"labels\");", " pm.expect(jsonData.labels).to.be.an.instanceof(Array);", " pm.expect(jsonData).to.have.property(\"date_created\");", "});", "", "pm.test(\"Configuration is default\", function () {", " pm.expect(jsonData.token).to.match(tokenRegex);", " pm.expect(jsonData.tests.include).to.include(\"/\");", " pm.expect(jsonData.types).to.include(\"automatic\");", " pm.expect(jsonData.types).to.include(\"manual\");", " pm.expect(jsonData.user_agent).to.include(\"PostmanRuntime\");", " pm.expect(jsonData.timeouts.automatic).to.equal(60000);", " pm.expect(jsonData.timeouts.manual).to.equal(300000);", " pm.expect(jsonData.browser.name).to.equal(\"Other\");", " pm.expect(jsonData.browser.version).to.equal(\"0\");", " pm.expect(jsonData.is_public).to.equal(false);", " pm.expect(jsonData.reference_tokens).to.be.empty;", " pm.expect(jsonData.labels).to.be.empty;", " pm.expect(new Date(jsonData.date_created).getTime()).to.be.below(Date.now());", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] }, { "name": "Clean up: Delete session", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "read session status", "item": [ { "name": "Prep: Create Session No Configuration", "event": [ { "listen": "test", "script": { "id": "73cbeeb0-019b-4331-b0ec-ef9d3f1e0494", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read Session Status", "event": [ { "listen": "test", "script": { "id": "ba142b55-2454-4472-bcf9-669b0bb7bab9", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(typeof jsonData.token).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"status\");", " pm.expect(typeof jsonData.status).to.equal(\"string\");", " pm.expect(jsonData).to.have.property(\"expiration_date\");", " pm.expect(jsonData.expiration_date).to.be.null;", " pm.expect(jsonData).to.have.property(\"date_started\");", " pm.expect(jsonData).to.have.property(\"date_finished\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "status" ] } }, "response": [] }, { "name": "Clean up: Delete session", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "read sessions", "item": [ { "name": "Without query parameters", "item": [ { "name": "Read sessions", "event": [ { "listen": "test", "script": { "id": "f443955f-b57e-4801-8eac-547597381615", "exec": [ "const response = pm.response.json();", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"JSON structure as expected\", function() {", " pm.expect(response).to.have.property(\"items\");", " pm.expect(response[\"items\"]).to.be.instanceof(Array);", " pm.expect(response).to.have.property(\"_links\");", " pm.expect(response[\"_links\"]).to.be.instanceof(Object);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/_wave/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "_wave", "api", "sessions" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Containing created session", "item": [ { "name": "Prep: Create session", "event": [ { "listen": "test", "script": { "id": "2ca80dee-f9a5-4e0b-bead-6ab871d9edf8", "exec": [ "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read sessions", "event": [ { "listen": "test", "script": { "id": "fbf5eafb-0ae7-4105-8df5-51bb53b0c595", "exec": [ "const token = pm.globals.get(\"session_token\");", "const response = pm.response.json();", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"JSON structure as expected\", function() {", " pm.expect(response).to.have.property(\"items\");", " pm.expect(response[\"items\"]).to.be.instanceof(Array);", " pm.expect(response).to.have.property(\"_links\");", " pm.expect(response[\"_links\"]).to.be.instanceof(Object);", "});", "", "pm.test(\"Created session's token in response\", function() {", " pm.expect(response.items).to.contain(token);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/_wave/api/sessions?index=0&count=1000", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "_wave", "api", "sessions" ], "query": [ { "key": "index", "value": "0" }, { "key": "count", "value": "1000" } ] } }, "response": [] }, { "name": "Clean up: Delete Session", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "With configuration expansion", "item": [ { "name": "Prep: Create session", "event": [ { "listen": "test", "script": { "id": "bdd64594-c874-4eb2-8b36-4c37cea0f0cb", "exec": [ "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read sessions", "event": [ { "listen": "test", "script": { "id": "6732aedf-d99d-416f-b93d-98bc0404ef61", "exec": [ "const token = pm.globals.get(\"session_token\");", "const response = pm.response.json();", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"JSON structure as expected\", function() {", " pm.expect(response).to.have.property(\"items\");", " pm.expect(response[\"items\"]).to.be.instanceof(Array);", " pm.expect(response).to.have.property(\"_links\");", " pm.expect(response[\"_links\"]).to.be.instanceof(Object);", " pm.expect(response).to.have.property(\"_embedded\");", " pm.expect(response[\"_embedded\"]).to.be.instanceof(Object);", " pm.expect(response[\"_embedded\"]).to.have.property(\"configuration\");", " pm.expect(response[\"_embedded\"][\"configuration\"]).to.be.instanceof(Array);", "});", "", "pm.test(\"Created session's token in response\", function() {", " pm.expect(response.items).to.contain(token);", "});", "", "pm.test(\"Created session's token in embedded configuration\", function() {", " let tokenInConfigurationList = false;", " let configurations = response._embedded.configuration;", " for (let configuration of configurations) {", " if (configuration.token !== token) continue;", " tokenInConfigurationList = true;", " }", " pm.expect(tokenInConfigurationList).to.equal(true);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/_wave/api/sessions?index=0&count=1000&expand=configuration", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "_wave", "api", "sessions" ], "query": [ { "key": "index", "value": "0" }, { "key": "count", "value": "1000" }, { "key": "expand", "value": "configuration" } ] } }, "response": [] }, { "name": "Clean up: Delete Session", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "With status expansion", "item": [ { "name": "Prep: Create session", "event": [ { "listen": "test", "script": { "id": "3319e417-dd54-495f-a452-5519d2a61082", "exec": [ "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] }, { "name": "Read sessions", "event": [ { "listen": "test", "script": { "id": "6ca3480a-3224-4bf8-a466-fdcb06338795", "exec": [ "const token = pm.globals.get(\"session_token\");", "const response = pm.response.json();", "", "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"JSON structure as expected\", function() {", " pm.expect(response).to.have.property(\"items\");", " pm.expect(response[\"items\"]).to.be.instanceof(Array);", " pm.expect(response).to.have.property(\"_links\");", " pm.expect(response[\"_links\"]).to.be.instanceof(Object);", " pm.expect(response).to.have.property(\"_embedded\");", " pm.expect(response[\"_embedded\"]).to.be.instanceof(Object);", " pm.expect(response[\"_embedded\"]).to.have.property(\"status\");", " pm.expect(response[\"_embedded\"][\"status\"]).to.be.instanceof(Array);", "});", "", "pm.test(\"Created session's token in response\", function() {", " pm.expect(response.items).to.contain(token);", "});", "", "pm.test(\"Created session's token in embedded status\", function() {", " let tokenInStatusList = false;", " let statuses = response._embedded.status;", " for (let status of statuses) {", " if (status.token !== token) continue;", " tokenInStatusList = true;", " }", " pm.expect(tokenInStatusList).to.equal(true);", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/_wave/api/sessions?index=0&count=1000&expand=status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "_wave", "api", "sessions" ], "query": [ { "key": "index", "value": "0" }, { "key": "count", "value": "1000" }, { "key": "expand", "value": "status" } ] } }, "response": [] }, { "name": "Clean up: Delete Session", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {} }, { "name": "Results API", "item": [ { "name": "upload api", "item": [ { "name": "create session", "item": [ { "name": "Prep: Read Available Tests", "event": [ { "listen": "test", "script": { "id": "1f3d8b67-aab8-44a0-abf4-e320a6b27755", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var availableTests = pm.response.json();", "", "var includedTests = [];", "var excludedTests = [];", "var specialTimeoutTest = \"\";", "", "var apis = Object.keys(availableTests);", "for(var api of apis) {", " if (availableTests[api].length > 50) {", " var subDirs = availableTests[api].map(test => test.split(\"/\").filter(part => !!part)[1]).reduce((acc, curr) => acc.indexOf(curr) === -1 ? acc.concat([curr]) : acc, []);", " if (subDirs.length > 2) {", " includedTests.push(\"/\" + api);", " excludedTests.push(\"/\" + api + \"/\" + subDirs[0]);", " specialTimeoutTest = availableTests[api][availableTests[api].length - 1];", " break;", " }", " ", " }", "}", "", "var usedApi = apis[0];", "", "pm.globals.set(\"api_name\", usedApi);", "pm.globals.set(\"test\", availableTests[usedApi][0]);" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests" ] } }, "response": [] }, { "name": "Create Session With One test", "event": [ { "listen": "test", "script": { "id": "f42479d4-f723-4843-ba91-f30019ebd975", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const tokenRegex = new RegExp(\"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$\");", "", "pm.test(\"Responds with token in JSON format\", function () {", " var jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property(\"token\");", " pm.expect(jsonData.token).to.match(tokenRegex);", "});", "", "", "const response = pm.response.json();", "const token = response.token;", "pm.globals.set(\"session_token\", token);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "type": "text", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"tests\": {\n \"include\": [\"{{test}}\"]\n }\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions" ] } }, "response": [] } ], "event": [ { "listen": "prerequest", "script": { "id": "9f8fc606-25ee-45de-bcd8-57735900701b", "type": "text/javascript", "exec": [ "" ] } }, { "listen": "test", "script": { "id": "be2341a8-1598-41b0-96a6-cfd049badd07", "type": "text/javascript", "exec": [ "" ] } } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "create results", "item": [ { "name": "Start Session", "event": [ { "listen": "test", "script": { "id": "897e04ae-d0a2-4a67-9488-2bdeb55db06b", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}/start", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}", "start" ] } }, "response": [] }, { "name": "Read Next Test of Session", "event": [ { "listen": "test", "script": { "id": "95b382c6-9d08-41b9-80d1-40dc0217cc09", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "const response = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(Object.keys(response)).to.have.lengthOf(1);", " pm.expect(response).to.have.property(\"next_test\");", " pm.expect(typeof response.next_test).to.equal(\"string\");", "});", "", "const nextTest = response.next_test;", "pm.globals.set(\"current_test_url\", nextTest);", "if (!nextTest) return;", "", "const parameters = nextTest.split(\"?\")[1].split(\"&\");", "let test = parameters.find(parameter => parameter.split(\"=\")[0] === \"test_url\").split(\"=\")[1];", "test = decodeURIComponent(test);", "test = \"/\" + test.split(\"/\").slice(3).join(\"/\").split(\"?\")[0];", "", "pm.globals.set(\"current_test\", test);" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/tests/{{session_token}}/next", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "tests", "{{session_token}}", "next" ] } }, "response": [] }, { "name": "Create Result", "event": [ { "listen": "test", "script": { "id": "67b23ac9-5254-4b7b-90bf-930a9661a614", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [ { "key": "Content-Type", "name": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\n \"test\": \"{{current_test}}\",\n \"status\": \"OK\",\n \"message\": null,\n \"subtests\": [\n {\n \"name\": \"Subtest testing feature xy\",\n \"status\": \"FAIL\",\n \"message\": \"Error message\"\n }\n ]\n}" }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "upload new results", "item": [ { "name": "Download current results", "event": [ { "listen": "test", "script": { "id": "984c79db-5ae1-4c22-8b62-6eccabfaeb98", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "var results = jsonData.results;", "", "pm.globals.set(\"results\", results);" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "a9a46b5f-2dd3-4fa7-a482-7186ac01a4d6", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}/{{api_name}}/json", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}", "{{api_name}}", "json" ] } }, "response": [] }, { "name": "Read Current Compact Results", "event": [ { "listen": "test", "script": { "id": "f4974495-2e84-4962-9259-1d5501fb7a3f", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.globals.set(\"compact_results\", jsonData);" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}/compact", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}", "compact" ] } }, "response": [] }, { "name": "Upload Results Api Json", "event": [ { "listen": "test", "script": { "id": "4a7df46d-546c-4cf4-8c6a-9b13eaa0be32", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "e2196348-a4a0-48d3-bd72-f591f0b65cf0", "exec": [ "var results = pm.globals.get(\"results\");", "var newSubResult = ", " {", " \"name\": \"placeholder sub test\",", " \"status\": \"PASS\",", " \"message\": \"this is a placeholder sub test\"", " };", "", "results[0].subtests.push(newSubResult);", "resultsString = JSON.stringify(results);", "pm.globals.set(\"resultsString\", resultsString);" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"results\": {{resultsString}}\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}/{{api_name}}/json", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}", "{{api_name}}", "json" ] } }, "response": [] }, { "name": "Check if changes took effect", "event": [ { "listen": "test", "script": { "id": "8c45fd6d-ca98-4393-ace6-c01563d7c1ec", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "pm.test(\"Returned results contain new result\", function () {", " var jsonData = pm.response.json();", " var results = jsonData.results;", "", " var oldResults = pm.globals.get(\"results\");", "", " pm.expect(oldResults[0].subtests.length + 1).to.equal(results[0].subtests.length);", "});", "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "0c9e31fc-1931-4dcd-978f-39e2a38f9a3f", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}/{{api_name}}/json", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}", "{{api_name}}", "json" ] } }, "response": [] }, { "name": "Check changes in Compact Results", "event": [ { "listen": "test", "script": { "id": "6e30b533-18f9-41bc-af65-bdde323c215a", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "var test = pm.globals.get(\"test\");", "var oldCompactResults = pm.globals.get(\"compact_results\");", "", "pm.test(\"passed test increased\", function () {", " var api = test.split(\"/\").find(part => !!part);", " pm.expect(jsonData[api].pass).to.equal(oldCompactResults[api].pass + 1);", "})" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/results/{{session_token}}/compact", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "results", "{{session_token}}", "compact" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "clean up", "item": [ { "name": "Clean up: Delete session", "request": { "method": "DELETE", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/sessions/{{session_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "sessions", "{{session_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {} }, { "name": "General API", "item": [ { "name": "server status", "item": [ { "name": "Read server status", "event": [ { "listen": "test", "script": { "id": "8b5b4c23-db0a-4b81-9349-ce8ead64bb7a", "exec": [ "pm.test(\"Status code is 200\", function () {", " pm.response.to.have.status(200);", "});", "", "var jsonData = pm.response.json();", "", "pm.test(\"JSON structure is as expected\", function () {", " pm.expect(jsonData).to.have.property(\"import_results_enabled\");", " pm.expect(typeof jsonData.import_results_enabled).to.equal(\"boolean\");", " pm.expect(jsonData).to.have.property(\"reports_enabled\");", " pm.expect(typeof jsonData.reports_enabled).to.equal(\"boolean\");", " pm.expect(jsonData).to.have.property(\"read_sessions_enabled\");", " pm.expect(typeof jsonData.read_sessions_enabled).to.equal(\"boolean\");", " pm.expect(jsonData).to.have.property(\"version_string\");", " pm.expect(typeof jsonData.version_string).to.equal(\"string\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/status", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "status" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {} }, { "name": "Devices API", "item": [ { "name": "create", "item": [ { "name": "Create device", "event": [ { "listen": "test", "script": { "id": "286426ec-c394-48a4-a90f-c6dd80c7bef1", "exec": [ "pm.test(\"Successful POST request\", function () {", " pm.expect(pm.response.code).to.be.oneOf([200,201,202]);", "});", "", "var response = pm.response.json();", "", "pm.test('Schema is valid', function() {", " pm.expect(response).to.have.property(\"token\");", "});", "", "pm.test('Data is valid', function() {", " pm.expect(typeof response.token).to.equal(\"string\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "" ] } }, "response": [] }, { "name": "Clean up: Wait device timeout", "event": [ { "listen": "test", "script": { "id": "3bdb0f7c-1261-465e-9b02-0070005f0c43", "exec": [ "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "a1cf5880-7b8e-4bc6-9d92-59632a719c54", "exec": [ "var timeout = parseInt(pm.environment.get(\"device_timeout\")) + 500", "", "setTimeout(function () {}, timeout);" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "read device", "item": [ { "name": "Device not found", "item": [ { "name": "Read device", "event": [ { "listen": "test", "script": { "id": "a4401cbc-0a3a-4c2d-b1ed-e7d6867614ff", "exec": [ "pm.test(\"Successful GET request\", function () {", " pm.expect(pm.response.code).to.equal(404);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "1644fd70-b4c4-4207-8e12-67752a984417", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/invalid_token", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "invalid_token" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Device found", "item": [ { "name": "Prep: Create device", "event": [ { "listen": "test", "script": { "id": "c4f14137-5ced-449b-a872-b7d541e2f6af", "exec": [ "var response = pm.response.json();", "var token = response.token;", "", "pm.globals.set(\"device_token\", token)" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "" ] } }, "response": [] }, { "name": "Read device", "event": [ { "listen": "test", "script": { "id": "61a840f1-d3cd-4d7a-a54f-30da1266e48f", "exec": [ "pm.test(\"Successful GET request\", function () {", " pm.expect(pm.response.code).to.be.oneOf([200]);", "});", "", "var response = pm.response.json();", "", "pm.test('Schema is valid', function() {", " pm.expect(response).to.have.property(\"token\");", " pm.expect(response).to.have.property(\"user_agent\");", " pm.expect(response).to.have.property(\"last_active\");", " pm.expect(response).to.have.property(\"name\");", "});", "", "pm.test('Data is valid', function() {", " pm.expect(typeof response.token).to.equal(\"string\");", " pm.expect(typeof response.user_agent).to.equal(\"string\");", " pm.expect(typeof response.last_active).to.equal(\"string\");", " pm.expect(typeof response.name).to.equal(\"string\");", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/{{device_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "{{device_token}}" ] } }, "response": [] }, { "name": "Clean up: Wait device timeout", "event": [ { "listen": "test", "script": { "id": "17112336-b962-472d-86a8-7872ff9876d1", "exec": [ "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "912939cc-1685-4e1f-b0a6-696b264870ca", "exec": [ "var timeout = parseInt(pm.environment.get(\"device_timeout\")) + 500", "", "setTimeout(function () {}, timeout);" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "Timed out device", "item": [ { "name": "Prep: Create device", "event": [ { "listen": "test", "script": { "id": "c99b9318-1e50-4702-9d81-53d87faa1080", "exec": [ "var response = pm.response.json();", "var token = response.token;", "", "pm.globals.set(\"device_token\", token)" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "" ] } }, "response": [] }, { "name": "Wait device timeout", "event": [ { "listen": "test", "script": { "id": "89517dc9-31b4-40e7-89e4-99dd6e792e6a", "exec": [ "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "ed20bbf6-4f31-4d91-a07b-7a0b4afcf161", "exec": [ "var timeout = parseInt(pm.environment.get(\"device_timeout\")) + 500", "", "setTimeout(function () {}, timeout);" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "" ] } }, "response": [] }, { "name": "Read device", "event": [ { "listen": "test", "script": { "id": "7b7496f5-2fdc-470c-b394-2a5ae7d29da2", "exec": [ "pm.test(\"Successful GET request\", function () {", " pm.expect(pm.response.code).to.equal(404);", "});" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "1807f152-7ef4-4277-9db6-1bff53d6cc8b", "exec": [ "" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/{{device_token}}", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "{{device_token}}" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true }, { "name": "read devices", "item": [ { "name": "Prep: Create device A", "event": [ { "listen": "test", "script": { "id": "a7803c5c-f371-4ae0-8b08-1c06995c9b60", "exec": [ "var response = pm.response.json();", "var token = response.token;", "", "pm.globals.set(\"device_token_a\", token)" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "" ] } }, "response": [] }, { "name": "Prep: Create device B", "event": [ { "listen": "test", "script": { "id": "02450903-aef9-4ee6-9d48-94ba9b5fd54c", "exec": [ "var response = pm.response.json();", "var token = response.token;", "", "pm.globals.set(\"device_token_b\", token)" ], "type": "text/javascript" } } ], "request": { "method": "POST", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "" ] } }, "response": [] }, { "name": "Read devices", "event": [ { "listen": "test", "script": { "id": "1612417b-bed8-48d5-a6a3-39d0d0fe6932", "exec": [ "pm.test(\"Successful GET request\", function () {", " pm.expect(pm.response.code).to.be.oneOf([200]);", "});", "", "var response = pm.response.json();", "", "pm.test('Schema is valid', function() {", " pm.expect(response).to.be.instanceof(Array);", " response.forEach(element => {", " pm.expect(element).to.have.property(\"token\");", " pm.expect(element).to.have.property(\"user_agent\");", " pm.expect(element).to.have.property(\"last_active\");", " pm.expect(element).to.have.property(\"name\");", " })", "});", "", "pm.test('Data is valid', function() {", " pm.expect(response).to.have.lengthOf(2);", " var devices_left = [", " pm.globals.get(\"device_token_a\"), ", " pm.globals.get(\"device_token_b\")", " ]", " response.forEach(element => {", " pm.expect(typeof element.token).to.equal(\"string\");", " pm.expect(typeof element.user_agent).to.equal(\"string\");", " pm.expect(typeof element.last_active).to.equal(\"string\");", " pm.expect(typeof element.name).to.equal(\"string\");", " pm.expect(devices_left).to.include(element.token);", " devices_left.splice(devices_left.indexOf(element.token), 1);", " })", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "" ] } }, "response": [] }, { "name": "Clean up: Wait device timeout", "event": [ { "listen": "test", "script": { "id": "9b7ff623-8aac-46d1-9c56-1ceb8acc2de6", "exec": [ "" ], "type": "text/javascript" } }, { "listen": "prerequest", "script": { "id": "c0fbf742-f75e-4f3b-a576-75c9d5e0f72d", "exec": [ "var timeout = parseInt(pm.environment.get(\"device_timeout\")) + 500", "", "setTimeout(function () {}, timeout);" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{protocol}}://{{host}}:{{port}}/{{web_root}}/api/devices/", "protocol": "{{protocol}}", "host": [ "{{host}}" ], "port": "{{port}}", "path": [ "{{web_root}}", "api", "devices", "" ] } }, "response": [] } ], "protocolProfileBehavior": {}, "_postman_isSubFolder": true } ], "protocolProfileBehavior": {} } ], "protocolProfileBehavior": {} }