Kenny пре 7 година
родитељ
комит
0e552c2116
9 измењених фајлова са 737 додато и 109 уклоњено
  1. +36
    -1
      test/e2e/db.json
  2. +279
    -4
      test/e2e/pages/main.js
  3. +10
    -104
      test/e2e/scenarios/initial-render/informationContainer.js
  4. +80
    -0
      test/e2e/scenarios/initial-render/models.js
  5. +97
    -0
      test/e2e/scenarios/initial-render/operations/pet.js
  6. +73
    -0
      test/e2e/scenarios/initial-render/operations/store.js
  7. +60
    -0
      test/e2e/scenarios/initial-render/operations/user.js
  8. +50
    -0
      test/e2e/scenarios/initial-render/schemes.js
  9. +52
    -0
      test/e2e/scenarios/initial-render/topbar.js

+ 36
- 1
test/e2e/db.json Прегледај датотеку

@@ -1,5 +1,40 @@
{
"pet": [
{"id":1,"category":{"id":0,"name":"string"},"name":"doggie","photoUrls":["string"],"tags":[{"id":0,"name":"string"}],"status":"available"}
{
"id": 1,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
},
{
"id": 2,
"category": {
"id": 0,
"name": "string"
},
"name": "doggie",
"photoUrls": [
"string"
],
"tags": [
{
"id": 0,
"name": "string"
}
],
"status": "available"
}
]
}

+ 279
- 4
test/e2e/pages/main.js Прегледај датотеку

@@ -12,7 +12,7 @@ module.exports = {
}
},
informationContainer: {
selector: ".information-container",
selector: ".information-container.wrapper",
elements: {
title: {
selector: ".title"
@@ -55,9 +55,6 @@ module.exports = {
schemeContainer: {
selector: ".scheme-container",
elements: {
schemeTitle: {
selector: ".schemes-title"
},
httpOption: {
selector: "select option"
},
@@ -86,6 +83,284 @@ module.exports = {
selector: "#read:pets-checkbox-petstore_auth"
}
}
},
apiWrapper: {
selector: ".swagger-ui .wrapper:nth-child(3)",
elements: {
petAPIWrapper: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1)"
},
petAPIWrapperBar: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-tag"
},
/**
* Post pet/ api
*/
petOperationPostContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-post:nth-of-type(1)"
},
petOperationPostTitle: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-post:nth-of-type(1) .opblock-summary-post span.opblock-summary-path span"
},
petOperationPostCollpase: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-post:nth-of-type(1) .opblock-summary-post"
},
petOperationPostCollapseContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-post:nth-of-type(1) .ReactCollapse--collapse"
},
petOperationPostTryBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-post:nth-of-type(1) button.try-out__btn"
},
petOperationPostTryText: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-post:nth-of-type(1) textarea.body-param__text"
},
petOperationPostExecuteBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-post:nth-of-type(1) button.execute"
},
/**
* Put pet/ api
*/
petOperationPutContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-put"
},
petOperationPutTitle: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-put .opblock-summary-put span.opblock-summary-path span"
},
petOperationPutCollpase: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-put .opblock-summary-put"
},
petOperationPutCollapseContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-put .ReactCollapse--collapse"
},
petOperationPutTryBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-put button.try-out__btn"
},
petOperationPutTryText: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-put textarea.body-param__text"
},
petOperationPutExecuteBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-put button.execute"
},
/**
* Get pet/
*/
petOperationGetByTagContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-deprecated"
},
petOperationGetByTagTitle: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-deprecated .opblock-summary-get span.opblock-summary-path__deprecated span"
},
petOperationGetByTagCollpase: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-deprecated .opblock-summary-get"
},
petOperationGetByTagCollapseContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-deprecated .ReactCollapse--collapse"
},
petOperationGetByTagTryBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-deprecated button.try-out__btn"
},
petOperationGetByTagTryAdded: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-deprecated button.json-schema-form-item-add"
},
petOperationGetByTagExecuteBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-deprecated button.execute"
},
/**
* Delete pet/
*/
petOperationDeleteContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-delete"
},
petOperationDeleteTitle: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-delete .opblock-summary-delete span.opblock-summary-path span"
},
petOperationDeleteCollpase: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-delete .opblock-summary-delete"
},
petOperationDeleteCollapseContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-delete .ReactCollapse--collapse"
},
petOperationDeleteTryBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-delete button.try-out__btn"
},
petOperationDeleteExecuteBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(1) .opblock-delete button.execute"
},

