diff --git a/dotcms-postman/src/main/resources/postman/PagesResourceTests.json b/dotcms-postman/src/main/resources/postman/PagesResourceTests.json index 387182e1d5a..d595ae90d6c 100644 --- a/dotcms-postman/src/main/resources/postman/PagesResourceTests.json +++ b/dotcms-postman/src/main/resources/postman/PagesResourceTests.json @@ -1,9 +1,9 @@ { "info": { - "_postman_id": "7a488c87-858e-4edd-8722-c38e4071afdf", + "_postman_id": "f9abea8b-4376-484c-94d0-7a7015f27f6c", "name": "Page API - [api/v1/page]", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "36473486" + "_exporter_id": "31066048" }, "item": [ { @@ -3098,6 +3098,536 @@ } ] }, + { + "name": "Live page cache invalidation", + "item": [ + { + "name": "Create Test Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Page created successfully\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.collectionVariables.set(\"pageIdentifier\", jsonData.entity.identifier);", + " pm.collectionVariables.set(\"pagePath\", jsonData.entity.path);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"contentlet\": {\n\t\t\"contentType\":\"htmlpageasset\",\n \"title\":\"testPageInvalidation{{$timestamp}}\",\n \"url\":\"testPageInvalidation{{$timestamp}}\",\n \"hostFolder\":\"default\",\n \"template\":\"SYSTEM_TEMPLATE\",\n \"friendlyName\":\"testPageInvalidation{{$timestamp}}\",\n \"cachettl\":0\n\t\t\n\t}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH?indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ], + "query": [ + { + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] + }, + "description": "Creates a test page" + }, + "response": [] + }, + { + "name": "Create Test Rich Text Contentlet 1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Rich Text created successfully\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.collectionVariables.set(\"richContentIdentifier1\", jsonData.entity.identifier);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"contentlet\": {\n\t\t\"contentType\":\"webPageContent\",\n \"title\":\"testContent1\",\n \"contentHost\":\"default\",\n \"body\":\"Test1 Content Body\"\n \n\t}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH?indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ], + "query": [ + { + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] + }, + "description": "Creates test data" + }, + "response": [] + }, + { + "name": "Create Test Rich Text Contentlet 2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Rich Text created successfully\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.collectionVariables.set(\"richContentIdentifier2\", jsonData.entity.identifier);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"contentlet\": {\n\t\t\"contentType\":\"webPageContent\",\n \"title\":\"testContent2\",\n \"contentHost\":\"default\",\n \"body\":\"Test2 Content Body\"\n \n\t}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH?indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ], + "query": [ + { + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] + }, + "description": "Creates test data" + }, + "response": [] + }, + { + "name": "Create Test Rich Text Contentlet 3", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Rich Text created successfully\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.collectionVariables.set(\"richContentIdentifier3\", jsonData.entity.identifier);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"contentlet\": {\n\t\t\"contentType\":\"webPageContent\",\n \"title\":\"testContent3\",\n \"contentHost\":\"default\",\n \"body\":\"Test3 Content Body\"\n \n\t}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH?indexPolicy=WAIT_FOR", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ], + "query": [ + { + "key": "indexPolicy", + "value": "WAIT_FOR" + } + ] + }, + "description": "Creates test data" + }, + "response": [] + }, + { + "name": "Add Test Content To Test Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Content added to Test Page successfuly\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "[\n {\n \"identifier\": \"SYSTEM_CONTAINER\",\n \"uuid\": \"1\",\n \"contentletsId\": [\n \"{{richContentIdentifier1}}\"\n ]\n }\n]", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/{{pageIdentifier}}/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "{{pageIdentifier}}", + "content" + ] + }, + "description": "Adds a single content to the created page" + }, + "response": [] + }, + { + "name": "Check That Multi-Tree Data Is Correct", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Retrieving Multi-Tree data for test Contentlet\", function () {", + " var entity = pm.response.json().entity;", + " var testContentId = pm.collectionVariables.get(\"richContentIdentifier1\");", + " var found = false;", + " entity.forEach((treeEntry) => {", + "", + " if (testContentId == treeEntry.contentId) {", + " found = true;", + " }", + "", + " });", + " if (!found) {", + " pm.expect.fail(\"Expected test Contentlet with ID '\" + testContentId + \"' was not found\");", + " }", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/{{pageIdentifier}}/content/tree", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "{{pageIdentifier}}", + "content", + "tree" + ] + }, + "description": "Validate the content was added properly" + }, + "response": [] + }, + { + "name": "Request page and validate content", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Body contains