write informationContainer test
This commit is contained in:
@@ -19,6 +19,36 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
version: {
|
version: {
|
||||||
selector: ".version"
|
selector: ".version"
|
||||||
|
},
|
||||||
|
baseUrl: {
|
||||||
|
selector: ".base-url"
|
||||||
|
},
|
||||||
|
mainUrl: {
|
||||||
|
selector: ".main a"
|
||||||
|
},
|
||||||
|
mainUrlContent: {
|
||||||
|
selector: ".main a span"
|
||||||
|
},
|
||||||
|
description: {
|
||||||
|
selector: ".description p"
|
||||||
|
},
|
||||||
|
swaggerUrl: {
|
||||||
|
selector: ".description p a:nth-of-type(1)"
|
||||||
|
},
|
||||||
|
swaggerircUrl: {
|
||||||
|
selector: ".description p a:nth-of-type(2)"
|
||||||
|
},
|
||||||
|
termsLink: {
|
||||||
|
selector: ".info > div:nth-child(3) a"
|
||||||
|
},
|
||||||
|
contactDevLink: {
|
||||||
|
selector: ".info > div:nth-child(4) a"
|
||||||
|
},
|
||||||
|
apacheLink: {
|
||||||
|
selector: ".info > div:nth-child(5) a"
|
||||||
|
},
|
||||||
|
aboutSwaggerLink: {
|
||||||
|
selector: ".info > a"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ describe("initial render", function () {
|
|||||||
describe("for information", function () {
|
describe("for information", function () {
|
||||||
let informationContainer
|
let informationContainer
|
||||||
beforeEach(function (client, done) {
|
beforeEach(function (client, done) {
|
||||||
|
|
||||||
mainPage = client
|
mainPage = client
|
||||||
.url("localhost:3200")
|
.url("localhost:3200")
|
||||||
.page.main()
|
.page.main()
|
||||||
@@ -61,17 +62,67 @@ describe("initial render", function () {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("renders title", function (client) {
|
it("renders title", function (client) {
|
||||||
// informationContainer.waitForElementVisible("@title", 5000, function() {
|
|
||||||
// informationContainer.expect.element("@title").to.contain.text("Swagger Petstore")
|
|
||||||
// informationContainer.expect.element("@version").to.contain.text("1.0.0")
|
|
||||||
|
|
||||||
// client.end()
|
|
||||||
// })
|
|
||||||
informationContainer.waitForElementVisible("@title", 5000)
|
informationContainer.waitForElementVisible("@title", 5000)
|
||||||
.assert.containsText("@title", "Swagger Petstore")
|
.assert.containsText("@title", "Swagger Petstore")
|
||||||
.assert.containsText("@version", "1.0.0")
|
.assert.containsText("@version", "1.0.0")
|
||||||
|
|
||||||
client.end()
|
client.end()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("renders base url", function (client) {
|
||||||
|
informationContainer.waitForElementVisible("@baseUrl", 5000)
|
||||||
|
.assert.containsText("@baseUrl", "[ Base url: petstore.swagger.io/v2]")
|
||||||
|
|
||||||
|
client.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
it("render main url", function (client) {
|
||||||
|
informationContainer.waitForElementVisible("@mainUrl", 5000)
|
||||||
|
.assert.attributeEquals("@mainUrl", "href", "http://petstore.swagger.io/v2/swagger.json")
|
||||||
|
.assert.containsText("@mainUrlContent", "http://petstore.swagger.io/v2/swagger.json")
|
||||||
|
|
||||||
|
client.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
it("render description", function (client) {
|
||||||
|
informationContainer.waitForElementVisible("@description", 5000)
|
||||||
|
.assert.containsText("@description", "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key special-key to test the authorization filters.")
|
||||||
|
.assert.attributeEquals("@swaggerUrl", "href", "http://swagger.io/")
|
||||||
|
.assert.attributeEquals("@swaggerircUrl", "href", "http://swagger.io/irc/")
|
||||||
|
|
||||||
|
client.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
it("render terms-of-service", function (client) {
|
||||||
|
informationContainer.waitForElementVisible("@termsLink", 5000)
|
||||||
|
.assert.attributeEquals("@termsLink", "href", "http://swagger.io/terms/")
|
||||||
|
.assert.containsText("@termsLink", "Terms of service")
|
||||||
|
|
||||||
|
client.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
it("render contact-the-developer", function (client) {
|
||||||
|
informationContainer.waitForElementVisible("@contactDevLink", 5000)
|
||||||
|
.assert.attributeEquals("@contactDevLink", "href", "mailto:apiteam@swagger.io")
|
||||||
|
.assert.containsText("@contactDevLink", "Contact the developer")
|
||||||
|
|
||||||
|
client.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
it("render apache", function (client) {
|
||||||
|
informationContainer.waitForElementVisible("@apacheLink", 5000)
|
||||||
|
.assert.attributeEquals("@apacheLink", "href", "http://www.apache.org/licenses/LICENSE-2.0.html")
|
||||||
|
.assert.containsText("@apacheLink", "Apache 2.0")
|
||||||
|
|
||||||
|
client.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
it("render about swagger", function (client) {
|
||||||
|
informationContainer.waitForElementVisible("@aboutSwaggerLink", 5000)
|
||||||
|
.assert.attributeEquals("@aboutSwaggerLink", "href", "http://swagger.io/")
|
||||||
|
.assert.containsText("@aboutSwaggerLink", "Find out more about Swagger")
|
||||||
|
|
||||||
|
client.end()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user