From 0750e2701063e95c88724a5e523ccc32887da1f6 Mon Sep 17 00:00:00 2001 From: freddyDOTCMS <147462678+freddyDOTCMS@users.noreply.github.com> Date: Tue, 20 Aug 2024 11:11:03 -0600 Subject: [PATCH] geeting PageResourceTest back (#29659) ### Proposed Changes * Getting PageResourcTest back --- .../postman/resources/PagesResourceTests.json | 6817 +++++++++++++++++ 1 file changed, 6817 insertions(+) create mode 100644 dotcms-postman/src/main/resources/postman/resources/PagesResourceTests.json diff --git a/dotcms-postman/src/main/resources/postman/resources/PagesResourceTests.json b/dotcms-postman/src/main/resources/postman/resources/PagesResourceTests.json new file mode 100644 index 000000000000..fd72b5ac289c --- /dev/null +++ b/dotcms-postman/src/main/resources/postman/resources/PagesResourceTests.json @@ -0,0 +1,6817 @@ + +{ + "info": { + "_postman_id": "5d246a25-bf38-49f7-86c8-1fafb5d88b0f", + "name": "Page API - [api/v1/page]", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "30436704" + }, + "item": [ + { + "name": "CreateTestContext", + "item": [ + { + "name": "Delete Image ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/2c46b6586c38852ac08a824a303ced80", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "2c46b6586c38852ac08a824a303ced80" + ] + }, + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + }, + "response": [] + }, + { + "name": "Delete Video ContentType", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/contenttype/id/c77450b834901a20c8193ef9d561ee5b", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype", + "id", + "c77450b834901a20c8193ef9d561ee5b" + ] + }, + "description": "Given a content type ID.\nExpect that code is 200.\nExpect content type is deleted successfully." + }, + "response": [] + }, + { + "name": "pre_ImportBundleWithContext", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Bundle uploaded sucessfully\", function () {", + " pm.response.to.have.status(200);", + "", + " var jsonData = pm.response.json();", + " console.log(jsonData);", + "", + " pm.expect(jsonData[\"bundleName\"]).to.eql(\"assets.tar.gz\");", + " pm.expect(jsonData[\"status\"]).to.eql(\"SUCCESS\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/octet-stream" + }, + { + "key": "Content-Disposition", + "value": "attachment" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "resources/GraphQL/assets.tar.gz" + } + ] + }, + "url": { + "raw": "{{serverURL}}/api/bundle/sync", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "bundle", + "sync" + ], + "query": [ + { + "key": "AUTH_TOKEN", + "value": "", + "disabled": true + } + ] + }, + "description": "Imports a Bundle that includes:\n* HTMLPage /blog/index\n* HTMLPage /blog/destinations/costa-rica\n* Contentlet [Blog] Ecotourism in Costa Rica\n* Blog Detail Page /blog/blog-detail" + }, + "response": [] + } + ], + "description": "Imports a Bundle that includes:\n* HTMLPage /blog/index\n* HTMLPage /blog/destinations/costa-rica\n* Contentlet [Blog] Ecotourism in Costa Rica\n* Blog Detail Page /blog/blog-detail", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "JSON [api/v1/page/json]", + "item": [ + { + "name": "Using Actual Page URIs", + "item": [ + { + "name": "Invalidate Session", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "logout" + ] + } + }, + "response": [] + }, + { + "name": "Get Page Metadata With Invalid User", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 401, Need credentials\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "", + "", + "pm.test(\"Response body matches\", function () {", + " pm.expect(pm.response.text()).to.eq(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/json/destinations/costa-rica", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "json", + "destinations", + "costa-rica" + ] + }, + "description": "Given no user, should return 401 and \"Invalid User\" message" + }, + "response": [] + }, + { + "name": "Switch to 'demo.dotcms.com'", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Valid response\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.hostSwitched).equal(true);", + "});", + "", + "pm.environment.set(\"forcePreRequestScript\", false);", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.environment.set(\"forcePreRequestScript\", true);", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{serverURL}}/api/v1/site/switch/48190c8c-42c4-46af-8d1a-0cd5db894797", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "switch", + "48190c8c-42c4-46af-8d1a-0cd5db894797" + ] + } + }, + "response": [] + }, + { + "name": "Get Valid HTML Page Metadata", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "", + "", + "pm.test(\"Include template\", function () {", + " pm.expect(pm.response.text()).to.include(\"template\");", + "});", + "", + "pm.test(\"Include layout\", function () {", + " pm.expect(pm.response.text()).to.include(\"layout\");", + "});", + "", + "pm.test(\"Include Containers\", function () {", + " pm.expect(pm.response.text()).to.include(\"containers\");", + "});", + "", + "pm.test(\"'page' element includes all properties\", function () {", + " var jsonData = pm.response.json();", + " var page = jsonData[\"entity\"][\"page\"];", + " pm.expect(page[\"__icon__\"]).equal(\"pageIcon\");", + " pm.expect(page[\"archived\"], 'FAILED:[archived]').equal(false);", + " pm.expect(page[\"baseType\"]).equal(\"HTMLPAGE\");", + " pm.expect(page[\"cachettl\"]).equal(\"0\");", + " pm.expect(page[\"canEdit\"], 'FAILED:[canEdit]').equal(true);", + " pm.expect(page[\"canLock\"], 'FAILED:[canLock]').equal(true);", + " pm.expect(page[\"canRead\"], 'FAILED:[canRead]').equal(true);", + " pm.expect(page[\"deleted\"], 'FAILED:[deleted]').equal(false);", + " pm.expect(page[\"extension\"]).equal(\"page\");", + " pm.expect(page[\"folder\"]).equal(\"6c8a2ac4-36a7-4b01-b9c0-c2c1d91ddfdb\");", + " pm.expect(page[\"friendlyName\"]).equal(\"Costa Rica Rain Forest\");", + " pm.expect(page[\"hasLiveVersion\"], 'FAILED:[hasLiveVersion]').equal(true);", + " pm.expect(page[\"hasTitleImage\"], 'FAILED:[hasTitleImage]').equal(true);", + " pm.expect(page[\"host\"]).equal(\"48190c8c-42c4-46af-8d1a-0cd5db894797\");", + " pm.expect(page[\"hostName\"]).equal(\"demo.dotcms.com\");", + " ////", + " pm.expect(page[\"httpsRequired\"], 'FAILED:[httpsRequired]').equal(false);", + " pm.expect(page[\"identifier\"]).equal(\"bec7b960-a8bf-4f14-a22b-0d94caf217f0\");", + " pm.expect(page[\"image\"]).equal(\"/dA/bec7b960-a8bf-4f14-a22b-0d94caf217f0/image/costa-rica-tree-frog.jpg\");", + " pm.expect(page[\"imageContentAsset\"]).equal(\"bec7b960-a8bf-4f14-a22b-0d94caf217f0/image\");", + " pm.expect(page[\"inode\"]).not.equal(null)", + " pm.expect(page[\"isContentlet\"], 'FAILED:[isContentlet]').equal(true);", + " pm.expect(page[\"languageId\"]).equal(1);", + " pm.expect(page[\"live\"], 'FAILED:[live]').equal(true);", + " pm.expect(page[\"liveInode\"]).not.equal(null)", + " pm.expect(page[\"locked\"], 'FAILED:[locked]').equal(false);", + " pm.expect(page[\"mimeType\"]).equal(\"application/dotpage\");", + " pm.expect(page[\"modDate\"]).not.equal(null)", + " ///", + " pm.expect(page[\"modUser\"]).equal(\"system\");", + " pm.expect(page[\"modUserName\"]).equal(\"system user system user\");", + " pm.expect(page[\"name\"]).equal(\"costa-rica\");", + " pm.expect(page[\"owner\"]).equal(\"dotcms.org.1\");", + " pm.expect(page[\"pageURI\"]).equal(\"/destinations/costa-rica\");", + " pm.expect(page[\"pageUrl\"]).equal(\"costa-rica\");", + " pm.expect(page[\"path\"]).equal(\"/destinations/costa-rica\");", + " pm.expect(page[\"publishDate\"]).not.equal(null)", + " pm.expect(page[\"seoTitle\"]).equal(\"Costa Rica Travel Destinations\");", + " pm.expect(page[\"seodescription\"]).equal(\"Visit Costa Rica a rugged, rainforested Central American country with coastlines on the Caribbean and Pacific.\");", + " pm.expect(page[\"shortDescription\"]).equal(\"Costa Rica is a rugged, rainforested Central American country with coastlines on the Caribbean and Pacific. Costa Rica is known for its beaches, volcanoes, and biodiversity. Roughly a quarter of its area is made up of protected jungle, teeming with wildlife including spider monkeys and quetzal birds.\");", + " pm.expect(page[\"shortyLive\"]).not.equal(null)", + " //", + " pm.expect(page[\"shortyWorking\"]).not.equal(null)", + " pm.expect(page[\"sortOrder\"]).equal(0);", + " pm.expect(page[\"stInode\"]).equal(\"91812c8b-0441-4139-8d4d-7423cfb0e979\");", + " pm.expect(page[\"statusIcons\"]).equal(\"\");", + " pm.expect(page[\"tags\"]).equal(\"diving\");", + " pm.expect(page[\"template\"]).equal(\"0c556e37-99e0-4458-a2cd-d42cc7a11045\");", + " pm.expect(page[\"title\"]).equal(\"Costa Rica Rain Forest\");", + " pm.expect(page[\"titleImage\"]).equal(\"image\");", + " pm.expect(page[\"type\"]).equal(\"htmlpage\");", + " pm.expect(page[\"url\"]).equal(\"/destinations/costa-rica\");", + " pm.expect(page[\"working\"], 'FAILED:[working]').equal(true);", + " pm.expect(page[\"workingInode\"]).not.equal(null)", + "", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/json/destinations/costa-rica", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "json", + "destinations", + "costa-rica" + ] + }, + "description": "http://localhost:8080/api/v1/page/json/{page-url}" + }, + "response": [] + }, + { + "name": "Invalidate Session", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "logout" + ] + } + }, + "response": [] + }, + { + "name": "Get Non-Existing HTML Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "", + "", + "pm.test(\"Valid response\", function () {", + " pm.expect(pm.response.text()).to.include(\"Page \\'about-us/index2\\' not found\");", + "});", + "", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/json/about-us/index2", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "json", + "about-us", + "index2" + ] + } + }, + "response": [] + }, + { + "name": "Get Metadata From URL Map", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors\", function () {", + " ", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "}); ", + "", + "pm.test(\"Has Rows and Columns\", function () {", + " ", + " var jsonData = pm.response.json();", + " ", + " pm.expect(jsonData.entity.layout.body.rows.length).to.equal(2);", + " pm.expect(jsonData.entity.layout.body.rows[0].columns.length).to.equal(1);", + " ", + "});", + "", + "pm.test(\"Number of Contents\", function () {", + " ", + " var jsonData = pm.response.json();", + " ", + " pm.expect(jsonData.entity.numberContents).to.equal(2);", + " ", + " ", + "});", + "", + "pm.test(\"Page checks\", function () {", + " ", + " var jsonData = pm.response.json();", + " ", + " pm.expect(jsonData.entity.page.pageURI).to.equal('/blog/index');", + " pm.expect(jsonData.entity.page.title).to.equal('Blogs');", + " pm.expect(jsonData.entity.page.type).to.equal('htmlpage');", + " ", + "});", + "", + "pm.test(\"Site checks\", function () {", + " ", + " var jsonData = pm.response.json();", + " ", + " pm.expect(jsonData.entity.site.hostname).to.equal('demo.dotcms.com');", + " pm.expect(jsonData.entity.site.type).to.equal('contentlet');", + " ", + "});", + "", + "pm.test(\"Template checks\", function () {", + " ", + " var jsonData = pm.response.json();", + " ", + " pm.expect(jsonData.entity.template.title).to.equal('anonymous_layout_1571406924828');", + " pm.expect(jsonData.entity.template.type).to.equal('template');", + " ", + "});", + "", + "pm.test(\"Contentlets checks\", function () {", + " ", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.containers[\"//demo.dotcms.com/application/containers/default/\"].contentlets[\"uuid-1\"][0].title).to.equal('Travel Blog Header');", + " pm.expect(jsonData.entity.containers[\"//demo.dotcms.com/application/containers/default/\"].contentlets[\"uuid-1\"][0].contentType).to.equal('webPageContent');", + "});", + "", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/json/blog/index", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "json", + "blog", + "index" + ] + }, + "description": "Gets an Url content map" + }, + "response": [] + } + ], + "description": "Tests calling the `json` method passing down the actual URI of an HTML Page.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Using Vanity URLs", + "item": [ + { + "name": "Create Test Forward Vanity URL", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Forward Vanity URL was created successfully\", function () {", + " var jsonData = pm.response.json().entity;", + " pm.expect(jsonData.summary.failCount).to.eql(0, \"An error occurred when creating the test Vanity URL\");", + " pm.expect(jsonData.summary.successCount).to.eql(1, \"One piece of content should have been created\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlets\": [\n {\n \"contentType\": \"Vanityurl\",\n \"languageId\": 1,\n \"title\": \"Test Forward Vanity URL\",\n \"site\": \"demo.dotcms.com\",\n \"uri\": \"/forward-json\",\n \"action\": 200,\n \"forwardTo\": \"/destinations/costa-rica\",\n \"order\": 0\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + }, + "description": "Create the original Contentlet." + }, + "response": [] + }, + { + "name": "Create Test Temporary Redirect Vanity URL", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Temporary Redirect Vanity URL was created successfully\", function () {", + " var jsonData = pm.response.json().entity;", + " pm.expect(jsonData.summary.failCount).to.eql(0, \"An error occurred when creating the test Vanity URL\");", + " pm.expect(jsonData.summary.successCount).to.eql(1, \"One piece of content should have been created\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlets\": [\n {\n \"contentType\": \"Vanityurl\",\n \"languageId\": 1,\n \"title\": \"Test Temporary Vanity URL\",\n \"site\": \"demo.dotcms.com\",\n \"uri\": \"/temporary-json\",\n \"action\": 302,\n \"forwardTo\": \"/destinations/costa-rica\",\n \"order\": 0\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + }, + "description": "Create the original Contentlet." + }, + "response": [] + }, + { + "name": "Create Test Permanent Redirect Vanity URL", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Permanent Redirect Vanity URL was created successfully\", function () {", + " var jsonData = pm.response.json().entity;", + " pm.expect(jsonData.summary.failCount).to.eql(0, \"An error occurred when creating the test Vanity URL\");", + " pm.expect(jsonData.summary.successCount).to.eql(1, \"One piece of content should have been created\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlets\": [\n {\n \"contentType\": \"Vanityurl\",\n \"languageId\": 1,\n \"title\": \"Test Permanent Vanity URL\",\n \"site\": \"demo.dotcms.com\",\n \"uri\": \"/permanent-json\",\n \"action\": 301,\n \"forwardTo\": \"/destinations/costa-rica\",\n \"order\": 0\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + }, + "description": "Create the original Contentlet." + }, + "response": [] + }, + { + "name": "Get HTML Page Metadata - Forward", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Response body contains the 'uuid' attribute\", function () {", + " pm.expect(pm.response.text()).to.include(\"uuid\");", + "});", + "", + "pm.test(\"The 'page' element includes all the expected properties\", function () {", + " var jsonData = pm.response.json();", + " var page = jsonData[\"entity\"][\"page\"];", + " pm.expect(page[\"__icon__\"]).equal(\"pageIcon\");", + " pm.expect(page[\"archived\"], 'FAILED:[archived]').equal(false);", + " pm.expect(page[\"baseType\"]).equal(\"HTMLPAGE\");", + " pm.expect(page[\"cachettl\"]).equal(\"0\");", + " pm.expect(page[\"canEdit\"], 'FAILED:[canEdit]').equal(true);", + " pm.expect(page[\"canLock\"], 'FAILED:[canLock]').equal(true);", + " pm.expect(page[\"canRead\"], 'FAILED:[canRead]').equal(true);", + " pm.expect(page[\"deleted\"], 'FAILED:[deleted]').equal(false);", + " pm.expect(page[\"extension\"]).equal(\"page\");", + " pm.expect(page[\"folder\"]).equal(\"6c8a2ac4-36a7-4b01-b9c0-c2c1d91ddfdb\");", + " pm.expect(page[\"friendlyName\"]).equal(\"Costa Rica Rain Forest\");", + " pm.expect(page[\"hasLiveVersion\"], 'FAILED:[hasLiveVersion]').equal(true);", + " pm.expect(page[\"hasTitleImage\"], 'FAILED:[hasTitleImage]').equal(true);", + " pm.expect(page[\"host\"]).equal(\"48190c8c-42c4-46af-8d1a-0cd5db894797\");", + " pm.expect(page[\"hostName\"]).equal(\"demo.dotcms.com\");", + " ////", + " pm.expect(page[\"httpsRequired\"], 'FAILED:[httpsRequired]').equal(false);", + " pm.expect(page[\"identifier\"]).equal(\"bec7b960-a8bf-4f14-a22b-0d94caf217f0\");", + " pm.expect(page[\"image\"]).equal(\"/dA/bec7b960-a8bf-4f14-a22b-0d94caf217f0/image/costa-rica-tree-frog.jpg\");", + " pm.expect(page[\"imageContentAsset\"]).equal(\"bec7b960-a8bf-4f14-a22b-0d94caf217f0/image\");", + " pm.expect(page[\"inode\"]).not.equal(null)", + " pm.expect(page[\"isContentlet\"], 'FAILED:[isContentlet]').equal(true);", + " pm.expect(page[\"languageId\"]).equal(1);", + " pm.expect(page[\"live\"], 'FAILED:[live]').equal(true);", + " pm.expect(page[\"liveInode\"]).not.equal(null)", + " pm.expect(page[\"locked\"], 'FAILED:[locked]').equal(false);", + " pm.expect(page[\"mimeType\"]).equal(\"application/dotpage\");", + " pm.expect(page[\"modDate\"]).not.equal(null)", + " ///", + " pm.expect(page[\"modUser\"]).equal(\"system\");", + " pm.expect(page[\"modUserName\"]).equal(\"system user system user\");", + " pm.expect(page[\"name\"]).equal(\"costa-rica\");", + " pm.expect(page[\"owner\"]).equal(\"dotcms.org.1\");", + " pm.expect(page[\"pageURI\"]).equal(\"/destinations/costa-rica\");", + " pm.expect(page[\"pageUrl\"]).equal(\"costa-rica\");", + " pm.expect(page[\"path\"]).equal(\"/destinations/costa-rica\");", + " pm.expect(page[\"publishDate\"]).not.equal(null)", + " pm.expect(page[\"seoTitle\"]).equal(\"Costa Rica Travel Destinations\");", + " pm.expect(page[\"seodescription\"]).equal(\"Visit Costa Rica a rugged, rainforested Central American country with coastlines on the Caribbean and Pacific.\");", + " pm.expect(page[\"shortDescription\"]).equal(\"Costa Rica is a rugged, rainforested Central American country with coastlines on the Caribbean and Pacific. Costa Rica is known for its beaches, volcanoes, and biodiversity. Roughly a quarter of its area is made up of protected jungle, teeming with wildlife including spider monkeys and quetzal birds.\");", + " pm.expect(page[\"shortyLive\"]).not.equal(null)", + " //", + " pm.expect(page[\"shortyWorking\"]).not.equal(null)", + " pm.expect(page[\"sortOrder\"]).equal(0);", + " pm.expect(page[\"stInode\"]).equal(\"91812c8b-0441-4139-8d4d-7423cfb0e979\");", + " pm.expect(page[\"statusIcons\"]).equal(\"\");", + " pm.expect(page[\"tags\"]).equal(\"diving\");", + " pm.expect(page[\"template\"]).equal(\"0c556e37-99e0-4458-a2cd-d42cc7a11045\");", + " pm.expect(page[\"title\"]).equal(\"Costa Rica Rain Forest\");", + " pm.expect(page[\"titleImage\"]).equal(\"image\");", + " pm.expect(page[\"type\"]).equal(\"htmlpage\");", + " pm.expect(page[\"url\"]).equal(\"/destinations/costa-rica\");", + " pm.expect(page[\"working\"], 'FAILED:[working]').equal(true);", + " pm.expect(page[\"workingInode\"]).not.equal(null)", + "});", + "", + "pm.test(\"The 'Forward' Vanity URL data must be present\", function() {", + " var entity = pm.response.json().entity;", + " pm.expect(entity.vanityUrl).not.not.equal(undefined, \"The 'vanityUrl' attribute is missing\");", + " pm.expect(entity.vanityUrl.url).to.be.equal(\"/forward-json\", \"The 'url' attribute is NOT the expected one\");", + " pm.expect(entity.vanityUrl.response).to.be.equal(200, \"The 'response' attribute must be 200\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/json/forward-json", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "json", + "forward-json" + ] + } + }, + "response": [] + }, + { + "name": "Get HTML Page Metadata - Temporary Redirect", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"The 'Temporary Redirect' Vanity URL data must be present\", function() {", + " var entity = pm.response.json().entity;", + " pm.expect(entity.vanityUrl).to.not.equal(undefined, \"The 'vanityUrl' attribute must be present\");", + " pm.expect(entity.vanityUrl.response).to.be.equal(302, \"The 'response' attribute must be 302\");", + " pm.expect(entity.vanityUrl.temporaryRedirect).to.equal(true, \"The returned Vanity URL MUST be a temporary redirect\");", + " pm.expect(entity.vanityUrl.permanentRedirect).to.equal(false, \"The returned Vanity URL MUST NOT be a permanent redirect\");", + " pm.expect(entity.vanityUrl.forward).to.equal(false, \"The returned Vanity URL MUST NOT be a forward\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/json/temporary-json", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "json", + "temporary-json" + ] + } + }, + "response": [] + }, + { + "name": "Get HTML Page Metadata - Permanent Redirect", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"The 'Permanent Redirect' Vanity URL must be present\", function() {", + " var entity = pm.response.json().entity;", + " pm.expect(entity.vanityUrl).to.not.equal(undefined, \"The 'vanityUrl' attribute must be present\");", + " pm.expect(entity.vanityUrl.response).to.be.equal(301, \"The 'response' attribute must be 301\");", + " pm.expect(entity.vanityUrl.permanentRedirect).to.equal(true, \"The returned Vanity URL MUST be a permanent redirect\");", + " pm.expect(entity.vanityUrl.temporaryRedirect).to.equal(false, \"The returned Vanity URL MUST NOT be a temporary redirect\");", + " pm.expect(entity.vanityUrl.forward).to.equal(false, \"The returned Vanity URL MUST NOT be a forward\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/json/permanent-json", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "json", + "permanent-json" + ] + } + }, + "response": [] + } + ], + "description": "Tests calling the `json` method passing down a Vanity URL that references an HTML Page, using the three redirect options:\n\n1. Forward.\n \n2. Temporary Redirect.\n \n3. Permanent Redirect.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"HTTP Status must be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "" + ] + } + } + ] + } + ], + "description": "Returns the metadata in JSON format of the objects that make up an HTML Page in the system.\n\nhttp://localhost:8080/api/v1/page/json/{page-url}", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Render [api/v1/page/render]", + "item": [ + { + "name": "Using Actual Page URIs", + "item": [ + { + "name": "Invalidate Session", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "logout" + ] + } + }, + "response": [] + }, + { + "name": "Get Page Metadata With Invalid User", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 401, Need credentials\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response body matches\", function () {", + " pm.expect(pm.response.text()).to.include(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/destinations/costa-rica", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "destinations", + "costa-rica" + ] + } + }, + "response": [] + }, + { + "name": "Switch to 'demo.dotcms.com'", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Valid response\", function () {", + " var jsonData = pm.response.json();", + "", + " pm.expect(jsonData.entity.hostSwitched).equal(true);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{serverURL}}/api/v1/site/switch/48190c8c-42c4-46af-8d1a-0cd5db894797", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "switch", + "48190c8c-42c4-46af-8d1a-0cd5db894797" + ] + } + }, + "response": [] + }, + { + "name": "Get Valid HTML Page Metadata", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response body contains\", function () {", + " pm.expect(pm.response.text()).to.include(\"rendered\");", + "});", + "", + "pm.test(\"Response body contains\", function () {", + " pm.expect(pm.response.text()).to.include(\"uuid\");", + "});", + "", + "pm.test(\"'page' element includes all properties\", function () {", + " var jsonData = pm.response.json();", + " var page = jsonData[\"entity\"][\"page\"];", + " pm.expect(page[\"__icon__\"]).equal(\"pageIcon\");", + " pm.expect(page[\"archived\"], 'FAILED:[archived]').equal(false);", + " pm.expect(page[\"baseType\"]).equal(\"HTMLPAGE\");", + " pm.expect(page[\"cachettl\"]).equal(\"0\");", + " pm.expect(page[\"canEdit\"], 'FAILED:[canEdit]').equal(true);", + " pm.expect(page[\"canLock\"], 'FAILED:[canLock]').equal(true);", + " pm.expect(page[\"canRead\"], 'FAILED:[canRead]').equal(true);", + " pm.expect(page[\"deleted\"], 'FAILED:[deleted]').equal(false);", + " pm.expect(page[\"extension\"]).equal(\"page\");", + " pm.expect(page[\"folder\"]).equal(\"6c8a2ac4-36a7-4b01-b9c0-c2c1d91ddfdb\");", + " pm.expect(page[\"friendlyName\"]).equal(\"Costa Rica Rain Forest\");", + " pm.expect(page[\"hasLiveVersion\"], 'FAILED:[hasLiveVersion]').equal(true);", + " pm.expect(page[\"hasTitleImage\"], 'FAILED:[hasTitleImage]').equal(true);", + " pm.expect(page[\"host\"]).equal(\"48190c8c-42c4-46af-8d1a-0cd5db894797\");", + " pm.expect(page[\"hostName\"]).equal(\"demo.dotcms.com\");", + " ////", + " pm.expect(page[\"httpsRequired\"], 'FAILED:[httpsRequired]').equal(false);", + " pm.expect(page[\"identifier\"]).equal(\"bec7b960-a8bf-4f14-a22b-0d94caf217f0\");", + " pm.expect(page[\"image\"]).equal(\"/dA/bec7b960-a8bf-4f14-a22b-0d94caf217f0/image/costa-rica-tree-frog.jpg\");", + " pm.expect(page[\"imageContentAsset\"]).equal(\"bec7b960-a8bf-4f14-a22b-0d94caf217f0/image\");", + " pm.expect(page[\"inode\"]).not.equal(null)", + " pm.expect(page[\"isContentlet\"], 'FAILED:[isContentlet]').equal(true);", + " pm.expect(page[\"languageId\"]).equal(1);", + " pm.expect(page[\"live\"], 'FAILED:[live]').equal(true);", + " pm.expect(page[\"liveInode\"]).not.equal(null)", + " pm.expect(page[\"locked\"], 'FAILED:[locked]').equal(false);", + " pm.expect(page[\"mimeType\"]).equal(\"application/dotpage\");", + " pm.expect(page[\"modDate\"]).not.equal(null)", + " ///", + " pm.expect(page[\"modUser\"]).equal(\"system\");", + " pm.expect(page[\"modUserName\"]).equal(\"system user system user\");", + " pm.expect(page[\"name\"]).equal(\"costa-rica\");", + " pm.expect(page[\"owner\"]).equal(\"dotcms.org.1\");", + " pm.expect(page[\"pageURI\"]).equal(\"/destinations/costa-rica\");", + " pm.expect(page[\"pageUrl\"]).equal(\"costa-rica\");", + " pm.expect(page[\"path\"]).equal(\"/destinations/costa-rica\");", + " pm.expect(page[\"publishDate\"]).not.equal(null)", + " pm.expect(page[\"seoTitle\"]).equal(\"Costa Rica Travel Destinations\");", + " pm.expect(page[\"seodescription\"]).equal(\"Visit Costa Rica a rugged, rainforested Central American country with coastlines on the Caribbean and Pacific.\");", + " pm.expect(page[\"shortDescription\"]).equal(\"Costa Rica is a rugged, rainforested Central American country with coastlines on the Caribbean and Pacific. Costa Rica is known for its beaches, volcanoes, and biodiversity. Roughly a quarter of its area is made up of protected jungle, teeming with wildlife including spider monkeys and quetzal birds.\");", + " pm.expect(page[\"shortyLive\"]).not.equal(null)", + " //", + " pm.expect(page[\"shortyWorking\"]).not.equal(null)", + " pm.expect(page[\"sortOrder\"]).equal(0);", + " pm.expect(page[\"stInode\"]).equal(\"91812c8b-0441-4139-8d4d-7423cfb0e979\");", + " pm.expect(page[\"statusIcons\"]).equal(\"\");", + " pm.expect(page[\"tags\"]).equal(\"diving\");", + " pm.expect(page[\"template\"]).equal(\"0c556e37-99e0-4458-a2cd-d42cc7a11045\");", + " pm.expect(page[\"title\"]).equal(\"Costa Rica Rain Forest\");", + " pm.expect(page[\"titleImage\"]).equal(\"image\");", + " pm.expect(page[\"type\"]).equal(\"htmlpage\");", + " pm.expect(page[\"url\"]).equal(\"/destinations/costa-rica\");", + " pm.expect(page[\"working\"], 'FAILED:[working]').equal(true);", + " pm.expect(page[\"workingInode\"]).not.equal(null)", + "", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/destinations/costa-rica", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "destinations", + "costa-rica" + ] + } + }, + "response": [] + }, + { + "name": "Get Metadata From Non-Existing HTML Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "", + "pm.test(\"Response body contains\", function () {", + " ", + " pm.expect( pm.response.json().message).to.eq(\"Page 'about-us/index2' not found\");", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/about-us/index2", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "about-us", + "index2" + ] + } + }, + "response": [] + }, + { + "name": "Reset workflow for contentlet", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "", + "", + "pm.test(\"Correct identifier\", function () {", + " pm.expect(pm.response.json().entity.identifier).equal(\"57ee7cd3-66fc-4f01-9b7e-11e53553c220\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/2d1dc7718f/fire?identifier=57ee7cd3-66fc-4f01-9b7e-11e53553c220", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "2d1dc7718f", + "fire" + ], + "query": [ + { + "key": "identifier", + "value": "57ee7cd3-66fc-4f01-9b7e-11e53553c220" + } + ] + }, + "description": "The piece of content \"Ecoturism in Costarica\" gets somehow archived at this point after being imported in a previous bundle. This resets its workflow so it can be published in the next request" + }, + "response": [] + }, + { + "name": "Publish Archived Content", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200 \", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "", + "", + "pm.test(\"Correct identifier\", function () {", + " pm.expect(pm.response.json().entity.identifier).equal(\"57ee7cd3-66fc-4f01-9b7e-11e53553c220\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/175009d69e/fire?identifier=57ee7cd3-66fc-4f01-9b7e-11e53553c220", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "175009d69e", + "fire" + ], + "query": [ + { + "key": "identifier", + "value": "57ee7cd3-66fc-4f01-9b7e-11e53553c220" + } + ] + }, + "description": "This publishes the content `Ecotourism in Costa Rica` so it can be tested in the next request" + }, + "response": [] + }, + { + "name": "Get Metadata From URL Map", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors\", function () {", + " ", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "", + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "}); ", + "", + "pm.test(\"Has Rows and Columns\", function () {", + " ", + " var jsonData = pm.response.json();", + " ", + " pm.expect(jsonData.entity.layout.body.rows.length).to.equal(1);", + " pm.expect(jsonData.entity.layout.body.rows[0].columns.length).to.equal(1);", + " ", + "});", + "", + "pm.test(\"Number of Contents\", function () {", + " ", + " var jsonData = pm.response.json();", + " ", + " pm.expect(jsonData.entity.numberContents).to.equal(1);", + " ", + " ", + "});", + "", + "pm.test(\"Page checks\", function () {", + " ", + " var jsonData = pm.response.json();", + " ", + " pm.expect(jsonData.entity.page.pageURI).to.equal('/blog/post/ecotourism-in-costa-rica');", + " pm.expect(jsonData.entity.page.title).to.equal('Blog Detail');", + " pm.expect(jsonData.entity.page.type).to.equal('htmlpage');", + " ", + "});", + "", + "pm.test(\"Site checks\", function () {", + " ", + " var jsonData = pm.response.json();", + " ", + " pm.expect(jsonData.entity.site.hostname).to.equal('demo.dotcms.com');", + " pm.expect(jsonData.entity.site.type).to.equal('contentlet');", + " ", + "});", + "", + "pm.test(\"Template checks\", function () {", + " ", + " var jsonData = pm.response.json();", + " ", + " pm.expect(jsonData.entity.template.title).to.equal('anonymous_layout_1582562696562');", + " pm.expect(jsonData.entity.template.type).to.equal('template');", + " ", + "});", + "", + "pm.test(\"Url Content Map checks\", function () {", + " ", + " var jsonData = pm.response.json();", + "", + " pm.expect(jsonData.entity.urlContentMap.hostName).to.equal('demo.dotcms.com');", + " pm.expect(jsonData.entity.urlContentMap.baseType).to.equal('CONTENT');", + " pm.expect(jsonData.entity.urlContentMap.contentType).to.equal('Blog');", + " pm.expect(jsonData.entity.urlContentMap.urlTitle).to.equal('ecotourism-in-costa-rica');", + " pm.expect(jsonData.entity.urlContentMap['URL_MAP_FOR_CONTENT']).to.equal('/blog/post/ecotourism-in-costa-rica');", + " pm.expect(jsonData.entity.urlContentMap['urlMap']).to.equal('/blog/post/ecotourism-in-costa-rica');", + "});", + "", + "", + "", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/blog/post/ecotourism-in-costa-rica?mode=EDIT_MODE", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "blog", + "post", + "ecotourism-in-costa-rica" + ], + "query": [ + { + "key": "mode", + "value": "EDIT_MODE" + } + ] + }, + "description": "Gets an Url content map" + }, + "response": [] + } + ], + "description": "Tests calling the `render` method passing down the actual URI of an HTML Page." + }, + { + "name": "Using Vanity URLs", + "item": [ + { + "name": "Create Test Forward Vanity URL", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Forward Vanity URL was created successfully\", function () {", + " var jsonData = pm.response.json().entity;", + " pm.expect(jsonData.summary.failCount).to.eql(0, \"An error occurred when creating the test Vanity URL\");", + " pm.expect(jsonData.summary.successCount).to.eql(1, \"One piece of content should have been created\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlets\": [\n {\n \"contentType\": \"Vanityurl\",\n \"languageId\": 1,\n \"title\": \"Test Forward Vanity URL\",\n \"site\": \"demo.dotcms.com\",\n \"uri\": \"/forward-render\",\n \"action\": 200,\n \"forwardTo\": \"/destinations/costa-rica\",\n \"order\": 0\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + }, + "description": "Create the original Contentlet." + }, + "response": [] + }, + { + "name": "Create Test Temporary Redirect Vanity URL", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Temporary Redirect Vanity URL was created successfully\", function () {", + " var jsonData = pm.response.json().entity;", + " pm.expect(jsonData.summary.failCount).to.eql(0, \"An error occurred when creating the test Vanity URL\");", + " pm.expect(jsonData.summary.successCount).to.eql(1, \"One piece of content should have been created\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlets\": [\n {\n \"contentType\": \"Vanityurl\",\n \"languageId\": 1,\n \"title\": \"Test Temporary Vanity URL\",\n \"site\": \"demo.dotcms.com\",\n \"uri\": \"/temporary-render\",\n \"action\": 302,\n \"forwardTo\": \"/destinations/costa-rica\",\n \"order\": 0\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + }, + "description": "Create the original Contentlet." + }, + "response": [] + }, + { + "name": "Create Test Permanent Redirect Vanity URL", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Test Permanent Redirect Vanity URL was created successfully\", function () {", + " var jsonData = pm.response.json().entity;", + " pm.expect(jsonData.summary.failCount).to.eql(0, \"An error occurred when creating the test Vanity URL\");", + " pm.expect(jsonData.summary.successCount).to.eql(1, \"One piece of content should have been created\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlets\": [\n {\n \"contentType\": \"Vanityurl\",\n \"languageId\": 1,\n \"title\": \"Test Permanent Vanity URL\",\n \"site\": \"demo.dotcms.com\",\n \"uri\": \"/permanent-render\",\n \"action\": 301,\n \"forwardTo\": \"/destinations/costa-rica\",\n \"order\": 0\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + }, + "description": "Create the original Contentlet." + }, + "response": [] + }, + { + "name": "Get HTML Page Metadata - Forward", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Response body contains the 'rendered' attribute\", function () {", + " pm.expect(pm.response.text()).to.include(\"rendered\");", + "});", + "", + "pm.test(\"Response body contains the 'uuid' attribute\", function () {", + " pm.expect(pm.response.text()).to.include(\"uuid\");", + "});", + "", + "pm.test(\"The 'page' element includes all the expected properties\", function () {", + " var jsonData = pm.response.json();", + " var page = jsonData[\"entity\"][\"page\"];", + " pm.expect(page[\"__icon__\"]).equal(\"pageIcon\");", + " pm.expect(page[\"archived\"], 'FAILED:[archived]').equal(false);", + " pm.expect(page[\"baseType\"]).equal(\"HTMLPAGE\");", + " pm.expect(page[\"cachettl\"]).equal(\"0\");", + " pm.expect(page[\"canEdit\"], 'FAILED:[canEdit]').equal(true);", + " pm.expect(page[\"canLock\"], 'FAILED:[canLock]').equal(true);", + " pm.expect(page[\"canRead\"], 'FAILED:[canRead]').equal(true);", + " pm.expect(page[\"deleted\"], 'FAILED:[deleted]').equal(false);", + " pm.expect(page[\"extension\"]).equal(\"page\");", + " pm.expect(page[\"folder\"]).equal(\"6c8a2ac4-36a7-4b01-b9c0-c2c1d91ddfdb\");", + " pm.expect(page[\"friendlyName\"]).equal(\"Costa Rica Rain Forest\");", + " pm.expect(page[\"hasLiveVersion\"], 'FAILED:[hasLiveVersion]').equal(true);", + " pm.expect(page[\"hasTitleImage\"], 'FAILED:[hasTitleImage]').equal(true);", + " pm.expect(page[\"host\"]).equal(\"48190c8c-42c4-46af-8d1a-0cd5db894797\");", + " pm.expect(page[\"hostName\"]).equal(\"demo.dotcms.com\");", + " ////", + " pm.expect(page[\"httpsRequired\"], 'FAILED:[httpsRequired]').equal(false);", + " pm.expect(page[\"identifier\"]).equal(\"bec7b960-a8bf-4f14-a22b-0d94caf217f0\");", + " pm.expect(page[\"image\"]).equal(\"/dA/bec7b960-a8bf-4f14-a22b-0d94caf217f0/image/costa-rica-tree-frog.jpg\");", + " pm.expect(page[\"imageContentAsset\"]).equal(\"bec7b960-a8bf-4f14-a22b-0d94caf217f0/image\");", + " pm.expect(page[\"inode\"]).not.equal(null)", + " pm.expect(page[\"isContentlet\"], 'FAILED:[isContentlet]').equal(true);", + " pm.expect(page[\"languageId\"]).equal(1);", + " pm.expect(page[\"live\"], 'FAILED:[live]').equal(true);", + " pm.expect(page[\"liveInode\"]).not.equal(null)", + " pm.expect(page[\"locked\"], 'FAILED:[locked]').equal(false);", + " pm.expect(page[\"mimeType\"]).equal(\"application/dotpage\");", + " pm.expect(page[\"modDate\"]).not.equal(null)", + " ///", + " pm.expect(page[\"modUser\"]).equal(\"system\");", + " pm.expect(page[\"modUserName\"]).equal(\"system user system user\");", + " pm.expect(page[\"name\"]).equal(\"costa-rica\");", + " pm.expect(page[\"owner\"]).equal(\"dotcms.org.1\");", + " pm.expect(page[\"pageURI\"]).equal(\"/destinations/costa-rica\");", + " pm.expect(page[\"pageUrl\"]).equal(\"costa-rica\");", + " pm.expect(page[\"path\"]).equal(\"/destinations/costa-rica\");", + " pm.expect(page[\"publishDate\"]).not.equal(null)", + " pm.expect(page[\"seoTitle\"]).equal(\"Costa Rica Travel Destinations\");", + " pm.expect(page[\"seodescription\"]).equal(\"Visit Costa Rica a rugged, rainforested Central American country with coastlines on the Caribbean and Pacific.\");", + " pm.expect(page[\"shortDescription\"]).equal(\"Costa Rica is a rugged, rainforested Central American country with coastlines on the Caribbean and Pacific. Costa Rica is known for its beaches, volcanoes, and biodiversity. Roughly a quarter of its area is made up of protected jungle, teeming with wildlife including spider monkeys and quetzal birds.\");", + " pm.expect(page[\"shortyLive\"]).not.equal(null)", + " //", + " pm.expect(page[\"shortyWorking\"]).not.equal(null)", + " pm.expect(page[\"sortOrder\"]).equal(0);", + " pm.expect(page[\"stInode\"]).equal(\"91812c8b-0441-4139-8d4d-7423cfb0e979\");", + " pm.expect(page[\"statusIcons\"]).equal(\"\");", + " pm.expect(page[\"tags\"]).equal(\"diving\");", + " pm.expect(page[\"template\"]).equal(\"0c556e37-99e0-4458-a2cd-d42cc7a11045\");", + " pm.expect(page[\"title\"]).equal(\"Costa Rica Rain Forest\");", + " pm.expect(page[\"titleImage\"]).equal(\"image\");", + " pm.expect(page[\"type\"]).equal(\"htmlpage\");", + " pm.expect(page[\"url\"]).equal(\"/destinations/costa-rica\");", + " pm.expect(page[\"working\"], 'FAILED:[working]').equal(true);", + " pm.expect(page[\"workingInode\"]).not.equal(null)", + "});", + "", + "pm.test(\"The 'Forward' Vanity URL data must be present\", function() {", + " var entity = pm.response.json().entity;", + " pm.expect(entity.vanityUrl).not.not.equal(undefined, \"The 'vanityUrl' attribute is missing\");", + " pm.expect(entity.vanityUrl.url).to.be.equal(\"/forward-render\", \"The 'url' attribute is NOT the expected one\");", + " pm.expect(entity.vanityUrl.response).to.be.equal(200, \"The 'response' attribute must be 200\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/forward-render", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "forward-render" + ] + } + }, + "response": [] + }, + { + "name": "Get HTML Page Metadata - Temporary Redirect", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"The 'Temporary Redirect' Vanity URL data must be present\", function() {", + " var entity = pm.response.json().entity;", + " pm.expect(entity.vanityUrl).to.not.equal(undefined, \"The 'vanityUrl' attribute must be present\");", + " pm.expect(entity.vanityUrl.response).to.be.equal(302, \"The 'response' attribute must be 302\");", + " pm.expect(entity.vanityUrl.temporaryRedirect).to.equal(true, \"The returned Vanity URL MUST be a temporary redirect\");", + " pm.expect(entity.vanityUrl.permanentRedirect).to.equal(false, \"The returned Vanity URL MUST NOT be a permanent redirect\");", + " pm.expect(entity.vanityUrl.forward).to.equal(false, \"The returned Vanity URL MUST NOT be a forward\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/temporary-render", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "temporary-render" + ] + } + }, + "response": [] + }, + { + "name": "Get HTML Page Metadata - Permanent Redirect", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"The 'Permanent Redirect' Vanity URL must be present\", function() {", + " var entity = pm.response.json().entity;", + " pm.expect(entity.vanityUrl).to.not.equal(undefined, \"The 'vanityUrl' attribute must be present\");", + " pm.expect(entity.vanityUrl.response).to.be.equal(301, \"The 'response' attribute must be 301\");", + " pm.expect(entity.vanityUrl.permanentRedirect).to.equal(true, \"The returned Vanity URL MUST be a permanent redirect\");", + " pm.expect(entity.vanityUrl.temporaryRedirect).to.equal(false, \"The returned Vanity URL MUST NOT be a temporary redirect\");", + " pm.expect(entity.vanityUrl.forward).to.equal(false, \"The returned Vanity URL MUST NOT be a forward\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/permanent-render", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "permanent-render" + ] + } + }, + "response": [] + } + ], + "description": "Tests calling the `render` method passing down a Vanity URL that references an HTML Page, using the three redirect options:\n\n1. Forward.\n \n2. Temporary Redirect.\n \n3. Permanent Redirect.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"HTTP Status must be 200\", function() {", + " pm.response.to.have.status(200);", + "});", + "", + "" + ] + } + } + ] + } + ] + }, + { + "name": "Layout [/api/v1/page/{page-id}/layout]", + "item": [ + { + "name": "invalidateSession", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "logout" + ] + } + }, + "response": [] + }, + { + "name": "GivenInvalidUser_ShouldReturn401", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 401, Need credentials\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "", + "", + "pm.test(\"Response body matches\", function () {", + " pm.expect(pm.response.text()).to.include(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\"title\":null,\"layout\":{\"body\":{\"rows\":[{\"columns\":[{\"leftOffset\":1,\"width\":7,\"containers\":[{\"identifier\":\"a050073a-a31e-4aab-9307-86bfb248096a\",\"uuid\":\"1\"}]},{\"leftOffset\":8,\"width\":4,\"containers\":[{\"identifier\":\"5363c6c6-5ba0-4946-b7af-cf875188ac2e\",\"uuid\":\"1\"}]}]}]},\"header\":true,\"footer\":true,\"sidebar\":{\"location\":\"\",\"containers\":[],\"width\":\"small\"}}}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/bec7b960-a8bf-4f14-a22b-0d94caf217f0/layout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "bec7b960-a8bf-4f14-a22b-0d94caf217f0", + "layout" + ] + }, + "description": "@Path(\"/{pageId}/layout\")" + }, + "response": [] + }, + { + "name": "GivenValidLayout_ShouldSaveLayout", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Response code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response body contains 'rendered'\", function () {", + " pm.expect(pm.response.text()).to.include(\"rendered\");", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"'Containers' section contains expected containers\", function () {", + " var containers = jsonData[\"entity\"][\"containers\"];", + " pm.expect(containers[\"//demo.dotcms.com/application/containers/default/\"].container.identifier).equal(\"69b3d24d-7e80-4be6-b04a-d352d16493ee\");", + "", + " pm.expect(containers[\"5a07f889-4536-4956-aa6e-e7967969ec3f\"].container.identifier).equal(\"5a07f889-4536-4956-aa6e-e7967969ec3f\");", + "});", + "", + "", + "var layout = jsonData[\"entity\"][\"layout\"];", + "var rows = layout[\"body\"][\"rows\"];", + "var columns = layout[\"body\"][\"rows\"][0][\"columns\"];", + "pm.expect(columns.length).equal(2);", + "", + "// column 1 ", + "var column1 = columns[0];", + "var containersColumn1 = column1[\"containers\"];", + "", + "// column 2", + "var column2 = columns[1];", + "var containersColumn2 = column2[\"containers\"];", + "", + "", + "", + "pm.test(\"Layout has 1 row\", function () {", + " pm.expect(rows.length).equal(1);", + "});", + "", + "pm.test(\"First row has 2 columns\", function () {", + " pm.expect(columns.length).equal(2);", + "});", + "", + "pm.test(\"First column has width of 7 \", function () {", + " pm.expect(column1[\"width\"]).equal(7);", + "}); ", + "", + "pm.test(\"First column has 1 container with expected identifier\", function () {", + " pm.expect(containersColumn1.length).equal(1);", + " pm.expect(containersColumn1[0].identifier).equal(\"//demo.dotcms.com/application/containers/default/\");", + "}); ", + "", + "pm.test(\"Second column has width of 4 \", function () {", + " pm.expect(column2[\"width\"]).equal(4);", + "}); ", + "", + "pm.test(\"Second column has 1 container with expected identifier\", function () {", + " pm.expect(containersColumn2.length).equal(1);", + " pm.expect(containersColumn2[0].identifier).equal(\"5a07f889-4536-4956-aa6e-e7967969ec3f\");", + "}); ", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"title\": null,\n \"layout\": {\n \"body\": {\n \"rows\": [\n {\n \"columns\": [\n {\n \"leftOffset\": 1,\n \"width\": 7,\n \"containers\": [\n {\n \"identifier\": \"//demo.dotcms.com/application/containers/default/\", \n \"uuid\": \"1\"\n }\n ]\n },\n {\n \"leftOffset\": 8,\n \"width\": 4,\n \"containers\": [\n {\n \"identifier\": \"5a07f889-4536-4956-aa6e-e7967969ec3f\",\n \"uuid\": \"1\"\n }\n ]\n }\n ]\n }\n ]\n },\n \"header\": true,\n \"footer\": true,\n \"sidebar\": {\n \"location\": \"\",\n \"containers\": [],\n \"width\": \"small\"\n }\n }\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/bec7b960-a8bf-4f14-a22b-0d94caf217f0/layout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "bec7b960-a8bf-4f14-a22b-0d94caf217f0", + "layout" + ] + }, + "description": "@Path(\"/{pageId}/layout\")" + }, + "response": [] + }, + { + "name": "GivenInvalidPageId_ShouldReturn404", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "", + "", + "pm.test(\"Response body contains\", function () {", + " pm.expect(pm.response.text()).to.include(\"Unable to find page with Identifier: 2c12fe7e6-d338-49d5-973b-2d974d57015b\");", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\"title\":null,\"layout\":{\"body\":{\"rows\":[{\"columns\":[{\"leftOffset\":1,\"width\":7,\"containers\":[{\"identifier\":\"a050073a-a31e-4aab-9307-86bfb248096a\",\"uuid\":\"1\"}]},{\"leftOffset\":8,\"width\":4,\"containers\":[{\"identifier\":\"5363c6c6-5ba0-4946-b7af-cf875188ac2e\",\"uuid\":\"1\"}]}]}]},\"header\":true,\"footer\":true,\"sidebar\":{\"location\":\"\",\"containers\":[],\"width\":\"small\"}}}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/2c12fe7e6-d338-49d5-973b-2d974d57015b/layout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "2c12fe7e6-d338-49d5-973b-2d974d57015b", + "layout" + ] + }, + "description": "@Path(\"/{pageId}/layout\")" + }, + "response": [] + }, + { + "name": "RequestWihoutParameters", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "", + "", + "pm.test(\"Response body contains\", function () {", + " pm.expect(pm.response.text()).to.include(\"required\");", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/bec7b960-a8bf-4f14-a22b-0d94caf217f0/layout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "bec7b960-a8bf-4f14-a22b-0d94caf217f0", + "layout" + ] + }, + "description": "@Path(\"/{pageId}/layout\")" + }, + "response": [] + }, + { + "name": "BadRequest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "", + "", + "pm.test(\"Response body contains\", function () {", + " pm.expect(pm.response.text()).to.include(\"Unrecognized field\");", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\"2title\":null,\"layout\":{\"body\":{\"rows\":[{\"columns\":[{\"leftOffset\":1,\"width\":7,\"containers\":[{\"identifier\":\"a050073a-a31e-4aab-9307-86bfb248096a\",\"uuid\":\"1\"}]},{\"leftOffset\":8,\"width\":4,\"containers\":[{\"identifier\":\"5363c6c6-5ba0-4946-b7af-cf875188ac2e\",\"uuid\":\"1\"}]}]}]},\"header\":true,\"footer\":true,\"sidebar\":{\"location\":\"\",\"containers\":[],\"width\":\"small\"}}}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/bec7b960-a8bf-4f14-a22b-0d94caf217f0/layout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "bec7b960-a8bf-4f14-a22b-0d94caf217f0", + "layout" + ] + }, + "description": "@Path(\"/{pageId}/layout\")" + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Add Content [/api/v1/page/{page-id}/content]", + "item": [ + { + "name": "Test_RespectOrder", + "item": [ + { + "name": "ImportBundle", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Success import\", function () {", + " var jsonData = pm.response.json();", + " console.log(jsonData);", + " pm.expect(jsonData[\"status\"]).to.eql(\"SUCCESS\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/octet-stream" + }, + { + "key": "Content-Disposition", + "value": "attachment" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "resources/testRespectOrder_Bundle.tar.gz" + } + ] + }, + "url": { + "raw": "{{serverURL}}/api/bundle/sync", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "bundle", + "sync" + ], + "query": [ + { + "key": "AUTH_TOKEN", + "value": "", + "disabled": true + } + ] + }, + "description": "Imports a Bundle that includes:\n\n* Page (testRespectOrder)\n* 2 Content (testOrder1 and testOrder2)" + }, + "response": [] + }, + { + "name": "Get Page To Check Order", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Response reorder check\", function () {", + " pm.expect(pm.response.text()).to.include(\"

testOrder2

testOrder1

\");", + "", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/testrespectorder?language_id=1&host_id=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "testrespectorder" + ], + "query": [ + { + "key": "language_id", + "value": "1" + }, + { + "key": "host_id", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" + } + ] + } + }, + "response": [] + }, + { + "name": "ReorderContents", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Response body contains\", function () {", + " pm.expect(pm.response.text()).to.include(\"ok\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "[{\"identifier\":\"//default/application/containers/system/\",\"uuid\":\"1\",\"contentletsId\":[\"ffba6c6b2e90ce4dcc2a553c6b860822\",\"844cdd64de4fd9418613b3b53f860c6f\"]}]" + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/773c1d064bfedacf26986a67ee90b490/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "773c1d064bfedacf26986a67ee90b490", + "content" + ] + }, + "description": "Reorder the page contents." + }, + "response": [] + }, + { + "name": "Get Page To Check Reorder", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Response reorder check\", function () {", + " pm.expect(pm.response.text()).to.include(\"

testOrder1

testOrder2

\");", + "", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/testrespectorder?language_id=1&host_id=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "testrespectorder" + ], + "query": [ + { + "key": "language_id", + "value": "1" + }, + { + "key": "host_id", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" + } + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "" + ] + } + } + ] + }, + { + "name": "invalidateSession", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "logout" + ] + } + }, + "response": [] + }, + { + "name": "UserAuthenticationValidation", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 401, Need credentials\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Response body matches\", function () {", + " pm.expect(pm.response.text()).to.include(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "[{\"identifier\":\"a050073a-a31e-4aab-9307-86bfb248096a\",\"uuid\":\"1\",\"contentletsId\":[\"767509b1-2392-4661-a16b-e0e31ce27719\",\"3c30df49-ea78-417a-93ce-631cd25bc66c\"]},{\"identifier\":\"5363c6c6-5ba0-4946-b7af-cf875188ac2e\",\"uuid\":\"1\",\"contentletsId\":[\"2efc77b4-a54f-479b-8a81-a133b9e6da04\",\"5aef0c62-b7d6-4805-9e7c-77a67f4822f3\",\"66d47ebf-7b11-4076-85b0-b6c8c373d000\"]}]" + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/bec7b960-a8bf-4f14-a22b-0d94caf217f0/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "bec7b960-a8bf-4f14-a22b-0d94caf217f0", + "content" + ] + }, + "description": "@Path(\"{pageId}/content\")" + }, + "response": [] + }, + { + "name": "SuccessRequest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response body contains\", function () {", + " pm.expect(pm.response.text()).to.include(\"ok\");", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "[{\"identifier\":\"5a07f889-4536-4956-aa6e-e7967969ec3f\",\"uuid\":\"1\",\"contentletsId\":[\"d4ed1990-b151-42ca-9bca-0725b07260de\"]},{\"identifier\":\"//demo.dotcms.com/application/containers/default/\",\"uuid\":\"1\",\"contentletsId\":[\"f827c41a-5689-4733-b4d7-916d3a31c9c6\",\"7c9cb3a7-bb68-4fd0-b21d-03ec4be491a7\"]}]" + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/bec7b960-a8bf-4f14-a22b-0d94caf217f0/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "bec7b960-a8bf-4f14-a22b-0d94caf217f0", + "content" + ] + }, + "description": "Adds Content to a Page, the container, template, page and contentlets are imported.\n\n7c9cb3a7-bb68-4fd0-b21d-03ec4be491a7 = container Banner\n7c9cb3a7-bb68-4fd0-b21d-03ec4be491a7e = Banner contentlet\n7c9cb3a7-bb68-4fd0-b21d-03ec4be491a7 = Container as File Default\nf827c41a-5689-4733-b4d7-916d3a31c9c6 = Rich Text Contentlet\n7c9cb3a7-bb68-4fd0-b21d-03ec4be491a7 = Widget Contentlet" + }, + "response": [] + }, + { + "name": "Save Contentlets Not Valid BadRequest 400", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "[{\"identifier\":\"5a07f889-4536-4956-aa6e-e7967969ec3f\",\"uuid\":\"1\",\"contentletsId\":[\"f827c41a-5689-4733-b4d7-916d3a31c9c6\"]}]" + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/bec7b960-a8bf-4f14-a22b-0d94caf217f0/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "bec7b960-a8bf-4f14-a22b-0d94caf217f0", + "content" + ] + }, + "description": "@Path(\"{pageId}/content\")" + }, + "response": [] + }, + { + "name": "InvalidPageId", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Response body contains\", function () {", + " pm.expect(pm.response.text()).to.include(\"Page '2c12fe7e6-d338-49d5-973b-2d974d57015b' not found\");", + "});", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "[{\"identifier\":\"a050073a-a31e-4aab-9307-86bfb248096a\",\"uuid\":\"1\",\"contentletsId\":[\"767509b1-2392-4661-a16b-e0e31ce27719\",\"3c30df49-ea78-417a-93ce-631cd25bc66c\"]},{\"identifier\":\"5363c6c6-5ba0-4946-b7af-cf875188ac2e\",\"uuid\":\"1\",\"contentletsId\":[\"2efc77b4-a54f-479b-8a81-a133b9e6da04\",\"5aef0c62-b7d6-4805-9e7c-77a67f4822f3\",\"66d47ebf-7b11-4076-85b0-b6c8c373d000\"]}]" + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/2c12fe7e6-d338-49d5-973b-2d974d57015b/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "2c12fe7e6-d338-49d5-973b-2d974d57015b", + "content" + ] + }, + "description": "@Path(\"{pageId}/content\")" + }, + "response": [] + }, + { + "name": "RequestWihoutParameters", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Layout is required\", function () {", + " pm.expect(pm.response.text()).to.include(\"Layout is required\");", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/bec7b960-a8bf-4f14-a22b-0d94caf217f0/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "bec7b960-a8bf-4f14-a22b-0d94caf217f0", + "content" + ] + }, + "description": "@Path(\"{pageId}/content\")" + }, + "response": [] + }, + { + "name": "BadRequest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 400\", function () {", + " pm.response.to.have.status(400);", + "});", + "", + "pm.test(\"Response body contains\", function () {", + " pm.expect(pm.response.text()).to.include(\"Container id and uuid are required\");", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "[{\"id222\":\"a050073a-a31e-4aab-9307-86bfb248096a\",\"uuid\":\"1\",\"contentlets\":[\"767509b1-2392-4661-a16b-e0e31ce27719\",\"3c30df49-ea78-417a-93ce-631cd25bc66c\"]},{\"id\":\"5363c6c6-5ba0-4946-b7af-cf875188ac2e\",\"uuid22\":\"1\",\"contentlets\":[\"2efc77b4-a54f-479b-8a81-a133b9e6da04\",\"5aef0c62-b7d6-4805-9e7c-77a67f4822f3\",\"66d47ebf-7b11-4076-85b0-b6c8c373d000\"]}]" + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/bec7b960-a8bf-4f14-a22b-0d94caf217f0/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "bec7b960-a8bf-4f14-a22b-0d94caf217f0", + "content" + ] + }, + "description": "@Path(\"{pageId}/content\")" + }, + "response": [] + }, + { + "name": "Save Content Upsert Duplicated Containers Body", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Response body contains\", function () {", + " pm.expect(pm.response.text()).to.include(\"ok\");", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "[\n {\n \"identifier\":\"//demo.dotcms.com/application/containers/default/\",\n \"uuid\":\"1\",\n \"contentletsId\":[\"7c9cb3a7-bb68-4fd0-b21d-03ec4be491a7\"]\n },\n {\n \"identifier\":\"//demo.dotcms.com/application/containers/default/\",\n \"uuid\":\"1\",\n \"contentletsId\":[\"f827c41a-5689-4733-b4d7-916d3a31c9c6\"]\n },\n {\n \"identifier\":\"//demo.dotcms.com/application/containers/default/\",\n \"uuid\":\"1\",\n \"contentletsId\":[\"7c9cb3a7-bb68-4fd0-b21d-03ec4be491a7\"]\n }\n]", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/bec7b960-a8bf-4f14-a22b-0d94caf217f0/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "bec7b960-a8bf-4f14-a22b-0d94caf217f0", + "content" + ] + }, + "description": "This test is for when users make a request sending at the Body the same container and uuid diff times.\nThis will merge all those contentlets and save the page successfully." + }, + "response": [] + } + ], + "description": " @Path(\"{pageId}/content\")", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Render HTML [/api/v1/page/renderHTML]", + "item": [ + { + "name": "invalidateSession", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "logout" + ] + } + }, + "response": [] + }, + { + "name": "UserAuthenticationValidation", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "", + "pm.test(\"Status code is 401, Need credentials\", function () {", + " pm.response.to.have.status(401);", + "});", + "", + "pm.test(\"Invalid User\", function () {", + " pm.expect(pm.response.text()).to.include(\"Invalid User\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "noauth" + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/renderHTML/destinations/costa-rica", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "renderHTML", + "destinations", + "costa-rica" + ] + }, + "description": "@Path(\"/renderHTML/{uri: .*}\")" + }, + "response": [] + }, + { + "name": "pre_ImportBundleWithDemoHost", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Bundle uploaded sucessfully\", function () {", + " pm.response.to.have.status(200);", + "", + " var jsonData = pm.response.json();", + " console.log(jsonData);", + "", + " pm.expect(jsonData[\"bundleName\"]).to.eql(\"demo.dotcms.com.tar.gz\");", + " pm.expect(jsonData[\"status\"]).to.eql(\"SUCCESS\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/octet-stream" + }, + { + "key": "Content-Disposition", + "value": "attachment" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "resources/GraphQL/demo.dotcms.com.tar.gz" + } + ] + }, + "url": { + "raw": "{{serverURL}}/api/bundle/sync", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "bundle", + "sync" + ], + "query": [ + { + "key": "AUTH_TOKEN", + "value": "", + "disabled": true + } + ] + }, + "description": "Imports a Bundle that includes:\n* Imports demo.dotcms.com" + }, + "response": [] + }, + { + "name": "SuccessRequest", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"renders expected HTML only\", function () {", + " pm.expect(pm.response.text().startsWith(\"\")).to.be.true;", + " pm.expect(pm.response.text()).to.include(\"body id=\\\"costa-rica-rain-forest\\\"\");", + "});", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/renderHTML/destinations/costa-rica", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "renderHTML", + "destinations", + "costa-rica" + ] + }, + "description": "@Path(\"/renderHTML/{uri: .*}\")" + }, + "response": [] + }, + { + "name": "InvalidPageURL", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 404\", function () {", + " pm.response.to.have.status(404);", + "});", + "", + "pm.test(\"Valid response\", function () {", + " pm.expect(pm.response.text()).to.include(\"Page \\'about-us/our-team/index2\\' not found\");", + "});", + "", + "", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/renderHTML/about-us/our-team/index2", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "renderHTML", + "about-us", + "our-team", + "index2" + ] + }, + "description": "@Path(\"/renderHTML/{uri: .*}\")" + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Whats Changed", + "item": [ + { + "name": "pre_ImportBundle", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Bundle imported\", function () {", + " var jsonData = pm.response.json();", + " console.log(jsonData);", + "", + " pm.expect(jsonData[\"bundleName\"]).to.contains(\"testWhatsChanged\");", + " pm.expect(jsonData[\"status\"]).to.eql(\"SUCCESS\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/octet-stream" + }, + { + "key": "Content-Disposition", + "value": "attachment" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "file", + "type": "file", + "src": "resources/testWhatsChanged-01FTGYNEP672VF4KFRFWSX3RPT.tar.gz" + } + ] + }, + "url": { + "raw": "{{serverURL}}/api/bundle/sync", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "bundle", + "sync" + ], + "query": [ + { + "key": "AUTH_TOKEN", + "value": "", + "disabled": true + } + ] + }, + "description": "Imports a Bundle that includes: a page with content, the content has diff versions working and live" + }, + "response": [] + }, + { + "name": "Check Whats Changed Endpoint", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"There are diff between live and working page\", function () {", + " var jsonData = pm.response.json().entity;", + " pm.expect(jsonData[\"diff\"]).equal(true);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/8afe50bc66533c6f0ed7711d74654b80/render/versions", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "8afe50bc66533c6f0ed7711d74654b80", + "render", + "versions" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "TestHostVariables", + "item": [ + { + "name": "Create new Site For Test Host Variables", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Host check\", function () {", + " pm.expect(jsonData.entity.siteName).to.eql('sitevariables.site.com');", + "});", + "", + "pm.collectionVariables.set(\"siteIdTestHost\", jsonData.entity.identifier);", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"siteName\":\"sitevariables.site.com\"\n\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/site", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site" + ] + } + }, + "response": [] + }, + { + "name": "Publish Site", + "request": { + "method": "PUT", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/site/{{siteIdTestHost}}/_publish", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "{{siteIdTestHost}}", + "_publish" + ] + } + }, + "response": [] + }, + { + "name": "Add Site Variable", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Host check\", function () {", + " pm.expect(jsonData.entity.key).to.eql('onevar1');", + "});", + "", + "pm.collectionVariables.set(\"sitevariableIdTestHost\", jsonData.entity.id);", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"siteId\":\"{{siteIdTestHost}}\",\n \"name\":\"onevar1\",\n \"key\":\"onevar1\",\n \"value\":\"onevar-value\"\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/site/variable", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "variable" + ] + } + }, + "response": [] + }, + { + "name": "CreateNewContainer Test Host Variables", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No errors\", function () {", + " ", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "", + "pm.test(\"Information Saved Correctly\", function () {", + " ", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.title).to.eql(\"TestContainerHostVariables\");", + " pm.expect(jsonData.entity.notes).to.eql(\"Notes\");", + " ", + " ", + "});", + "", + "var jsonData = pm.response.json();", + "pm.collectionVariables.set(\"containeridentifier\", jsonData.entity.identifier);", + "pm.collectionVariables.set(\"inode\", jsonData.entity.inode);", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"title\":\"TestContainerHostVariables\",\n \"friendlyName\":\"TestContainer description HostVariables\",\n \"maxContentlets\":1,\n \"notes\":\"Notes\",\n \"preLoop\":\"preLoop $host_variable.onevar1\",\n \"postLoop\":\"postLoop xxxx\",\n \"containerStructures\":[\n {\n \"structureId\":\"webPageContent\",\n \"code\":\"$title on container\"\n }\n ]\n\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/containers", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "containers" + ] + }, + "description": "Create a container" + }, + "response": [] + }, + { + "name": "SavePublishNewTemplateTestHostVariables", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"live check\", function () {", + " pm.expect(jsonData.entity.live).to.eql(true);", + "});", + "", + "", + "pm.test(\"Title check\", function () {", + " pm.expect(jsonData.entity.title).to.eql('PostMan Test Save Publish Test Host Variables');", + "});", + "", + "pm.collectionVariables.set(\"templateIdToPublishedHost\", jsonData.entity.identifier);", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"title\":\"PostMan Test Save Publish Test Host Variables\",\n \"friendlyName\":\"This is a postman test description\",\n \"body\":\"#parseContainer('{{containeridentifier}}','1659543155955')\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/templates/_savepublish", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "templates", + "_savepublish" + ] + } + }, + "response": [] + }, + { + "name": "Create Page using the template", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Path check\", function () {", + " pm.expect(jsonData.entity.path).to.eql(\"/testpagehostvariables\");", + "});", + "", + "", + "", + "var jsonData = pm.response.json();", + "pm.collectionVariables.set(\"pageUrlHostVariablestest\", pm.response.json().path);", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"contentlet\": {\n \"contentType\": \"htmlpageasset\",\n \"hostFolder\": \"{{siteIdTestHost}}\",\n \"title\": \"Test Page Host variables\",\n \"url\": \"testpagehostvariables\",\n \"template\":\"{{templateIdToPublishedHost}}\",\n \"sortOrder\":1,\n \"cachettl\":\"0\",\n \"friendlyName\":\"testpagehostvariables\"\n\n }\n}" + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + }, + "description": "Fire any action using the actionId\n\nOptional: If you pass ?inode={inode}, you don't need body here.\n\n@Path(\"/actions/{actionId}/fire\")" + }, + "response": [] + }, + { + "name": "Test the host variables", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var text = pm.response.text();", + "", + "pm.test(\"Path check\", function () {", + " pm.expect(text).to.include(\"onevar-value\");", + "});", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/testpagehostvariables?language_id=1&host_id={{siteIdTestHost}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "testpagehostvariables" + ], + "query": [ + { + "key": "language_id", + "value": "1" + }, + { + "key": "host_id", + "value": "{{siteIdTestHost}}" + } + ] + } + }, + "response": [] + } + ], + "description": "1. This test creates a Host with two variables\n2. Creates a container with the generic contentlet and use this two variables\n3. Creates a template that uses this container\n4. creates a page that uses this page\n5. Check that the page exists.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"Response code should be 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "In-Place Content Copy", + "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);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"contentlet\": {\n\t\t\"contentType\":\"htmlpageasset\",\n \"title\":\"testPageCopy\",\n \"url\":\"testPageCopy\",\n \"hostFolder\":\"default\",\n \"template\":\"SYSTEM_TEMPLATE\",\n \"friendlyName\":\"testPageCopy\",\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" + } + ] + } + }, + "response": [] + }, + { + "name": "Create Test Rich Text Contentlet", + "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(\"richContentIdentifier\", 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\":\"textContent\",\n \"contentHost\":\"default\",\n \"body\":\"Text 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" + } + ] + } + }, + "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 \"{{richContentIdentifier}}\"\n ]\n }\n]", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/{{pageIdentifier}}/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "{{pageIdentifier}}", + "content" + ] + } + }, + "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(\"richContentIdentifier\");", + " var found = false;", + " entity.forEach((treeEntry) => {", + "", + " if (testContentId == treeEntry.contentId) {", + " pm.collectionVariables.set(\"containerId\", treeEntry.containerId);", + " pm.collectionVariables.set(\"contentId\", treeEntry.contentId);", + " pm.collectionVariables.set(\"pageId\", treeEntry.pageId);", + " pm.collectionVariables.set(\"personalization\", treeEntry.personalization);", + " pm.collectionVariables.set(\"relationType\", treeEntry.relationType);", + " pm.collectionVariables.set(\"treeOrder\", treeEntry.treeOrder);", + " pm.collectionVariables.set(\"variantId\", treeEntry.variantId);", + " 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" + ] + } + }, + "response": [] + }, + { + "name": "In-Place Copy Of Test Contentlet", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.title).to.equal(\"textContent\");", + " pm.collectionVariables.set(\"copiedRichContentIdentifier\", jsonData.entity.identifier);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"containerId\": \"{{containerId}}\",\n \"contentId\": \"{{contentId}}\",\n \"pageId\": \"{{pageId}}\",\n \"personalization\": \"{{personalization}}\",\n \"relationType\": \"{{relationType}}\",\n \"treeOrder\": \"{{treeOrder}}\",\n \"variantId\": \"{{variantId}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/copyContent", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "copyContent" + ] + } + }, + "response": [] + }, + { + "name": "Check Multitree Data After In-Place Copy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Checking that duplicate Contentlet has replaced the existing one\", function () {", + " var entity = pm.response.json().entity;", + "", + " var containerId = pm.collectionVariables.get(\"containerId\");", + " var contentId = pm.collectionVariables.get(\"copiedRichContentIdentifier\");", + " var pageId = pm.collectionVariables.get(\"pageId\");", + " var personalization = pm.collectionVariables.get(\"personalization\");", + " var relationType = pm.collectionVariables.get(\"relationType\");", + " var variantId = pm.collectionVariables.get(\"variantId\");", + " ", + " var found = false;", + " entity.forEach((treeEntry) => {", + "", + " if (contentId == treeEntry.contentId) {", + " found = true;", + " pm.expect(treeEntry.containerId).to.eql(containerId);", + " pm.expect(treeEntry.contentId).to.eql(contentId);", + " pm.expect(treeEntry.pageId).to.eql(pageId);", + " pm.expect(treeEntry.personalization).to.eql(personalization);", + " pm.expect(treeEntry.relationType).to.eql(relationType);", + " pm.expect(treeEntry.variantId).to.eql(variantId);", + " }", + "", + " });", + " if (!found) {", + " pm.expect.fail(\"Copied test Contentlet with ID '\" + contentId + \"' 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" + ] + } + }, + "response": [] + }, + { + "name": "Copy Non-Existing Contentlet", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Checking that the error message is present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.message).not.eq(\"\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"containerId\": \"{{containerId}}\",\n \"contentId\": \"{{contentId}}xxx\",\n \"pageId\": \"{{pageId}}\",\n \"personalization\": \"{{personalization}}\",\n \"relationType\": \"{{relationType}}\",\n \"treeOrder\": \"{{treeOrder}}\",\n \"variantId\": \"{{variantId}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/copyContent", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "copyContent" + ] + } + }, + "response": [] + }, + { + "name": "Copy Contentlet to Non-Existing Container", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Checking that the error message is present\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.message).not.eq(\"\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"containerId\": \"{{containerId}}xx\",\n \"contentId\": \"{{contentId}}\",\n \"pageId\": \"{{pageId}}\",\n \"personalization\": \"{{personalization}}\",\n \"relationType\": \"{{relationType}}\",\n \"treeOrder\": \"{{treeOrder}}\",\n \"variantId\": \"{{variantId}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/copyContent", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "copyContent" + ] + } + }, + "response": [] + }, + { + "name": "Deep-Clone Test Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Validate page has been copied\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.title).to.equal(\"testPageCopy\");", + " pm.collectionVariables.set(\"pageDeepCopyIdentifier\", jsonData.entity.identifier);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/{{pageIdentifier}}/_deepcopy", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "{{pageIdentifier}}", + "_deepcopy" + ] + } + }, + "response": [] + }, + { + "name": "Check Multi-Tree Data For Deep-Copied Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Checking Multi-Tree data Deep-Copied Page\", function () {", + " var jsonData = pm.response.json();", + " var containerId = pm.collectionVariables.get(\"containerId\");", + " var contentId = pm.collectionVariables.get(\"contentId\");", + " var pageId = pm.collectionVariables.get(\"pageId\");", + " var personalization = pm.collectionVariables.get(\"personalization\");", + " var relationType = pm.collectionVariables.get(\"relationType\");", + "", + " pm.expect(jsonData.entity[0].containerId).to.eql(containerId);", + " pm.expect(jsonData.entity[0].contentId).to.not.eql(contentId);", + " pm.expect(jsonData.entity[0].pageId).to.not.eql(pageId);", + " pm.expect(jsonData.entity[0].personalization).to.eql(personalization);", + " pm.expect(jsonData.entity[0].relationType).to.eql(relationType);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/{{pageDeepCopyIdentifier}}/content/tree", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "{{pageDeepCopyIdentifier}}", + "content", + "tree" + ] + } + }, + "response": [] + } + ], + "description": "This Test Collection verifies that the In-Place Contentlet Copy works correctly.\n\nThere are times where a given Contentlet is referenced by several pages. Sometimes, users just want to edit the Contentlet in one specific page without affecting they way such a Contentlet looks like in the other pages. This feature allows them to (1) create an exact copy of the Contentlet -- which replaces the existing one -- and (2) edit that copied Contentlet.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"HTTP Status code must be 200 or 404\", function () {", + " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", + "});" + ] + } + } + ] + }, + { + "name": "Number of Content References in Pages", + "item": [ + { + "name": "Get Default Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Getting 'default' Site ID\", function() {", + " var entity = pm.response.json().entity;", + " pm.collectionVariables.set(\"defaultSiteId\", entity.identifier);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"siteName\": \"default\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/site/_byname", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "_byname" + ] + }, + "description": "Gets the Identifier of the \"default\" Site." + }, + "response": [] + }, + { + "name": "Create First Test Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No page creation errors are present\", function() {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.collectionVariables.set(\"firstPageIdentifier\", jsonData.entity.identifier);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"firstPageUrl\", \"first-test-page\" + Date.now());" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlet\": {\n \"contentType\": \"htmlpageasset\",\n \"title\": \"First Test Page\",\n \"url\": \"{{firstPageUrl}}\",\n \"hostFolder\": \"default\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"friendlyName\": \"First Test Page\",\n \"cachettl\": 0\n }\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" + } + ] + } + }, + "response": [] + }, + { + "name": "Create Test Rich Text Contentlet", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No contentlet creation errors are present\", function() {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.collectionVariables.set(\"richContentIdentifier\", jsonData.entity.identifier);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlet\": {\n \"contentType\": \"webPageContent\",\n \"title\": \"Test Content\",\n \"contentHost\": \"default\",\n \"body\": \"Text Content Body\"\n }\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" + } + ] + } + }, + "response": [] + }, + { + "name": "Add Test Contentlet To First Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No contentlet addition errors are present\", 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 \"{{richContentIdentifier}}\"\n ]\n }\n]", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/{{firstPageIdentifier}}/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "{{firstPageIdentifier}}", + "content" + ] + } + }, + "response": [] + }, + { + "name": "Check Property in First Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Only one Contentlet must be present\", function() {", + " var entity = pm.response.json().entity;", + " var contentletList = entity.containers.SYSTEM_CONTAINER.contentlets[\"uuid-1\"];", + " pm.expect(contentletList.length).to.eql(1);", + "});", + "", + "pm.test(\"Check the 'onNumberOfPages' property in the test Contentlet map in first Page\", function() {", + " var entity = pm.response.json().entity;", + " var contentlet = entity.containers.SYSTEM_CONTAINER.contentlets[\"uuid-1\"][0];", + " pm.expect(contentlet.onNumberOfPages).to.eql(1, \"The 'onNumberOfPages' counter must be 1 at this point\");", + "});", + "", + "pm.test(\"The rendered section should contain data attribute 'data-dot-on-number-of-pages' for the contentlet object\", function() {", + " var entity = pm.response.json().entity;", + " var contentletData = entity.containers.SYSTEM_CONTAINER.rendered[\"uuid-1\"];", + " console.log(contentletData);", + " pm.expect(contentletData).includes(\"data-dot-on-number-of-pages\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/{{firstPageUrl}}?language_id=1&mode=EDIT_MODE&host_id={{defaultSiteId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "{{firstPageUrl}}" + ], + "query": [ + { + "key": "language_id", + "value": "1" + }, + { + "key": "mode", + "value": "EDIT_MODE" + }, + { + "key": "host_id", + "value": "{{defaultSiteId}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Create Second Test Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No page creation errors are present\", function() {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.collectionVariables.set(\"secondPageIdentifier\", jsonData.entity.identifier);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "pm.collectionVariables.set(\"secondPageUrl\", \"second-test-page\" + Date.now());" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlet\": {\n \"contentType\": \"htmlpageasset\",\n \"title\": \"Second Test Page\",\n \"url\": \"{{secondPageUrl}}\",\n \"hostFolder\": \"default\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"friendlyName\": \"Second Test Page\",\n \"cachettl\": 0\n }\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" + } + ] + } + }, + "response": [] + }, + { + "name": "Add Test Contentlet To Second Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"No contentlet addition errors are present\", 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 \"{{richContentIdentifier}}\"\n ]\n }\n]", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/{{secondPageIdentifier}}/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "{{secondPageIdentifier}}", + "content" + ] + } + }, + "response": [] + }, + { + "name": "Check Property in Second Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Only one Contentlet must be present\", function() {", + " var entity = pm.response.json().entity;", + " var contentletList = entity.containers.SYSTEM_CONTAINER.contentlets[\"uuid-1\"];", + " pm.expect(contentletList.length).to.eql(1);", + "});", + "", + "pm.test(\"Check the 'onNumberOfPages' property in the test Contentlet map in second Page\", function() {", + " var entity = pm.response.json().entity;", + " var contentlet = entity.containers.SYSTEM_CONTAINER.contentlets[\"uuid-1\"][0];", + " pm.expect(contentlet.onNumberOfPages).to.eql(2, \"The 'onNumberOfPages' counter must be 2 at this point\");", + "});", + "", + "pm.test(\"The rendered section should contain data attribute 'data-dot-on-number-of-pages' for the contentlet object\", function() {", + " var entity = pm.response.json().entity;", + " var contentletData = entity.containers.SYSTEM_CONTAINER.rendered[\"uuid-1\"];", + " console.log(contentletData);", + " pm.expect(contentletData).includes(\"data-dot-on-number-of-pages\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/{{secondPageUrl}}?language_id=1&mode=EDIT_MODE&host_id={{defaultSiteId}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "{{secondPageUrl}}" + ], + "query": [ + { + "key": "language_id", + "value": "1" + }, + { + "key": "mode", + "value": "EDIT_MODE" + }, + { + "key": "host_id", + "value": "{{defaultSiteId}}" + } + ] + } + }, + "response": [] + } + ], + "description": "This Request Collection verifies that the \"onNumberOfPages\" property is added to the Page JSON response and calculated properly.\n\nThe \"onNumberOfPages\" provides the number of times that a given Contentlet is present in any HTML Page in dotCMS. This way, the Front-End Team can allow users to select whether they want to update that unique Contentlet, or if they want to (1) create a copy of it and (2) edit that new copy instead.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ] + } + } + ] + }, + { + "name": "Get Page Types", + "item": [ + { + "name": "Create new UrlMap Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"No errors\", function () {", + " ", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + "});", + "", + "pm.collectionVariables.set(\"pageid\", 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\":\"testPageCopy{{$randomBankAccount}}\",\n \"url\":\"testPageCopy{{$randomBankAccount}}\",\n \"hostFolder\":\"default\",\n \"template\":\"SYSTEM_TEMPLATE\",\n \"friendlyName\":\"testPageCopy{{$randomBankAccount}}\",\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" + } + ] + } + }, + "response": [] + }, + { + "name": "CreateNewTypeWithUrlMap", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Check response\", function () {", + " pm.expect(jsonData.entity[0].description).to.eql(\"My Structure\");", + "});", + "", + "pm.test(\"Validate that the 'errors' array is empty\", function () {", + " // Check that the 'errors' array is defined and its length is 0", + " pm.expect(jsonData.errors).to.be.an('array').that.is.empty;", + "});", + "", + "", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"clazz\": \"com.dotcms.contenttype.model.type.SimpleContentType\",\n \"detailPage\": \"{{pageid}}\",\n \"urlMapPattern\": \"/blog/wasabi/{urlTitle}\",\n\t\"description\": \"My Structure\",\n\t\"defaultType\": false,\n\t\"system\": false,\n\t\"folder\": \"SYSTEM_FOLDER\",\n\t\"name\": \"TestTypeUrlMap{{$randomBankAccount}}\",\n\t\"variable\": \"TestTypeUrlMap{{$randomBankAccount}}\",\n\t\"host\": \"SYSTEM_HOST\",\n\t\"fixed\": false,\n \"icon\": \"testIcon\",\n \"sortOrder\": 3,\n\t\"fields\": [\n\t\t{\n\t\t\t\"clazz\": \"com.dotcms.contenttype.model.field.TextField\",\n\t\t\t\"indexed\": true,\n\t\t\t\"dataType\": \"TEXT\",\n\t\t\t\"readOnly\": false,\n\t\t\t\"required\": true,\n\t\t\t\"searchable\": true,\n\t\t\t\"listed\": true,\n\t\t\t\"sortOrder\": 2,\n\t\t\t\"unique\": false,\n\t\t\t\"name\": \"Name\",\n\t\t\t\"variable\": \"name\",\n\t\t\t\"fixed\": true\n\t\t}\n\t],\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + } + }, + "response": [] + }, + { + "name": "Create New Page Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"Check response\", function () {", + " pm.expect(jsonData.entity[0].baseType).to.eql(\"HTMLPAGE\");", + "});", + "", + "pm.test(\"Validate that the 'errors' array is empty\", function () {", + " // Check that the 'errors' array is defined and its length is 0", + " pm.expect(jsonData.errors).to.be.an('array').that.is.empty;", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\": false,\n \"icon\": null,\n \"fixed\": false,\n \"system\": false,\n \"clazz\": \"com.dotcms.contenttype.model.type.ImmutablePageContentType\",\n \"description\": \"\",\n \"host\": \"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folder\": \"SYSTEM_FOLDER\",\n \"name\": \"TestTypePage{{$randomBankAccount}}\",\n \"variable\": \"TestTypePage{{$randomBankAccount}}\"\n}\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + } + }, + "response": [] + }, + { + "name": "Get Types", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"No errors\", function () {", + " ", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.length).to.greaterThan(2);", + "", + " const urlMapType = jsonData.entity.filter(item => item.variable.startsWith('TestTypeUrlMap'))", + " const pageType = jsonData.entity.filter(item => item.variable.startsWith('TestTypePage'))", + "", + " pm.expect(urlMapType).to.not.eql(null);", + " pm.expect(pageType).to.not.eql(null);", + "});", + "", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://localhost:8080/api/v1/page/types", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8080", + "path": [ + "api", + "v1", + "page", + "types" + ] + } + }, + "response": [] + }, + { + "name": "Get Types Filtered", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "pm.test(\"No errors\", function () {", + " ", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.length).to.greaterThan(1);", + "", + "});", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "http://localhost:8080/api/v1/page/types?filter=test", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8080", + "path": [ + "api", + "v1", + "page", + "types" + ], + "query": [ + { + "key": "filter", + "value": "test" + } + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "Permissions", + "item": [ + { + "name": "CallLogout", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check response\", function () {", + " pm.expect(pm.response.text()).to.include(\"Logout successfully\");", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "logout" + ] + } + }, + "response": [] + }, + { + "name": "Create Test Page Permission", + "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(\"host_id\", jsonData.entity.host);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "const pagePost = Math.floor(Math.random()*100+1)", + "pm.globals.set(\"pagePost\", pagePost)" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\n\t\"contentlet\": {\n\t\t\"contentType\":\"htmlpageasset\",\n \"title\":\"testPagePermission{{pagePost}}\",\n \"url\":\"testPagePermission{{pagePost}}\",\n \"hostFolder\":\"default\",\n \"template\":\"SYSTEM_TEMPLATE\",\n \"friendlyName\":\"testPagePermission{{pagePost}}\",\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" + } + ] + } + }, + "response": [] + }, + { + "name": "CheckPermission", + "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.expect(jsonData.entity).to.eql(true);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"url\":\"/testPagePermission{{pagePost}}\",\n \"type\":\"READ\",\n \"language_id\":\"1\",\n \"host_id\":\"{{host_id}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/_check-permission", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "_check-permission" + ] + } + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "Getting Available Workflow Actions In Page", + "item": [ + { + "name": "Find the Default Site ID", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Saving the Default Site's ID\", function () {", + " var entity = pm.response.json().entity;", + " pm.collectionVariables.set(\"host_id\", entity.identifier);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"siteName\": \"default\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/site/_byname", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "_byname" + ] + } + }, + "response": [] + }, + { + "name": "Switch To Default Site", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check that the Site has indeed switched to the 'default' Site\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.entity.hostSwitched).to.eql(true);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/site/switch/{{host_id}}", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "site", + "switch", + "{{host_id}}" + ] + } + }, + "response": [] + }, + { + "name": "Create a Test Page", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check that the Test Page was created successfully\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.collectionVariables.set(\"pageIdentifier\", jsonData.entity.identifier);", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "const pagePost = Math.floor(Math.random()*100+1)", + "pm.collectionVariables.set(\"pagePost2\", pagePost);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlet\": {\n \"contentType\": \"htmlpageasset\",\n \"languageId\": 1,\n \"title\": \"testPageCopy{{pagePost2}}\",\n \"url\": \"testPageCopy{{pagePost2}}\",\n \"hostFolder\": \"{{host_id}}\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"friendlyName\": \"testPageCopy{{pagePost2}}\",\n \"cachettl\": 0,\n \"workflow\": [\n \"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"\n ]\n }\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" + } + ] + } + }, + "response": [] + }, + { + "name": "Get Workflow Actions", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check that Workflow Actions for the test HTML Page are available\", function () {", + " var jsonData = pm.response.json();", + " pm.expect(jsonData.errors.length).to.eql(0);", + " pm.expect(jsonData.entity.actions.length).to.greaterThan(0);", + " pm.expect(jsonData.entity.page.pageUrl).to.contains('testPageCopy');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"host_id\":\"{{host_id}}\",\n \"url\":\"/testPageCopy{{pagePost2}}\",\n \"language_id\": \"1\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "http://localhost:8080/api/v1/page/actions", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8080", + "path": [ + "api", + "v1", + "page", + "actions" + ] + } + }, + "response": [] + } + ], + "description": "Retrieves the list of Workflow Actions that are availbale for a given HTML Page. These actions are basically the `Save`, `Publish`, `Archive`, or any other buttons you see in the Content Edit modal when you're creating or editing an HTML Page in the back-end.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ] + } + } + ] + }, + { + "name": "Check Languages for a Page", + "item": [ + { + "name": "Create Test Page in English", + "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);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "const time = new Date().getTime();", + "pm.collectionVariables.set(\"testPageTitle\", \"My Test Page \" + time);", + "pm.collectionVariables.set(\"testPageUrl\", \"my-test-page-\" + time);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"contentlet\": {\n \"contentType\": \"htmlpageasset\",\n \"title\": \"{{testPageTitle}}\",\n \"url\": \"{{testPageUrl}}\",\n \"hostFolder\": \"default\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"friendlyName\": \"{{testPageTitle}}\",\n \"cachettl\": 0\n }\n}\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" + } + ] + } + }, + "response": [] + }, + { + "name": "Check page translation only in English", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Check that the test HTML Page is available in English, no matter how many languages there are\", function () {", + " const entity = pm.response.json().entity;", + " var isTranslated = false;", + " entity.forEach(function(lang) {", + " if (1 == lang.id && lang.translated) {", + " isTranslated = true;", + " }", + " });", + " pm.expect(isTranslated).to.be.equal(true, 'The test page must be available in English');", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/{{pageIdentifier}}/languages", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "{{pageIdentifier}}", + "languages" + ] + } + }, + "response": [] + } + ], + "description": "These requests are aimed to test the REST Endpoint that takes a Page ID, returns all Languages in the current instance and, for each of them, includes an additional attribute that indicates whether such a page is available in that specific language or not.", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});" + ] + } + } + ] + }, + { + "name": "Checking JSON Attributes", + "item": [ + { + "name": "Checking Page Audit Attributes", + "item": [ + { + "name": "Retrieving HTML Page Data", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Checking that audit properties are present\", function () {", + " var entity = pm.response.json().entity.page;", + " ", + " pm.expect(entity.creationDate).to.not.equal(undefined, \"The 'creationDate' attribute must be present\");", + " pm.expect(entity.owner).to.not.equal(undefined, \"The 'owner' attribute must be present\");", + " pm.expect(entity.ownerName).to.not.equal(undefined, \"The 'ownerName' attribute must be present\");", + " pm.expect(entity.modDate).to.not.equal(undefined, \"The 'modDate' attribute must be present\");", + " pm.expect(entity.modUser).to.not.equal(undefined, \"The 'modUser' attribute must be present\");", + " pm.expect(entity.modUserName).to.not.equal(undefined, \"The 'modUserName' attribute must be present\");", + " pm.expect(entity.publishDate).to.not.equal(undefined, \"The 'publishDate' attribute must be present\");", + " pm.expect(entity.publishUser).to.not.equal(undefined, \"The 'publishUser' attribute must be present\");", + " pm.expect(entity.publishUserName).to.not.equal(undefined, \"The 'publishUserName' attribute must be present\");", + "});", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/json/destinations/costa-rica", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "json", + "destinations", + "costa-rica" + ] + }, + "description": "http://localhost:8080/api/v1/page/json/{page-url}" + }, + "response": [] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "pm.test(\"HTTP Status code must be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "" + ] + } + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } + ] + }, + { + "name": "Moving layout not impact Contentlet position BUG", + "item": [ + { + "name": "Create a Content Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.collectionVariables.set(\"contentTypeIdMovingLayoutBUG\", jsonData.entity[0].id);", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"defaultType\":false,\n \"icon\":null,\n \"fixed\":false,\n \"system\":false,\n \"clazz\":\"com.dotcms.contenttype.model.type.ImmutableSimpleContentType\",\n \"description\":\"\",\n \"host\":\"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"folder\":\"SYSTEM_FOLDER\",\n \"name\":\"CT1 Moving Layout BUG\",\n \"systemActionMappings\":{\"NEW\":\"\"},\n \"workflow\":[\"d61a59e1-a49c-46f2-a929-db2b4bfa88b2\"]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/contenttype", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "contenttype" + ] + } + }, + "response": [] + }, + { + "name": "Add Field to Content Type Copy", + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"layout\":[\n {\"divider\":{\n \"clazz\":\"com.dotcms.contenttype.model.field.ImmutableRowField\",\n \"contentTypeId\":\"{{contentTypeIdMovingLayoutBUG}}\",\n \"dataType\":\"SYSTEM\",\n \"fieldContentTypeProperties\":[],\n \"fieldType\":\"Row\",\n \"fieldTypeLabel\":\"Row\",\n \"fieldVariables\":[],\n \"fixed\":false,\n \"iDate\":1667572217000,\n \"indexed\":false,\n \"listed\":false,\n \"modDate\":1667572217000,\n \"name\":\"Row Field\",\n \"readOnly\":false,\n \"required\":false,\n \"searchable\":false,\n \"sortOrder\":-1,\n \"unique\":false},\n \"columns\":[\n {\n \"columnDivider\":{\n \"clazz\":\"com.dotcms.contenttype.model.field.ImmutableColumnField\",\n \"dataType\":\"SYSTEM\",\n \"fieldContentTypeProperties\":[],\n \"fieldType\":\"Column\",\n \"fieldTypeLabel\":\"Column\",\n \"fieldVariables\":[],\n \"fixed\":false,\n \"iDate\":1667572217000,\n \"indexed\":false,\n \"listed\":false,\n \"modDate\":1667572217000,\n \"name\":\"Column Field\",\n \"readOnly\":false,\n \"required\":false,\n \"searchable\":false,\n \"sortOrder\":-1,\n \"unique\":false\n },\n \"fields\":[\n {\n \"clazz\":\"com.dotcms.contenttype.model.field.ImmutableTextField\",\n \"name\":\"title\",\n \"dataType\":\"TEXT\",\n \"regexCheck\":\"\",\n \"defaultValue\":\"\",\n \"hint\":\"\",\n \"required\":false,\n \"searchable\":false,\n \"indexed\":false,\n \"listed\":false,\n \"unique\":false,\n \"id\":null\n }\n ]\n }\n ]\n }\n ]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v3/contenttype/{{contentTypeIdMovingLayoutBUG}}/fields/move", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v3", + "contenttype", + "{{contentTypeIdMovingLayoutBUG}}", + "fields", + "move" + ] + } + }, + "response": [] + }, + { + "name": "Create Container C1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.collectionVariables.set(\"containerIdMovingLayoutBUG\", jsonData.entity.identifier);", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"title\": \"C1 Moving Layout BUG\",\n \"friendlyName\": \"cContainer used on the test for Moving Layout BUF\",\n \"maxContentlets\": 1,\n \"containerStructures\": [{\n \"structureId\": \"{{contentTypeIdMovingLayoutBUG}}\",\n \"maxContentlets\": 1,\n \"code\": \"$!{dotContentMap.title}\"\n }]\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/containers", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "containers" + ] + } + }, + "response": [] + }, + { + "name": "Create Template T1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.collectionVariables.set(\"tamplateIdMovingLayoutBUG\", jsonData.entity.identifier);", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\t\t\n \"layout\":{\n \"body\":{\n \"rows\":[\n {\n \"styleClass\":\"\",\n \"columns\":[\n {\n \"styleClass\":\"\",\n \"leftOffset\":1,\n \"width\":12,\n \"containers\":[\n {\"identifier\":\"{{containerIdMovingLayoutBUG}}\"}\n ]\n }\n ]\n },\n {\n \"styleClass\":\"\",\n \"columns\":[\n {\n \"styleClass\":\"\",\n \"leftOffset\":1,\n \"width\":12,\n \"containers\":[\n {\"identifier\":\"{{containerIdMovingLayoutBUG}}\"}\n ]\n }\n ]\n }\n ]\n } \n },\n \"friendlyName\": \"\",\n \"title\": \"T1 MovingLayoutBUG\",\n \"theme\": \"SYSTEM_THEME\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/templates", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "templates" + ] + } + }, + "response": [] + }, + { + "name": "Create page P1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.collectionVariables.set(\"p1IdMovingLayoutBUG\", jsonData.entity.identifier);", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{ \n \"contentlet\" : {\n \"title\" : \"P1 MovingLayoutBUG\",\n \"languageId\" : 1,\n \"stInode\": \"c541abb1-69b3-4bc5-8430-5e09e5239cc8\",\n \"url\": \"P1_MovingLayoutBUG\",\n \"hostFolder\": \"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"template\": \"{{tamplateIdMovingLayoutBUG}}\",\n \"cachettl\": 0,\n \"friendlyName\": \"friendlyName\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + } + }, + "response": [] + }, + { + "name": "Create contentlet A", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.collectionVariables.set(\"contentAId\", jsonData.entity.identifier);", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{ \n \"contentlet\" : {\n \"title\" : \"A\",\n \"languageId\" : 1,\n \"stInode\": \"{{contentTypeIdMovingLayoutBUG}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + } + }, + "response": [] + }, + { + "name": "Create contentlet B", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.collectionVariables.set(\"contentBId\", jsonData.entity.identifier);", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{ \n \"contentlet\" : {\n \"title\" : \"B\",\n \"languageId\" : 1,\n \"stInode\": \"{{contentTypeIdMovingLayoutBUG}}\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + } + }, + "response": [] + }, + { + "name": "Add A and B into P1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Variants with correct weight\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "[\n {\n \"contentletsId\": [\"{{contentAId}}\"],\n \"identifier\": \"{{containerIdMovingLayoutBUG}}\",\n \"uuid\": \"1\" \n },\n {\n \"contentletsId\": [\"{{contentBId}}\"],\n \"identifier\": \"{{containerIdMovingLayoutBUG}}\",\n \"uuid\": \"2\" \n } \n]\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/{{p1IdMovingLayoutBUG}}/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "{{p1IdMovingLayoutBUG}}", + "content" + ] + } + }, + "response": [] + }, + { + "name": "Create page P2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.collectionVariables.set(\"p2IdMovingLayoutBUG\", jsonData.entity.identifier);", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{ \n \"contentlet\" : {\n \"title\" : \"P2 MovingLayoutBUG\",\n \"languageId\" : 1,\n \"stInode\": \"c541abb1-69b3-4bc5-8430-5e09e5239cc8\",\n \"url\": \"P2_MovingLayoutBUG\",\n \"hostFolder\": \"8a7d5e23-da1e-420a-b4f0-471e7da8ea2d\",\n \"template\": \"{{tamplateIdMovingLayoutBUG}}\",\n \"cachettl\": 0,\n \"friendlyName\": \"friendlyName\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + } + }, + "response": [] + }, + { + "name": "Add A and B into P2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Variants with correct weight\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "[\n {\n \"contentletsId\": [\"{{contentAId}}\"],\n \"identifier\": \"{{containerIdMovingLayoutBUG}}\",\n \"uuid\": \"1\" \n },\n {\n \"contentletsId\": [\"{{contentBId}}\"],\n \"identifier\": \"{{containerIdMovingLayoutBUG}}\",\n \"uuid\": \"2\" \n } \n]\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/{{p2IdMovingLayoutBUG}}/content", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "{{p2IdMovingLayoutBUG}}", + "content" + ] + } + }, + "response": [] + }, + { + "name": "Move Containers in P1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Variants with correct weight\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"layout\": {\n \"width\": \"\",\n \"title\": \"t1-movinglayoutbug\",\n \"header\": false,\n \"footer\": false,\n \"body\": {\n \"rows\": [\n {\n \"columns\": [\n {\n \"containers\": [\n {\n \"identifier\": \"{{containerIdMovingLayoutBUG}}\",\n \"uuid\": \"2\"\n }\n ],\n \"leftOffset\": 1,\n \"width\": 12,\n \"styleClass\": \"\"\n }\n ],\n \"styleClass\": null\n },\n {\n \"columns\": [\n {\n \"containers\": [\n {\n \"identifier\": \"{{containerIdMovingLayoutBUG}}\",\n \"uuid\": \"1\"\n }\n ],\n \"leftOffset\": 1,\n \"width\": 12,\n \"styleClass\": \"\"\n }\n ],\n \"styleClass\": null\n }\n ]\n },\n \"sidebar\": null\n },\n \"title\": null\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/page/{{p1IdMovingLayoutBUG}}/layout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "{{p1IdMovingLayoutBUG}}", + "layout" + ] + } + }, + "response": [] + }, + { + "name": "Render P1", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var containerId = pm.collectionVariables.get(\"containerIdMovingLayoutBUG\");", + "var contentlets = jsonData.entity.containers[containerId].contentlets;", + "", + "pm.expect('B').to.equal(contentlets['uuid-1'][0].title);", + "pm.expect('A').to.equal(contentlets['uuid-2'][0].title);", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/P1_MovingLayoutBUG?host_id=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d&language_id=1&mode=PREVIEW_MODE", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "P1_MovingLayoutBUG" + ], + "query": [ + { + "key": "host_id", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" + }, + { + "key": "language_id", + "value": "1" + }, + { + "key": "mode", + "value": "PREVIEW_MODE" + } + ] + } + }, + "response": [] + }, + { + "name": "Render P2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = pm.response.json();", + "", + "", + "pm.test(\"Status code should be ok 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var containerId = pm.collectionVariables.get(\"containerIdMovingLayoutBUG\");", + "var contentlets = jsonData.entity.containers[containerId].contentlets;", + "", + "pm.expect('A').to.equal(contentlets['uuid-1'][0].title);", + "pm.expect('B').to.equal(contentlets['uuid-2'][0].title);", + "", + "", + "" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/page/render/P2_MovingLayoutBUG?host_id=8a7d5e23-da1e-420a-b4f0-471e7da8ea2d&language_id=1&mode=PREVIEW_MODE", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "page", + "render", + "P2_MovingLayoutBUG" + ], + "query": [ + { + "key": "host_id", + "value": "8a7d5e23-da1e-420a-b4f0-471e7da8ea2d" + }, + { + "key": "language_id", + "value": "1" + }, + { + "key": "mode", + "value": "PREVIEW_MODE" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Put Create Page With CacheTTL 100", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code should be 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "var jsonData = pm.response.json();", + "", + "pm.test(\"Identifier must contains path\", function () {", + " pm.expect(jsonData.entity.template).eq(\"SYSTEM_TEMPLATE\");", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "username", + "value": "admin@dotcms.com", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n\t\"contentlet\":{\n\t\t\"stName\": \"htmlpageasset\",\n\t\t\"title\": \"PageAsset SystemTemplate\",\n \"url\": \"pageassetsystemtemplate\",\n \"friendlyName\":\"pageassetsystemtemplate\",\n \"template\": \"SYSTEM_TEMPLATE\",\n \"sortOrder\": \"0\",\n \"cachettl\": \"100\",\n \"hostFolder\":\"48190c8c-42c4-46af-8d1a-0cd5db894797\"\n\t}\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "workflow", + "actions", + "default", + "fire", + "PUBLISH" + ] + } + }, + "response": [] + }, + { + "name": "invalidateSession", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.test(\"Body matches string\", function () {", + " pm.expect(pm.response.text()).to.include(\"Logout successfully\");", + "});", + "", + "pm.environment.unset('jwt');", + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/api/v1/logout", + "host": [ + "{{serverURL}}" + ], + "path": [ + "api", + "v1", + "logout" + ] + } + }, + "response": [] + }, + { + "name": "Check Cache-Control", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Cache-Control is correct\", function () {", + " pm.response.to.be.header('Cache-Control','max-age=100');", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{serverURL}}/pageassetsystemtemplate", + "host": [ + "{{serverURL}}" + ], + "path": [ + "pageassetsystemtemplate" + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{jwt}}", + "type": "string" + } + ] + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + " const serverURL = pm.environment.get('serverURL'); // Get the server URL from the environment variable", + " const apiUrl = `${serverURL}/api/v1/apitoken`; // Construct the full API URL", + "", + "// If we are unable to get the JWT we need to generate a new one", + " if (!pm.environment.get('jwt')) {", + " const username = pm.environment.get(\"user\");", + " const password = pm.environment.get(\"password\");", + " const basicAuth = Buffer.from(`${username}:${password}`).toString('base64');", + "", + "", + " const requestOptions = {", + " url: apiUrl,", + " method: \"POST\",", + " header: {", + " \"accept\": \"*/*\",", + " \"content-type\": \"application/json\",", + " \"Authorization\": `Basic ${basicAuth}`", + " },", + " body: {", + " mode: \"raw\",", + " raw: JSON.stringify({", + " \"expirationSeconds\": 7200,", + " \"userId\": \"dotcms.org.1\",", + " \"network\": \"0.0.0.0/0\",", + " \"claims\": {\"label\": \"postman-tests\"}", + " })", + " }", + " };", + "", + "", + " pm.sendRequest(requestOptions, function (err, response) {", + " if (err) {", + " console.log(err);", + " } else {", + " const jwt = response.json().entity.jwt;", + " pm.environment.set('jwt', jwt);", + " console.log(jwt);", + " }", + " });", + " }" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "contentTypeIdMovingLayoutBUG", + "value": "" + }, + { + "key": "spanish_content_container_id", + "value": "" + }, + { + "key": "containerIdMovingLayoutBUG", + "value": "" + }, + { + "key": "tamplateIdMovingLayoutBUG", + "value": "" + }, + { + "key": "p1IdMovingLayoutBUG", + "value": "" + }, + { + "key": "contentAId", + "value": "" + }, + { + "key": "contentBId", + "value": "" + }, + { + "key": "p2IdMovingLayoutBUG", + "value": "" + } + ] +}