e2e test for the validation

This commit is contained in:
HelderSepu
2017-11-04 18:40:46 -04:00
parent e10b01c6ff
commit 58dcce497e
2 changed files with 66 additions and 5 deletions

View File

@@ -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"
@@ -238,6 +241,34 @@ module.exports = {
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 = {
},
}
}
}
}

View File

@@ -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")
@@ -138,6 +139,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")
.assert.containsText("@petOperationDeleteTitle", "/pet/{petId}")
@@ -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")