api
This commit is contained in:
@ -0,0 +1,42 @@
|
||||
describe("bug #4196: HTTP basic auth credential retention", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4196.yaml")
|
||||
.click("button.download-url-button")
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("should display the most recent auth data across modal close/opens", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.click("button.btn.authorize") // Open modal
|
||||
.waitForElementVisible("section>input", 5000)
|
||||
.setValue("section>input", "aaa") // Set user
|
||||
.waitForElementVisible(`section>input[type="password"]`, 5000)
|
||||
.setValue(`section>input[type="password"]`, "aaa") // Set password
|
||||
.click(".auth-btn-wrapper button:nth-child(1)") // Click Authorize
|
||||
.assert.containsText("div.wrapper:nth-child(4)>code", "aaa")
|
||||
.click(".auth-btn-wrapper button:nth-child(2)") // Close modal
|
||||
.pause(50)
|
||||
.click("button.btn.authorize") // Open modal
|
||||
.pause(50)
|
||||
.click(".auth-btn-wrapper button:nth-child(1)") // Logout
|
||||
.waitForElementVisible("section>input", 5000)
|
||||
.setValue("section>input", "bbb") // Set user
|
||||
.waitForElementVisible(`section>input[type="password"]`, 5000)
|
||||
.setValue(`section>input[type="password"]`, "bbb") // Set password
|
||||
.click(".auth-btn-wrapper button:nth-child(1)") // Click Authorize
|
||||
.pause(1000)
|
||||
.assert.containsText("div.wrapper:nth-child(4)>code", "bbb")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,31 @@
|
||||
describe("bug #4374: OAS3 parameters should be visibly validated in Try-It-Out", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 10000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/bugs/4374.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("indicates an error when a required parameter is not selected", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/pet/findByStatus")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.click(".try-out__btn")
|
||||
.click(".btn.execute")
|
||||
.pause(100)
|
||||
.assert.cssClassPresent(".parameters-col_description select", "invalid")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,28 @@
|
||||
describe("bug #4409: operationId normalization and layout tracking", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4409.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("expands an operation that has a normalizable operationId", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/myApi")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock-body", 5000)
|
||||
.assert.cssClassPresent(".opblock", "is-open")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,28 @@
|
||||
describe("bug #4409: operationId normalization and layout tracking", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4409.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("expands an operation that has a normalizable operationId", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/myApi")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock-body", 5000)
|
||||
.assert.cssClassPresent(".opblock", "is-open")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,28 @@
|
||||
describe("bug #4409: operationId normalization and layout tracking", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4409.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("expands an operation that has a normalizable operationId", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/myApi")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock-body", 5000)
|
||||
.assert.cssClassPresent(".opblock", "is-open")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,28 @@
|
||||
describe("bug #4536: model name consistency", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4536.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("consistently displays a model's name regardless of expansion state", function (client) {
|
||||
client.waitForElementVisible("span.model.model-title", 10000)
|
||||
.assert.containsText("span.model.model-title", "TitleName")
|
||||
.click("span.model.model-title")
|
||||
.pause(500)
|
||||
.assert.containsText("span.model-title__text", "TitleName")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,35 @@
|
||||
describe("bug #4587: clearing header param values", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4587.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
|
||||
it("sets a required initial value based the first enum value", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.click("#operations-sql-execSql")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.setValue(`tr[data-param-name="x-irest-conn"] input`, "hi")
|
||||
.click("button.btn.execute")
|
||||
.waitForElementVisible(".request-url", 2000)
|
||||
.setValue(`tr[data-param-name="x-irest-conn"] input`, `\u0008\u0008\u0008`) // backspaces
|
||||
.pause(900)
|
||||
.click("button.btn.execute")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.not.contain(`x-irest-conn`)
|
||||
})
|
||||
})
|
@ -0,0 +1,42 @@
|
||||
describe("bug #4756: enum initial values", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4756.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
|
||||
it("sets a required initial value based the first enum value", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.click("#operations-default-post_zero")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.click("button.btn.execute")
|
||||
.waitForElementVisible(".request-url", 2000)
|
||||
.assert.containsText(".request-url > pre", "http://www.example.com/test/API/zero?one=0")
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("sets a required initial value based on a default value", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.click("#operations-default-post_one")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.click("button.btn.execute")
|
||||
.waitForElementVisible(".request-url", 2000)
|
||||
.assert.containsText(".request-url > pre", "http://www.example.com/test/API/one?one=1")
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,44 @@
|
||||
describe("bug: unable to change array input", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/bugs/frozen-array-input.yaml")
|
||||
.click("button.download-url-button")
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("consistently displays a model's name regardless of expansion state", function (client) {
|
||||
client.waitForElementVisible(".opblock-summary-description", 10000)
|
||||
.assert.containsText("span.opblock-summary-path > a > span", "/test")
|
||||
.click("#operations-default-get_test")
|
||||
.pause(500)
|
||||
.click("button.btn.try-out__btn")
|
||||
.elements("css selector", ".json-schema-form-item", function (result) {
|
||||
this.assert.equal(result.value.length, 2, "initial number of array item inputs")
|
||||
})
|
||||
.click(".json-schema-form-item-add")
|
||||
.elements("css selector", ".json-schema-form-item", function (result) {
|
||||
this.assert.equal(result.value.length, 3, "number of array item inputs after clicking add")
|
||||
})
|
||||
.click(".json-schema-form-item-remove")
|
||||
.click(".json-schema-form-item-remove")
|
||||
.click(".json-schema-form-item-remove")
|
||||
.elements("css selector", ".json-schema-form-item", function (result) {
|
||||
this.assert.equal(result.value.length, 0, "number of array item inputs after removing all items")
|
||||
})
|
||||
.click(".json-schema-form-item-add")
|
||||
.setValue(".json-schema-form-item input", "myValue123")
|
||||
.click("button.execute")
|
||||
.pause(100)
|
||||
.assert.containsText(".request-url pre", "http://localhost:3230/test?fields=myValue123")
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,433 @@
|
||||
describe("feature: OpenAPI 3 allowEmptyValue", function () {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/features/allow-empty-value.openapi.yaml")
|
||||
.click("button.download-url-button")
|
||||
.waitForElementVisible(".opblock", 10000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
|
||||
describe("regular parameters", function () {
|
||||
it("should set and unset an integer value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="int"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset a string value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="str"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset a number value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="num"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset a boolean value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="bool"] select`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} [value="true"]`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} [value=""]`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset an array value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} .json-schema-form-item-add`)
|
||||
.setValue(`${inputSelector} input`, "asdf")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} .json-schema-form-item-remove`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
})
|
||||
|
||||
describe("allowEmptyValue parameters", function () {
|
||||
describe("normal behavior", function () {
|
||||
it("should set and unset an integer value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="int"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset a string value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="str"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset a number value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="num"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset a boolean value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="bool"] select`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} [value="true"]`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} [value=""]`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset an array value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} .json-schema-form-item-add`)
|
||||
.setValue(`${inputSelector} input`, "asdf")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} .json-schema-form-item-remove`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
})
|
||||
describe("send empty initial value behavior", function () {
|
||||
it("should send an empty integer value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="int"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?int="`)
|
||||
})
|
||||
it("should send an empty string value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="str"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?str="`)
|
||||
})
|
||||
it("should send an empty number value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="num"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?num="`)
|
||||
})
|
||||
it("should send an empty boolean value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="bool"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?bool="`)
|
||||
})
|
||||
it("should send an empty array value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?arr="`)
|
||||
})
|
||||
})
|
||||
describe("modify and send empty behavior", function () {
|
||||
it("should set, unset and send an empty integer value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="int"]`
|
||||
const inputSelector = `${paramSelector} input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?int="`)
|
||||
})
|
||||
it("should set, unset and send an empty string value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="str"]`
|
||||
const inputSelector = `${paramSelector} input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?str="`)
|
||||
})
|
||||
it("should set, unset and send an empty number value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="num"]`
|
||||
const inputSelector = `${paramSelector} input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?num="`)
|
||||
})
|
||||
it("should set, unset and send an empty boolean value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="bool"]`
|
||||
const inputSelector = `${paramSelector} select`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} option[value="true"]`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.click(`${inputSelector} option[value=""]`)
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?bool="`)
|
||||
})
|
||||
it("should set, unset and send an empty array value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${paramSelector} .json-schema-form-item-add`)
|
||||
.setValue(`${paramSelector} input`, "asdf")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${paramSelector} .json-schema-form-item-remove`)
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?arr="`)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,433 @@
|
||||
describe("feature: Swagger 2 allowEmptyValue", function () {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/features/allow-empty-value.swagger.yaml")
|
||||
.click("button.download-url-button")
|
||||
.waitForElementVisible(".opblock", 10000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
|
||||
describe("regular parameters", function () {
|
||||
it("should set and unset an integer value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="int"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset a string value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="str"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset a number value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="num"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset a boolean value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="bool"] select`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} [value="true"]`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} [value=""]`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset an array value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} .json-schema-form-item-add`)
|
||||
.setValue(`${inputSelector} input`, "asdf")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} .json-schema-form-item-remove`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
})
|
||||
|
||||
describe("allowEmptyValue parameters", function () {
|
||||
describe("normal behavior", function () {
|
||||
it("should set and unset an integer value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="int"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset a string value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="str"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset a number value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="num"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset a boolean value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="bool"] select`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} [value="true"]`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} [value=""]`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset an array value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} .json-schema-form-item-add`)
|
||||
.setValue(`${inputSelector} input`, "asdf")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} .json-schema-form-item-remove`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
})
|
||||
describe("send empty inital value behavior", function () {
|
||||
it("should send an empty integer value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="int"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?int="`)
|
||||
})
|
||||
it("should send an empty string value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="str"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?str="`)
|
||||
})
|
||||
it("should send an empty number value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="num"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?num="`)
|
||||
})
|
||||
it("should send an empty boolean value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="bool"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?bool="`)
|
||||
})
|
||||
it("should send an empty array value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?arr="`)
|
||||
})
|
||||
})
|
||||
describe("modify and send empty behavior", function () {
|
||||
it("should set, unset and send an empty integer value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="int"]`
|
||||
const inputSelector = `${paramSelector} input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?int="`)
|
||||
})
|
||||
it("should set, unset and send an empty string value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="str"]`
|
||||
const inputSelector = `${paramSelector} input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?str="`)
|
||||
})
|
||||
it("should set, unset and send an empty number value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="num"]`
|
||||
const inputSelector = `${paramSelector} input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?num="`)
|
||||
})
|
||||
it("should set, unset and send an empty boolean value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="bool"]`
|
||||
const inputSelector = `${paramSelector} select`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} option[value="true"]`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.click(`${inputSelector} option[value=""]`)
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?bool="`)
|
||||
})
|
||||
it("should set, unset and send an empty array value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${paramSelector} .json-schema-form-item-add`)
|
||||
.setValue(`${paramSelector} input`, "asdf")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${paramSelector} .json-schema-form-item-remove`)
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?arr="`)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,240 @@
|
||||
const dedent = require("dedent")
|
||||
|
||||
describe("feature: `example` field support", function () {
|
||||
|
||||
describe("Swagger 2", function() {
|
||||
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/features/example.swagger.yaml")
|
||||
.click("button.download-url-button")
|
||||
.waitForElementVisible(".opblock", 10000)
|
||||
.click("#operations-default-put_one")
|
||||
.waitForElementVisible("#operations-default-put_one.is-open", 5000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
|
||||
// Parameters
|
||||
// Supports complex root `example` values in Schema objects for bodies
|
||||
// Supports nested `example` values in Schema objects for bodies
|
||||
|
||||
describe("primitive parameters", function() {
|
||||
it("should respect a primitive x-example value", function (client) {
|
||||
client
|
||||
.click("button.try-out__btn")
|
||||
.assert.value(
|
||||
`tr[data-param-name="ValidParam"] input[type="text"]`,
|
||||
`12345`
|
||||
)
|
||||
})
|
||||
it("should ignore a primitive example value", function (client) {
|
||||
client
|
||||
.click("button.try-out__btn")
|
||||
.assert.value(
|
||||
`tr[data-param-name="NotValidParam"] input[type="text"]`,
|
||||
``
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("object parameters", function() {
|
||||
it("should correctly consider property-level schema examples", function(client) {
|
||||
client.assert.containsText(`div[data-param-name="body"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"one": "hello!",
|
||||
"two": {
|
||||
"uno": "wow!",
|
||||
"dos": "hey there!"
|
||||
}
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider root schema-level schema examples", function(client) {
|
||||
client.assert.containsText(`div[data-param-name="body2"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"foo": "hey",
|
||||
"bar": 123
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider nested schema-level schema examples", function(client) {
|
||||
client.assert.containsText(`div[data-param-name="body3"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"one": {
|
||||
"uno": "woohoo!",
|
||||
"dos": "amazing!"
|
||||
}
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("responses", function() {
|
||||
it("should correctly consider schema-level examples", function (client) {
|
||||
client.assert.containsText(`tr.response[data-code="201"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"code": 201,
|
||||
"payload": [
|
||||
{
|
||||
"id": 1,
|
||||
"code": "AE2",
|
||||
"name": "Yono"
|
||||
}
|
||||
]
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider property-level examples", function (client) {
|
||||
client.assert.containsText(`tr.response[data-code="202"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"code": 202,
|
||||
"payload": [
|
||||
{
|
||||
"id": 1,
|
||||
"code": "AE2",
|
||||
"name": "Yono"
|
||||
}
|
||||
]
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
describe("OpenAPI 3.0", function() {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/features/example.openapi.yaml")
|
||||
.click("button.download-url-button")
|
||||
.waitForElementVisible(".opblock-summary-description", 10000)
|
||||
.click("#operations-agent-editAgent")
|
||||
.waitForElementVisible("#operations-agent-editAgent.is-open", 5000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
describe("parameters", function() {
|
||||
it("should respect a primitive example value", function(client) {
|
||||
client
|
||||
.click("button.try-out__btn")
|
||||
.assert.value(
|
||||
`div.parameters-container > div > table > tbody > tr > td.col.parameters-col_description > input[type="text"]`,
|
||||
`12345`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("request bodies", function() {
|
||||
it("should correctly consider media type-level examples", function (client) {
|
||||
client
|
||||
.click(`select.content-type option[value="application/json_media-type-level"]`)
|
||||
.assert.containsText(`pre.body-param__example`,
|
||||
dedent(`
|
||||
{
|
||||
"code": "AE1",
|
||||
"name": "Andrew"
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider schema-level examples", function (client) {
|
||||
client
|
||||
.click(`select.content-type option[value="application/json_schema-level"]`)
|
||||
.assert.containsText(`pre.body-param__example`,
|
||||
dedent(`
|
||||
{
|
||||
"code": "AE1",
|
||||
"name": "Andrew"
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider property-level examples", function (client) {
|
||||
client
|
||||
.click(`select.content-type option[value="application/json_property-level"]`)
|
||||
.assert.containsText(`pre.body-param__example`,
|
||||
dedent(`
|
||||
{
|
||||
"code": "AE1",
|
||||
"name": "Andrew"
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
})
|
||||
describe("responses", function() {
|
||||
it("should correctly consider media type-level examples", function (client) {
|
||||
client.assert.containsText(`tr.response[data-code="200"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"code": 200,
|
||||
"payload": [
|
||||
{
|
||||
"id": 1,
|
||||
"code": "AE2",
|
||||
"name": "Yono"
|
||||
}
|
||||
]
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider schema-level examples", function (client) {
|
||||
client.assert.containsText(`tr.response[data-code="201"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"code": 201,
|
||||
"payload": [
|
||||
{
|
||||
"id": 1,
|
||||
"code": "AE2",
|
||||
"name": "Yono"
|
||||
}
|
||||
]
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider property-level examples", function (client) {
|
||||
client.assert.containsText(`tr.response[data-code="202"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"code": 202,
|
||||
"payload": [
|
||||
{
|
||||
"id": 1,
|
||||
"code": "AE2",
|
||||
"name": "Yono"
|
||||
}
|
||||
]
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,58 @@
|
||||
describe("parameter enum rendering", function () {
|
||||
describe("swagger 2.0", () => {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.waitForElementVisible(".download-url-input", 10000)
|
||||
.pause(1000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/features/parameter-enum-rendering.swagger.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("reveals a string parameter's enums and defaults when viewing that parameter", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/report")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.pause(500)
|
||||
.assert.containsText("div.parameter__enum", "today, yesterday, lastweek")
|
||||
.assert.containsText("div.parameter__default", "today")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
describe("openapi 3.0", () => {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.waitForElementVisible(".download-url-input", 10000)
|
||||
.pause(1000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/features/parameter-enum-rendering.openapi.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("reveals a string parameter's enums and defaults when viewing that parameter", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/report")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.pause(500)
|
||||
.assert.containsText("div.parameter__enum", "today, yesterday, lastweek")
|
||||
.assert.containsText("div.parameter__default", "today")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,64 @@
|
||||
describe("parameter example rendering", function () {
|
||||
describe("swagger 2.0", () => {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/features/example.swagger.yaml")
|
||||
.click("button.download-url-button")
|
||||
.waitForElementVisible(".opblock", 10000)
|
||||
.click("#operations-default-put_one")
|
||||
.waitForElementVisible("#operations-default-put_one.is-open", 5000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("reveals a string parameter's example when viewing that parameter", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/one")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.pause(500)
|
||||
.assert.containsText(`tr[data-param-name="ValidParam"]`, `12345`)
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
})
|
||||
describe("openapi 3.0", () => {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/features/example.openapi.yaml")
|
||||
.click("button.download-url-button")
|
||||
.waitForElementVisible(".opblock-summary-description", 10000)
|
||||
.click("#operations-agent-editAgent")
|
||||
.waitForElementVisible("#operations-agent-editAgent.is-open", 5000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("reveals a string parameter's example when viewing that parameter", function (client) {
|
||||
it("should respect a primitive example value", function(client) {
|
||||
client
|
||||
.assert.value(
|
||||
`div.parameters-container > div > table > tbody > tr > td.col.parameters-col_description > input[type="text"]`,
|
||||
`12345`
|
||||
)
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,78 @@
|
||||
describe("Render Model Wrapper", function () {
|
||||
let modelWrapper, mainPage
|
||||
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.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("Render model wrapper collapse", function (client) {
|
||||
modelWrapper.waitForElementVisible("@modelContainer", 5000)
|
||||
.click("@modelCollapse")
|
||||
.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()
|
||||
})
|
||||
})
|
78
frontend/web/api-doc/test/e2e-selenium/scenarios/models.js
Normal file
78
frontend/web/api-doc/test/e2e-selenium/scenarios/models.js
Normal file
@ -0,0 +1,78 @@
|
||||
describe("Render Model Wrapper", function () {
|
||||
let modelWrapper, mainPage
|
||||
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.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("Render model wrapper collapse", function (client) {
|
||||
modelWrapper.waitForElementVisible("@modelContainer", 5000)
|
||||
.click("@modelCollapse")
|
||||
.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()
|
||||
})
|
||||
})
|
@ -0,0 +1,40 @@
|
||||
describe("render pet api container", function () {
|
||||
let mainPage
|
||||
let apiWrapper
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/callbacks.openapi.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
apiWrapper = mainPage.section.apiWrapper
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
describe("POST /pet", () => {
|
||||
it("should render a callback correctly", function (client) {
|
||||
apiWrapper.waitForElementVisible("#operations-pet-addPet", 10000)
|
||||
// Expand the operation
|
||||
.click("#operations-pet-addPet")
|
||||
.waitForElementVisible("#operations-pet-addPet > div:nth-child(2) > div", 5000)
|
||||
// Switch to Callbacks tab
|
||||
.click("#operations-pet-addPet div.tab-header > div.tab-item.false > h4 > span")
|
||||
.waitForElementVisible("#operations-pet-addPet div.callbacks-container", 5000)
|
||||
.assert.containsText("#operations--post_request_body__url > div > span.opblock-summary-path", "$request.body#/url")
|
||||
.click("#operations--post_request_body__url")
|
||||
.waitForElementVisible("#operations--post_request_body__url div.response-col_description__inner > div > div > p", 5000)
|
||||
.assert.containsText("#operations--post_request_body__url div.response-col_description__inner > div > div > p", "webhook successfully processed and no retries will be performed")
|
||||
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
})
|
52
frontend/web/api-doc/test/e2e-selenium/scenarios/oas3/pet.js
Normal file
52
frontend/web/api-doc/test/e2e-selenium/scenarios/oas3/pet.js
Normal file
@ -0,0 +1,52 @@
|
||||
describe("render pet api container", function () {
|
||||
let mainPage
|
||||
let apiWrapper
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.openapi.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
apiWrapper = mainPage.section.apiWrapper
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
describe("GET /pet/{petId}", () => {
|
||||
it("should render Try-It-Out flow correctly", function (client) {
|
||||
apiWrapper.waitForElementVisible("#operations-pet-updatePetWithForm", 10000)
|
||||
.assert.containsText("#operations-pet-updatePetWithForm > div > span.opblock-summary-path > a > span", "/pet")
|
||||
.click("#operations-pet-updatePetWithForm")
|
||||
.waitForElementVisible("#operations-pet-updatePetWithForm > div:nth-child(2) > div", 5000)
|
||||
.click("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.opblock-section > div.opblock-section-header > div.try-out > button")
|
||||
.waitForElementVisible("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button", 1000)
|
||||
.click("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button")
|
||||
.assert.cssClassNotPresent("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("should have stable input values", function (client) {
|
||||
client.waitForElementVisible("#operations-pet-updatePetWithForm", 10000)
|
||||
.assert.containsText("#operations-pet-updatePetWithForm > div > span.opblock-summary-path > a > span", "/pet")
|
||||
.click("#operations-pet-updatePetWithForm")
|
||||
.waitForElementVisible("#operations-pet-updatePetWithForm > div:nth-child(2) > div", 5000)
|
||||
.click("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.opblock-section > div.opblock-section-header > div.try-out > button")
|
||||
.waitForElementVisible("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button", 1000)
|
||||
.setValue("#operations-pet-updatePetWithForm td.parameters-col_description > input", "12345")
|
||||
.click("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button")
|
||||
.pause(800) // for swagger-api/swagger-ui#4269, which happens above 350ms
|
||||
.assert.containsText("#operations-pet-updatePetWithForm div.responses-inner > div > div > div:nth-child(2) > div > pre", "http://localhost:3204/pet/12345")
|
||||
.assert.value("#operations-pet-updatePetWithForm td.parameters-col_description > input", "12345")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,28 @@
|
||||
const expect = require("expect")
|
||||
|
||||
describe("onComplete option", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.pause(80)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.json")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
it("triggers the page-provided onComplete exactly 1 times", function (client, done) {
|
||||
client.execute(function() {
|
||||
return window.completeCount
|
||||
}, [], (result) => {
|
||||
expect(result.value).toEqual(1)
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,112 @@
|
||||
describe("render store api container", function () {
|
||||
let mainPage
|
||||
let apiWrapper
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.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", 5000)
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.waitForElementVisible("@storeOperationGetExecuteBtn", 1000)
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationGetTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing get /store/inventory api Mock data ", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationGetContainer", 5000)
|
||||
.assert.containsText("@storeOperationGetTitle", "/store/inventory")
|
||||
.click("@storeOperationGetCollpase")
|
||||
.waitForElementVisible("@storeOperationGetCollapseContainer", 3000)
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.waitForElementVisible("@storeOperationGetExecuteBtn", 1000)
|
||||
.click("@storeOperationGetExecuteBtn")
|
||||
.waitForElementVisible("@storeOperationResponseProps1")
|
||||
.assert.containsText("@storeOperationResponseProps1", "0")
|
||||
.assert.containsText("@storeOperationResponseProps2", "0")
|
||||
.assert.containsText("@storeOperationResponseProps3", "0")
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationGetTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("render post /store/order api container", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationPostContainer")
|
||||
.assert.containsText("@storeOperationPostTitle", "/store/order")
|
||||
.click("@storeOperationPostCollpase")
|
||||
.waitForElementVisible("@storeOperationPostCollapseContainer", 3000)
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.waitForElementVisible("@storeOperationPostExecuteBtn", 1000)
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationPostTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing post /store/order api Mock Data", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationPostContainer")
|
||||
.assert.containsText("@storeOperationPostTitle", "/store/order")
|
||||
.click("@storeOperationPostCollpase")
|
||||
.waitForElementVisible("@storeOperationPostCollapseContainer", 3000)
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.waitForElementVisible("@storeOperationPostExecuteBtn", 1000)
|
||||
.click("@storeOperationPostExecuteBtn")
|
||||
.waitForElementVisible("@storeOperationPostResponseId")
|
||||
.assert.containsText("@storeOperationPostResponseId", "0")
|
||||
.assert.containsText("@storeOperationPostResponsePetId", "0")
|
||||
.assert.containsText("@storeOperationPostResponseQuantity", "0")
|
||||
.assert.containsText("@storeOperationPostResponseStatus", "placed")
|
||||
.assert.containsText("@storeOperationPostResponseComplete", "false")
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationPostTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("render delete /store/order/{orderId} api container", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationDeleteContainer")
|
||||
.assert.containsText("@storeOperationDeleteTitle", "/store/order/{orderId}")
|
||||
.click("@storeOperationDeleteCollpase")
|
||||
.waitForElementVisible("@storeOperationDeleteCollapseContainer", 3000)
|
||||
.click("@storeOperationDeleteTryBtn")
|
||||
.waitForElementVisible("@storeOperationDeleteExecuteBtn", 1000)
|
||||
.click("@storeOperationDeleteExecuteBtn")
|
||||
.waitForElementVisible("@storeOperationGetResponseHeaders", "content-type: application/xml")
|
||||
.click("@storeOperationDeleteTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationDeleteTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,112 @@
|
||||
describe("render store api container", function () {
|
||||
let mainPage
|
||||
let apiWrapper
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.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", 5000)
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.waitForElementVisible("@storeOperationGetExecuteBtn", 1000)
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationGetTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing get /store/inventory api Mock data ", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationGetContainer", 5000)
|
||||
.assert.containsText("@storeOperationGetTitle", "/store/inventory")
|
||||
.click("@storeOperationGetCollpase")
|
||||
.waitForElementVisible("@storeOperationGetCollapseContainer", 3000)
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.waitForElementVisible("@storeOperationGetExecuteBtn", 1000)
|
||||
.click("@storeOperationGetExecuteBtn")
|
||||
.waitForElementVisible("@storeOperationResponseProps1")
|
||||
.assert.containsText("@storeOperationResponseProps1", "0")
|
||||
.assert.containsText("@storeOperationResponseProps2", "0")
|
||||
.assert.containsText("@storeOperationResponseProps3", "0")
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationGetTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("render post /store/order api container", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationPostContainer")
|
||||
.assert.containsText("@storeOperationPostTitle", "/store/order")
|
||||
.click("@storeOperationPostCollpase")
|
||||
.waitForElementVisible("@storeOperationPostCollapseContainer", 3000)
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.waitForElementVisible("@storeOperationPostExecuteBtn", 1000)
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationPostTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing post /store/order api Mock Data", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationPostContainer")
|
||||
.assert.containsText("@storeOperationPostTitle", "/store/order")
|
||||
.click("@storeOperationPostCollpase")
|
||||
.waitForElementVisible("@storeOperationPostCollapseContainer", 3000)
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.waitForElementVisible("@storeOperationPostExecuteBtn", 1000)
|
||||
.click("@storeOperationPostExecuteBtn")
|
||||
.waitForElementVisible("@storeOperationPostResponseId")
|
||||
.assert.containsText("@storeOperationPostResponseId", "0")
|
||||
.assert.containsText("@storeOperationPostResponsePetId", "0")
|
||||
.assert.containsText("@storeOperationPostResponseQuantity", "0")
|
||||
.assert.containsText("@storeOperationPostResponseStatus", "placed")
|
||||
.assert.containsText("@storeOperationPostResponseComplete", "false")
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationPostTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("render delete /store/order/{orderId} api container", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationDeleteContainer")
|
||||
.assert.containsText("@storeOperationDeleteTitle", "/store/order/{orderId}")
|
||||
.click("@storeOperationDeleteCollpase")
|
||||
.waitForElementVisible("@storeOperationDeleteCollapseContainer", 3000)
|
||||
.click("@storeOperationDeleteTryBtn")
|
||||
.waitForElementVisible("@storeOperationDeleteExecuteBtn", 1000)
|
||||
.click("@storeOperationDeleteExecuteBtn")
|
||||
.waitForElementVisible("@storeOperationGetResponseHeaders", "content-type: application/xml")
|
||||
.click("@storeOperationDeleteTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationDeleteTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,78 @@
|
||||
describe("Render Model Wrapper", function () {
|
||||
let modelWrapper, mainPage
|
||||
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.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("Render model wrapper collapse", function (client) {
|
||||
modelWrapper.waitForElementVisible("@modelContainer", 5000)
|
||||
.click("@modelCollapse")
|
||||
.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()
|
||||
})
|
||||
})
|
26
frontend/web/api-doc/test/e2e-selenium/scenarios/refs.js
Normal file
26
frontend/web/api-doc/test/e2e-selenium/scenarios/refs.js
Normal file
@ -0,0 +1,26 @@
|
||||
describe("Remote $ref rendering", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
|
||||
mainPage = client
|
||||
// expand the models so we don't have to manually do it
|
||||
.url("localhost:3230?defaultModelsExpandDepth=5")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.pause(2000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/refs/api1.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
it("renders a remote $ref correctly", function (client) {
|
||||
mainPage.expect.element("#model-TestResponse > span > div > span > span > span.inner-object > table > tbody > tr:nth-child(2) > td:nth-child(2) > span > span > div > div > p").text.to.equal("this is an api2prop")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,61 @@
|
||||
describe("Render scheme", function () {
|
||||
let mainPage
|
||||
let schemeContainer
|
||||
beforeEach(function (client, done) {
|
||||
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
schemeContainer = mainPage.section.schemeContainer
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.json")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
|
||||
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")
|
||||
schemeContainer.expect.element("@readPetsScope").to.be.selected
|
||||
schemeContainer.expect.element("@writePetsScope").to.not.be.selected
|
||||
|
||||
schemeContainer.click("@selectAllScopes")
|
||||
schemeContainer.expect.element("@readPetsScope").to.be.selected
|
||||
schemeContainer.expect.element("@writePetsScope").to.be.selected
|
||||
|
||||
schemeContainer.click("@selectNoneScopes")
|
||||
schemeContainer.expect.element("@readPetsScope").to.not.be.selected
|
||||
schemeContainer.expect.element("@writePetsScope").to.not.be.selected
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
51
frontend/web/api-doc/test/e2e-selenium/scenarios/topbar.js
Normal file
51
frontend/web/api-doc/test/e2e-selenium/scenarios/topbar.js
Normal file
@ -0,0 +1,51 @@
|
||||
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:3230")
|
||||
.page.main()
|
||||
|
||||
topbar = mainPage.section.topbar
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 10000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.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()
|
||||
})
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user