diff --git a/test/e2e/pages/main.js b/test/e2e/pages/main.js index c3bbb558..04e77545 100644 --- a/test/e2e/pages/main.js +++ b/test/e2e/pages/main.js @@ -93,6 +93,7 @@ module.exports = { petAPIWrapperBar: { selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-tag" }, + /** * Post pet/ api */ @@ -141,6 +142,7 @@ module.exports = { petOperationPostStatus: { selector: ".swagger-ui .opblock-tag-section:nth-child(1) div#operations-pet-addPet pre.microlight span:nth-child(70)" }, + /** * Put pet/ api */ @@ -189,8 +191,9 @@ module.exports = { petOperationPutStatus: { selector: ".swagger-ui .opblock-tag-section:nth-child(1) div#operations-pet-updatePet pre.microlight span:nth-child(70)" }, + /** - * Get pet/ + * Get /pet/findByTags */ petOperationGetByTagContainer: { selector: ".swagger-ui .opblock-tag-section:nth-child(1) div#operations-pet-findPetsByTags" @@ -237,6 +240,34 @@ module.exports = { petOperationGetByTagStatus: { selector: ".swagger-ui .opblock-tag-section:nth-child(1) div#operations-pet-findPetsByTags pre.microlight span:nth-child(70)" }, + + /** + * Get /pet/{petId} + */ + petOperationGetByIdContainer: { + selector: ".swagger-ui .opblock-tag-section:nth-child(1) div#operations-pet-getPetById" + }, + petOperationGetByIdTitle: { + selector: ".swagger-ui .opblock-tag-section:nth-child(1) div#operations-pet-getPetById .opblock-summary-get span.opblock-summary-path span" + }, + petOperationGetByIdCollpase: { + selector: ".swagger-ui .opblock-tag-section:nth-child(1) div#operations-pet-getPetById .opblock-summary-get" + }, + petOperationGetByIdCollapseContainer: { + selector: ".swagger-ui .opblock-tag-section:nth-child(1) div#operations-pet-getPetById .ReactCollapse--collapse" + }, + petOperationGetByIdTryBtn: { + selector: ".swagger-ui .opblock-tag-section:nth-child(1) div#operations-pet-getPetById button.try-out__btn" + }, + petOperationGetByIdExecuteBtn: { + selector: ".swagger-ui .opblock-tag-section:nth-child(1) div#operations-pet-getPetById button.execute" + }, + petOperationGetByIdParameter: { + selector: ".swagger-ui .opblock-tag-section:nth-child(3) div#operations-pet-getPetById div.parameters-col_description input" + }, + petOperationGetByIdResultsBox: { + selector: ".swagger-ui .opblock-tag-section:nth-child(1) div#operations-pet-getPetById pre.microlight" + }, /** * Delete pet/ @@ -497,9 +528,5 @@ module.exports = { }, } } - - - - } } diff --git a/test/e2e/scenarios/operations/pet.js b/test/e2e/scenarios/operations/pet.js index 441004c5..337b5877 100644 --- a/test/e2e/scenarios/operations/pet.js +++ b/test/e2e/scenarios/operations/pet.js @@ -84,6 +84,7 @@ describe("render pet api container", function () { client.end() }) + it("Testing put /pet api Mock data", function (client) { apiWrapper.waitForElementVisible("@petOperationPutContainer", 5000) .click("@petOperationPutCollpase") @@ -137,6 +138,38 @@ describe("render pet api container", function () { client.end() }) + + it("render get by ID /pet/{petId} api container", function (client) { + apiWrapper.waitForElementVisible("@petOperationGetByIdContainer", 5000) + .assert.containsText("@petOperationGetByIdTitle", "/pet/{petId}") + .click("@petOperationGetByIdCollpase") + .waitForElementVisible("@petOperationGetByIdCollapseContainer", 3000) + .click("@petOperationGetByIdTryBtn") + .waitForElementVisible("@petOperationGetByTagExecuteBtn", 1000) + .click("@petOperationGetByTagTryBtn") + .assert.cssClassNotPresent("@petOperationGetByTagTryBtn", "cancel") + + client.end() + }) + + it("render get by ID /pet/{petId} api Mock data", function (client) { + apiWrapper.waitForElementVisible("@petOperationGetByIdContainer", 5000) + .assert.containsText("@petOperationGetByIdTitle", "/pet/{petId}") + .click("@petOperationGetByIdCollpase") + .waitForElementVisible("@petOperationGetByIdCollapseContainer", 3000) + .click("@petOperationGetByIdTryBtn") + .waitForElementVisible("@petOperationGetByTagExecuteBtn", 1000) + .setValue("@petOperationGetByIdParameter", "abc") + .click("@petOperationGetByIdExecuteBtn") + .waitForElementVisible("@petOperationGetByIdResultsBox") + .assert.containsText("@petOperationGetByIdParameter", "abc") + .assert.cssClassPresent("@petOperationGetByIdParameter", "invalid") + .assert.attributeEquals("@petOperationGetByIdParameter", "title", "Value must be an integer") + .click("@petOperationGetByTagTryBtn") + .assert.cssClassNotPresent("@petOperationGetByTagTryBtn", "cancel") + + client.end() + }) it("render delete /pet api container", function (client) { apiWrapper.waitForElementVisible("@petOperationDeleteContainer") @@ -150,6 +183,7 @@ describe("render pet api container", function () { client.end() }) + it("Testing delete /pet api Mock data", function (client) { apiWrapper.waitForElementVisible("@petOperationDeleteContainer", 3000) .click("@petOperationDeleteCollpase")