test: derive overview relation request from counts
This commit is contained in:
@@ -113,6 +113,10 @@
|
||||
"key": "overviewKey",
|
||||
"value": "open"
|
||||
},
|
||||
{
|
||||
"key": "overviewRelationExpectedCount",
|
||||
"value": "0"
|
||||
},
|
||||
{
|
||||
"key": "overviewKeys",
|
||||
"value": "TicketsNew,TicketsActive,TicketsCritical,TicketsNewInfo,IncidentNew,IncidentActive,IncidentCritical,IncidentNewInfo,UnassignedTickets,UnassignedTicketsCritical"
|
||||
@@ -494,6 +498,39 @@
|
||||
"item": [
|
||||
{
|
||||
"name": "getTicketOverviewCounts personal",
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"type": "text/javascript",
|
||||
"exec": [
|
||||
"const overviewCountsPersonalJson = pm.response.json();",
|
||||
"const overviewCountsPersonal = overviewCountsPersonalJson.counts || overviewCountsPersonalJson.Counts || {};",
|
||||
"const overviewPreferredKeysPersonal = (pm.collectionVariables.get(\"overviewKeys\") || \"\")",
|
||||
" .split(\",\")",
|
||||
" .map(key => key.trim())",
|
||||
" .filter(Boolean);",
|
||||
"const overviewRelationKeyPersonal = overviewPreferredKeysPersonal.find(key => Number(overviewCountsPersonal[key] || 0) > 0)",
|
||||
" || Object.keys(overviewCountsPersonal).find(key => Number(overviewCountsPersonal[key] || 0) > 0)",
|
||||
" || overviewPreferredKeysPersonal[0]",
|
||||
" || Object.keys(overviewCountsPersonal)[0]",
|
||||
" || \"\";",
|
||||
"const overviewRelationCountPersonal = overviewRelationKeyPersonal ? Number(overviewCountsPersonal[overviewRelationKeyPersonal] || 0) : 0;",
|
||||
"",
|
||||
"pm.collectionVariables.set(\"scope\", \"personal\");",
|
||||
"pm.collectionVariables.set(\"overviewKey\", overviewRelationKeyPersonal);",
|
||||
"pm.collectionVariables.set(\"overviewRelationExpectedCount\", String(overviewRelationCountPersonal));",
|
||||
"",
|
||||
"pm.test(\"Captured personal overview relation parameters\", function () {",
|
||||
" pm.expect(overviewCountsPersonal).to.be.an(\"object\");",
|
||||
" pm.expect(pm.collectionVariables.get(\"scope\")).to.equal(\"personal\");",
|
||||
" pm.expect(pm.collectionVariables.get(\"overviewKey\")).to.be.a(\"string\").and.not.empty;",
|
||||
" pm.expect(Number(pm.collectionVariables.get(\"overviewRelationExpectedCount\"))).to.be.at.least(0);",
|
||||
"});"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [
|
||||
@@ -539,6 +576,39 @@
|
||||
},
|
||||
{
|
||||
"name": "getTicketOverviewCounts role",
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"type": "text/javascript",
|
||||
"exec": [
|
||||
"const overviewCountsRoleJson = pm.response.json();",
|
||||
"const overviewCountsRole = overviewCountsRoleJson.counts || overviewCountsRoleJson.Counts || {};",
|
||||
"const overviewPreferredKeysRole = (pm.collectionVariables.get(\"overviewKeys\") || \"\")",
|
||||
" .split(\",\")",
|
||||
" .map(key => key.trim())",
|
||||
" .filter(Boolean);",
|
||||
"const overviewRelationKeyRole = overviewPreferredKeysRole.find(key => Number(overviewCountsRole[key] || 0) > 0)",
|
||||
" || Object.keys(overviewCountsRole).find(key => Number(overviewCountsRole[key] || 0) > 0)",
|
||||
" || overviewPreferredKeysRole[0]",
|
||||
" || Object.keys(overviewCountsRole)[0]",
|
||||
" || \"\";",
|
||||
"const overviewRelationCountRole = overviewRelationKeyRole ? Number(overviewCountsRole[overviewRelationKeyRole] || 0) : 0;",
|
||||
"",
|
||||
"pm.collectionVariables.set(\"scope\", \"role\");",
|
||||
"pm.collectionVariables.set(\"overviewKey\", overviewRelationKeyRole);",
|
||||
"pm.collectionVariables.set(\"overviewRelationExpectedCount\", String(overviewRelationCountRole));",
|
||||
"",
|
||||
"pm.test(\"Captured role overview relation parameters\", function () {",
|
||||
" pm.expect(overviewCountsRole).to.be.an(\"object\");",
|
||||
" pm.expect(pm.collectionVariables.get(\"scope\")).to.equal(\"role\");",
|
||||
" pm.expect(pm.collectionVariables.get(\"overviewKey\")).to.be.a(\"string\").and.not.empty;",
|
||||
" pm.expect(Number(pm.collectionVariables.get(\"overviewRelationExpectedCount\"))).to.be.at.least(0);",
|
||||
"});"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [
|
||||
@@ -615,6 +685,23 @@
|
||||
},
|
||||
{
|
||||
"name": "getTicketOverviewRelations",
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"type": "text/javascript",
|
||||
"exec": [
|
||||
"const overviewRelations = pm.response.text() ? pm.response.json() : [];",
|
||||
"const expectedOverviewRelationCount = Number(pm.collectionVariables.get(\"overviewRelationExpectedCount\") || 0);",
|
||||
"",
|
||||
"pm.test(\"Overview relations count matches captured overview count\", function () {",
|
||||
" pm.expect(Array.isArray(overviewRelations)).to.equal(true);",
|
||||
" pm.expect(overviewRelations.length).to.equal(expectedOverviewRelationCount);",
|
||||
"});"
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [
|
||||
@@ -624,7 +711,7 @@
|
||||
}
|
||||
],
|
||||
"url": {
|
||||
"raw": "{{baseUrl}}/api/c4itf4sdwebapi/getTicketOverviewRelations?sid={{sid}}&scope={{scope}}&key={{overviewKey}}&count=25&queueoption={{queueOption}}&queues={{queues}}",
|
||||
"raw": "{{baseUrl}}/api/c4itf4sdwebapi/getTicketOverviewRelations?sid={{sid}}&scope={{scope}}&key={{overviewKey}}&count={{overviewRelationExpectedCount}}&queueoption={{queueOption}}&queues={{queues}}",
|
||||
"host": [
|
||||
"{{baseUrl}}"
|
||||
],
|
||||
@@ -648,7 +735,7 @@
|
||||
},
|
||||
{
|
||||
"key": "count",
|
||||
"value": "25"
|
||||
"value": "{{overviewRelationExpectedCount}}"
|
||||
},
|
||||
{
|
||||
"key": "queueoption",
|
||||
|
||||
Reference in New Issue
Block a user