/**
* ***********Store************
*/
storeAPIWrapper: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2)"
},
storeAPIWrapperBar: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-tag"
},
/**
* Get /store/inventory
*/
storeOperationGetContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-get:nth-of-type(1)"
},
storeOperationGetTitle: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-get:nth-of-type(1) .opblock-summary-get span.opblock-summary-path span"
},
storeOperationGetCollpase: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-get:nth-of-type(1) .opblock-summary-get"
},
storeOperationGetCollapseContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-get:nth-of-type(1) .ReactCollapse--collapse"
},
storeOperationGetTryBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-get:nth-of-type(1) button.try-out__btn"
},
storeOperationGetExecuteBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-get:nth-of-type(1) button.execute"
},
/**
* Post /store/order
*/
storeOperationPostContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-post"
},
storeOperationPostTitle: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-post .opblock-summary-post span.opblock-summary-path span"
},
storeOperationPostCollpase: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-post .opblock-summary-post"
},
storeOperationPostCollapseContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-post .ReactCollapse--collapse"
},
storeOperationPostTryBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-post button.try-out__btn"
},
storeOperationPostExecuteBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-post button.execute"
},
/**
* Delete /store/order/{orderId}
*/
storeOperationDeleteContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-delete"
},
storeOperationDeleteTitle: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-delete .opblock-summary-delete span.opblock-summary-path span"
},
storeOperationDeleteCollpase: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-delete .opblock-summary-delete"
},
storeOperationDeleteCollapseContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-delete .ReactCollapse--collapse"
},
storeOperationDeleteTryBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-delete button.try-out__btn"
},
storeOperationDeleteExecuteBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(2) .opblock-delete button.execute"
},
/**
* *********User**************
*/
userAPIWrapper: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3)"
},
userAPIWrapperBar: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-tag"
},
/**
* Put /user/login
*/
userOperationPutContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-put"
},
userOperationPutTitle: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-put .opblock-summary-put span.opblock-summary-path span"
},
userOperationPutCollpase: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-put .opblock-summary-put"
},
userOperationPutCollapseContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-put .ReactCollapse--collapse"
},
userOperationPutTryBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-put button.try-out__btn"
},
userOperationPutExecuteBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-put button.execute"
},
/**
* Delete /user
*/
userOperationDeleteContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-delete"
},
userOperationDeleteTitle: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-delete .opblock-summary-delete span.opblock-summary-path span"
},
userOperationDeleteCollpase: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-delete .opblock-summary-delete"
},
userOperationDeleteCollapseContainer: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-delete .ReactCollapse--collapse"
},
userOperationDeleteTryBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-delete button.try-out__btn"
},
userOperationDeleteExecuteBtn: {
selector: ".swagger-ui .opblock-tag-section:nth-child(3) .opblock-delete button.execute"
},

}
},
/* Model Container */
modelWrapper: {
selector: ".swagger-ui .wrapper:nth-child(4)",
elements: {
modelContainer: {
selector: ".swagger-ui .models"
},
orderModel: {
selector: "section.models div.model-container:nth-child(1)"
},
orderModelCallapse: {
selector: "section.models div.model-container:nth-child(1) span.model-toggle"
},
categoryModel: {
selector: "section.models div.model-container:nth-child(2)"
},
categoryModelCallapse: {
selector: "section.models div.model-container:nth-child(2) span.model-toggle"
},
userModel: {
selector: "section.models div.model-container:nth-child(3)"
},
userModelCallapse: {
selector: "section.models div.model-container:nth-child(3) span.model-toggle"
},
tagModel: {
selector: "section.models div.model-container:nth-child(4)"
},
tagModelCallapse: {
selector: "section.models div.model-container:nth-child(4) span.model-toggle"
},
petModel: {
selector: "section.models div.model-container:nth-child(5)"
},
petModelCallapse: {
selector: "section.models div.model-container:nth-child(5) span.model-toggle"
},
apiResponseModel: {
selector: "section.models div.model-container:nth-child(6)"
},
apiResponseModelCallapse: {
selector: "section.models div.model-container:nth-child(6) span.model-toggle"
},
}
}




}
}

test/e2e/scenarios/initial-render/test.js → test/e2e/scenarios/initial-render/informationContainer.js Прегледај датотеку

@@ -1,68 +1,17 @@
describe("initial render", function () {
let mainPage


describe("for topbar", function () {
let topbar
before(function (client, done) {
done()
})

after(function (client, done) {
client.end(function () {
done()
})
})

afterEach(function (client, done) {
done()
})

beforeEach(function (client, done) {
mainPage = client
.url("localhost:3200")
.page.main()

topbar = mainPage.section.topbar

client.waitForElementVisible('.download-url-input', 5000)
.pause(1000)
.clearValue('.download-url-input')
.setValue('.download-url-input', 'http://localhost:3200/test-specs/1.json')
.click('button.download-url-button')

done()
})

it("renders section", function (client) {
mainPage.expect.section("@topbar").to.be.visible
client.end()
})

it("renders input box", function (client) {
topbar.expect.element("@inputBox").to.be.visible
client.end()
})

it("renders explore button", function (client) {
topbar.expect.element("@btnExplore").to.be.visible

client.end()
})
})

describe("for information", function () {
let informationContainer, topbar
describe("render informationContainer", function () {
let mainPage
let informationContainer
beforeEach(function (client, done) {
mainPage = client
.url("localhost:3200")
.page.main()
client.waitForElementVisible('.download-url-input', 5000)
client.waitForElementVisible(".download-url-input", 5000)
.pause(2000)
.clearValue(".download-url-input")
.setValue(".download-url-input", "http://localhost:3200/test-specs/1.json")
.click("button.download-url-button")
.pause(1000)
.clearValue('.download-url-input')
.setValue('.download-url-input', 'http://localhost:3200/test-specs/1.json')
.click('button.download-url-button')

informationContainer = mainPage.section.informationContainer
@@ -70,7 +19,7 @@ describe("initial render", function () {
})

it("renders section", function (client) {
mainPage.expect.section("@informationContainer").to.be.visible.before(5000)
mainPage.expect.section("@informationContainer").to.be.visible.before(8000)

client.end()
})
@@ -138,47 +87,4 @@ describe("initial render", function () {
client.end()
})
})
describe("for scheme", function () {
let schemeContainer
beforeEach(function (client, done) {

mainPage = client
.url("localhost:3200")
.page.main()
schemeContainer = mainPage.section.schemeContainer
done()
})

it("render section", function (client) {
mainPage.expect.section("@schemeContainer").to.be.visible.before(5000)

client.end()
})
it("render scheme option", function (client) {
schemeContainer.waitForElementVisible("@schemeTitle", 5000)
.assert.containsText("@schemeTitle", "Schemes")
.expect.element("@httpOption").to.be.selected

client.end()
})

it("render authorized button", function (client) {
schemeContainer.waitForElementVisible("@btnAuthorize", 5000)
.expect.element("@btnAuthorize").to.be.visible

client.end()
})
it("render click event", function(client) {
schemeContainer.waitForElementVisible("@btnAuthorize", 5000)
.click("@btnAuthorize")
.assert.visible("@authorizationModal")
.assert.containsText("@appName", "Application: your-app-name")
.assert.containsText("@authorizationUrl", "http://petstore.swagger.io/oauth/dialog")
.assert.containsText("@flow", "implicit")
.assert.value("@inputClientID", "your-client-id")

client.end()
})
})
})
})

+ 80
- 0
test/e2e/scenarios/initial-render/models.js Прегледај датотеку

@@ -0,0 +1,80 @@
describe("Render Model Wrapper", function () {
let mainPage
let modelWrapper

beforeEach(function (client, done) {
mainPage = client
.url("localhost:3200")
.page.main()
client.waitForElementVisible(".download-url-input", 5000)
.pause(2000)
.clearValue(".download-url-input")
.setValue(".download-url-input", "http://localhost:3200/test-specs/1.json")
.click("button.download-url-button")
.pause(1000)

modelWrapper = mainPage.section.modelWrapper

done()
})
afterEach(function (client, done){
done()
})
it("Render model wrapper", function(client){
mainPage.expect.section("@modelWrapper").to.be.visible.before(5000)

client.end()
})

it("Testing model callapse", function(client){
modelWrapper.waitForElementVisible("@modelContainer")
.click("@modelContainer")
.assert.cssClassNotPresent("@modelContainer", "is-open")

client.end()
})

it("Testing order model", function(client){
modelWrapper.waitForElementVisible("@orderModel")
.click("@orderModelCallapse")
.assert.cssClassNotPresent("@orderModelCallapse", "callapsed")
client.end()
})

it("Testing category model", function(client){
modelWrapper.waitForElementVisible("@categoryModel")
.click("@categoryModelCallapse")
.assert.cssClassNotPresent("@categoryModelCallapse", "callapsed")
client.end()
})
it("Testing user model", function(client){
modelWrapper.waitForElementVisible("@userModel")
.click("@userModelCallapse")
.assert.cssClassNotPresent("@userModelCallapse", "callapsed")
client.end()
})
it("Testing tag model", function(client){
modelWrapper.waitForElementVisible("@tagModel")
.click("@tagModelCallapse")
.assert.cssClassNotPresent("@tagModelCallapse", "callapsed")
client.end()
})
it("Testing pet model", function(client){
modelWrapper.waitForElementVisible("@petModel")
.click("@petModelCallapse")
.assert.cssClassNotPresent("@petModelCallapse", "callapsed")
client.end()
})
it("Testing apiResponse model", function(client){
modelWrapper.waitForElementVisible("@apiResponseModel")
.click("@apiResponseModelCallapse")
.assert.cssClassNotPresent("@apiResponseModelCallapse", "callapsed")
client.end()
})
})

+ 97
- 0
test/e2e/scenarios/initial-render/operations/pet.js Прегледај датотеку

@@ -0,0 +1,97 @@

describe("render pet api container", function () {
let mainPage
let apiWrapper
beforeEach(function (client, done) {
mainPage = client
.url("localhost:3200")
.page.main()

client.waitForElementVisible(".download-url-input", 5000)
.pause(2000)
.clearValue(".download-url-input")
.setValue(".download-url-input", "http://localhost:3200/test-specs/1.json")
.click("button.download-url-button")
.pause(1000)

apiWrapper = mainPage.section.apiWrapper

done()
})
afterEach(function (client, done) {
done()
})
it("render section", function (client) {
mainPage.expect.section("@apiWrapper").to.be.visible.before(5000)
client.end()
})
it("test rendered pet container", function (client) {
apiWrapper.waitForElementVisible("@petAPIWrapper", 5000)
.expect.element("@petAPIWrapper").to.be.visible

client.end()
})
it("collapse pet wrapper", function (client) {
apiWrapper.waitForElementVisible("@petAPIWrapper", 5000)
.click("@petAPIWrapperBar")
.assert.cssClassNotPresent("@petAPIWrapper", "is-open")

client.end()
})
it("render post /pet api container", function (client) {
apiWrapper.waitForElementVisible("@petOperationPostContainer", 5000)
.assert.containsText("@petOperationPostTitle", "/pet")
.click("@petOperationPostCollpase")
.waitForElementVisible("@petOperationPostCollapseContainer", 3000)
.click("@petOperationPostTryBtn")
.waitForElementVisible("@petOperationPostTryText", 1000)
.waitForElementVisible("@petOperationPostExecuteBtn", 1000)
.click("@petOperationPostTryBtn")
.assert.cssClassNotPresent("@petOperationPostTryBtn", "cancel")

client.end()
})

it("render put /pet api container", function (client) {
apiWrapper.waitForElementVisible("@petOperationPutContainer", 5000)
.assert.containsText("@petOperationPutTitle", "/pet")
.click("@petOperationPutCollpase")
.waitForElementVisible("@petOperationPutCollapseContainer", 3000)
.click("@petOperationPutTryBtn")
.waitForElementVisible("@petOperationPutTryText", 1000)
.waitForElementVisible("@petOperationPutExecuteBtn", 1000)
.click("@petOperationPutTryBtn")
.assert.cssClassNotPresent("@petOperationPutTryBtn", "cancel")

client.end()
})

it("render get /pet api container", function (client) {
apiWrapper.waitForElementVisible("@petOperationGetByTagContainer", 5000)
.assert.containsText("@petOperationGetByTagTitle", "/pet/findByTags")
.click("@petOperationGetByTagCollpase")
.waitForElementVisible("@petOperationGetByTagCollapseContainer", 3000)
.click("@petOperationGetByTagTryBtn")
.waitForElementVisible("@petOperationGetByTagTryAdded", 1000)
.waitForElementVisible("@petOperationGetByTagExecuteBtn", 1000)
.click("@petOperationGetByTagTryBtn")
.assert.cssClassNotPresent("@petOperationGetByTagTryBtn", "cancel")
client.end()
})

it("render delete /pet api container", function (client) {
apiWrapper.waitForElementVisible("@petOperationDeleteContainer", 5000)
.assert.containsText("@petOperationDeleteTitle", "/pet/{petId}")
.click("@petOperationDeleteCollpase")
.waitForElementVisible("@petOperationDeleteCollapseContainer", 3000)
.click("@petOperationDeleteTryBtn")
.waitForElementVisible("@petOperationDeleteExecuteBtn", 1000)
.click("@petOperationDeleteTryBtn")
.assert.cssClassNotPresent("@petOperationDeleteTryBtn", "cancel")
client.end()
})
})

+ 73
- 0
test/e2e/scenarios/initial-render/operations/store.js Прегледај датотеку

@@ -0,0 +1,73 @@
describe("render store api container", function(){
let mainPage
let apiWrapper
beforeEach( function(client, done){
mainPage = client
.url("localhost:3200")
.page.main()

client.waitForElementVisible(".download-url-input", 5000)
.pause(2000)
.clearValue(".download-url-input")
.setValue(".download-url-input", "http://localhost:3200/test-specs/1.json")
.click("button.download-url-button")
.pause(1000)

apiWrapper = mainPage.section.apiWrapper

done()
})
afterEach(function (client, done) {
done()
})
it("test rendered store container", function(client){
apiWrapper.waitForElementVisible("@storeAPIWrapper", 5000)
.expect.element("@storeAPIWrapper").to.be.visible

client.end()
})
it("callapse store wrapper", function(client){
apiWrapper.waitForElementVisible("@storeAPIWrapper", 5000)
.click("@storeAPIWrapperBar")
.assert.cssClassNotPresent("@storeAPIWrapper", "is-open")

client.end()
})
it("render get /store/inventory api container", function (client) {
apiWrapper.waitForElementVisible("@storeOperationGetContainer", 5000)
.assert.containsText("@storeOperationGetTitle", "/store/inventory")
.click("@storeOperationGetCollpase")
.waitForElementVisible("@storeOperationGetCollapseContainer", 3000)
.click("@storeOperationGetTryBtn")
.waitForElementVisible("@storeOperationGetExecuteBtn", 1000)
.click("@storeOperationGetTryBtn")
.assert.cssClassNotPresent("@storeOperationGetTryBtn", "cancel")
client.end()
})
it("render post /store/order api container", function (client) {
apiWrapper.waitForElementVisible("@storeOperationPostContainer", 5000)
.assert.containsText("@storeOperationPostTitle", "/store/order")
.click("@storeOperationPostCollpase")
.waitForElementVisible("@storeOperationPostCollapseContainer", 3000)
.click("@storeOperationPostTryBtn")
.waitForElementVisible("@storeOperationPostExecuteBtn", 1000)
.click("@storeOperationPostTryBtn")
.assert.cssClassNotPresent("@storeOperationPostTryBtn", "cancel")
client.end()
})
it("render delete /store/order/{orderId} api container", function (client) {
apiWrapper.waitForElementVisible("@storeOperationDeleteContainer", 5000)
.assert.containsText("@storeOperationDeleteTitle", "/store/order/{orderId}")
.click("@storeOperationDeleteCollpase")
.waitForElementVisible("@storeOperationDeleteCollapseContainer", 3000)
.click("@storeOperationDeleteTryBtn")
.waitForElementVisible("@storeOperationDeleteExecuteBtn", 1000)
.click("@storeOperationDeleteTryBtn")
.assert.cssClassNotPresent("@storeOperationDeleteTryBtn", "cancel")
client.end()
})

})

+ 60
- 0
test/e2e/scenarios/initial-render/operations/user.js Прегледај датотеку

@@ -0,0 +1,60 @@
describe("render user api container", function(){
let mainPage
let apiWrapper
beforeEach( function(client, done){
mainPage = client
.url("localhost:3200")
.page.main()

client.waitForElementVisible(".download-url-input", 5000)
.pause(2000)
.clearValue(".download-url-input")
.setValue(".download-url-input", "http://localhost:3200/test-specs/1.json")
.click("button.download-url-button")
.pause(1000)

apiWrapper = mainPage.section.apiWrapper

done()
})
afterEach(function (client, done) {
done()
})
it("test rendered user container", function(client){
apiWrapper.waitForElementVisible("@userAPIWrapper", 5000)
.expect.element("@userAPIWrapper").to.be.visible

client.end()
})
it("callapse user wrapper", function(client){
apiWrapper.waitForElementVisible("@userAPIWrapper", 5000)
.click("@userAPIWrapperBar")
.assert.cssClassNotPresent("@userAPIWrapper", "is-open")

client.end()
})
it("render put /user/{username} api container", function (client) {
apiWrapper.waitForElementVisible("@userOperationPutContainer", 5000)
.assert.containsText("@userOperationPutTitle", "/user/{username}")
.click("@userOperationPutCollpase")
.waitForElementVisible("@userOperationPutCollapseContainer", 3000)
.click("@userOperationPutTryBtn")
.waitForElementVisible("@userOperationPutExecuteBtn", 1000)
.click("@userOperationPutTryBtn")
.assert.cssClassNotPresent("@userOperationPutTryBtn", "cancel")
client.end()
})
it("render delete /user/{username} api container", function (client) {
apiWrapper.waitForElementVisible("@userOperationDeleteContainer", 5000)
.assert.containsText("@userOperationDeleteTitle", "/user/{username}")
.click("@userOperationDeleteCollpase")
.waitForElementVisible("@userOperationDeleteCollapseContainer", 3000)
.click("@userOperationDeleteTryBtn")
.waitForElementVisible("@userOperationDeleteExecuteBtn", 1000)
.click("@userOperationDeleteTryBtn")
.assert.cssClassNotPresent("@userOperationDeleteTryBtn", "cancel")
client.end()
})
})

+ 50
- 0
test/e2e/scenarios/initial-render/schemes.js Прегледај датотеку

@@ -0,0 +1,50 @@
describe("Render scheme", function () {
let mainPage
let schemeContainer
beforeEach(function (client, done) {

mainPage = client
.url("localhost:3200")
.page.main()

client.waitForElementVisible(".download-url-input", 5000)
.pause(2000)
.clearValue(".download-url-input")
.setValue(".download-url-input", "http://localhost:3200/test-specs/1.json")
.click("button.download-url-button")
.pause(1000)

schemeContainer = mainPage.section.schemeContainer
done()
})

it("render section", function (client) {
mainPage.expect.section("@schemeContainer").to.be.visible.before(5000)

client.end()
})
it("render scheme option", function (client) {
schemeContainer.waitForElementVisible("@httpOption", 5000)
.expect.element("@httpOption").to.be.selected

client.end()
})

it("render authorized button", function (client) {
schemeContainer.waitForElementVisible("@btnAuthorize", 5000)
.expect.element("@btnAuthorize").to.be.visible

client.end()
})
it("render click event", function(client) {
schemeContainer.waitForElementVisible("@btnAuthorize", 5000)
.click("@btnAuthorize")
.assert.visible("@authorizationModal")
.assert.containsText("@appName", "Application: your-app-name")
.assert.containsText("@authorizationUrl", "http://petstore.swagger.io/oauth/dialog")
.assert.containsText("@flow", "implicit")
.assert.value("@inputClientID", "your-client-id")

client.end()
})
})

+ 52
- 0
test/e2e/scenarios/initial-render/topbar.js Прегледај датотеку

@@ -0,0 +1,52 @@
describe("initial render", function () {
let mainPage
describe("for topbar", function () {
let topbar
before(function (client, done) {
done()
})

after(function (client, done) {
client.end(function () {
done()
})
})

afterEach(function (client, done) {
done()
})

beforeEach(function (client, done) {
mainPage = client
.url("localhost:3200")
.page.main()

topbar = mainPage.section.topbar

client.waitForElementVisible(".download-url-input", 10000)
.pause(2000)
.clearValue(".download-url-input")
.setValue(".download-url-input", "http://localhost:3200/test-specs/1.json")
.click("button.download-url-button")
.pause(1000)

done()
})

it("renders section", function (client) {
mainPage.expect.section("@topbar").to.be.visible
client.end()
})

it("renders input box", function (client) {
topbar.expect.element("@inputBox").to.be.visible
client.end()
})

it("renders explore button", function (client) {
topbar.expect.element("@btnExplore").to.be.visible

client.end()
})
})
})

Loading…
Откажи
Сачувај