api
This commit is contained in:
37
frontend/web/api-doc/test/e2e-cypress/tests/bugs/4442.js
Normal file
37
frontend/web/api-doc/test/e2e-cypress/tests/bugs/4442.js
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
describe("UI #4442: Parameter.content display and execution", function() {
|
||||
it("should display textareas as static documentation according to the `example`", () => {
|
||||
cy.visit("/?url=/documents/bugs/4442.yaml")
|
||||
.get(`#operations-default-get_`)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(
|
||||
`div.json-schema-array > div:nth-child(1) > div > textarea`
|
||||
)
|
||||
.should("have.value", `{\n "userId": 1,\n "currency": "USD"\n}`)
|
||||
.get(
|
||||
`div.json-schema-array > div:nth-child(2) > div > textarea`
|
||||
)
|
||||
.should("have.value", `{\n "userId": 2,\n "currency": "CAD"\n}`)
|
||||
})
|
||||
it("should serialize JSON into a query correctly", () => {
|
||||
cy.visit("/?url=/documents/bugs/4442.yaml")
|
||||
.get(`#operations-default-get_`)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should(
|
||||
"have.text",
|
||||
`http://localhost:3230/?users=${encodeURIComponent(
|
||||
`[{"userId":1,"currency":"USD"},{"userId":2,"currency":"CAD"}]`
|
||||
)}`
|
||||
)
|
||||
})
|
||||
})
|
99
frontend/web/api-doc/test/e2e-cypress/tests/bugs/4641.js
Normal file
99
frontend/web/api-doc/test/e2e-cypress/tests/bugs/4641.js
Normal file
@ -0,0 +1,99 @@
|
||||
const clickTryItOutAndExecute = () => {
|
||||
return cy
|
||||
.get(".btn.try-out__btn") // expand "try it out"
|
||||
.click()
|
||||
.get(".btn.execute") // execute request
|
||||
.click()
|
||||
}
|
||||
|
||||
const fillInApiKeyAndAuthorise = apiKey => () => {
|
||||
return cy
|
||||
.get("section>input") // type api key into input
|
||||
.type(apiKey)
|
||||
.get(".auth-btn-wrapper > .authorize") // authorise button
|
||||
.click()
|
||||
}
|
||||
|
||||
const clickLogoutAndReauthorise = () => {
|
||||
return cy
|
||||
.get(".auth-btn-wrapper button:nth-child(1)") // logout button
|
||||
.click()
|
||||
.get(".auth-btn-wrapper > .authorize") // authorise button
|
||||
.click()
|
||||
}
|
||||
|
||||
describe("#4641: The Logout button in Authorize popup not clearing API Key", () => {
|
||||
beforeEach(() => {
|
||||
cy.server()
|
||||
cy
|
||||
.route({
|
||||
url: "/4641*",
|
||||
response: "OK",
|
||||
})
|
||||
.as("request")
|
||||
})
|
||||
|
||||
it("should include the given api key in requests", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/4641.yaml")
|
||||
.get("button.btn.authorize") // open authorize popup
|
||||
.click()
|
||||
.get(".modal-ux-content > :nth-child(1)") // only deal with api_key_1 for this test
|
||||
.within(fillInApiKeyAndAuthorise("my_api_key"))
|
||||
.get(".close-modal") // close authorise popup button
|
||||
.click()
|
||||
.get("#operations-default-get_4641_1") // expand the route details onClick
|
||||
.click()
|
||||
.within(clickTryItOutAndExecute)
|
||||
.wait("@request")
|
||||
.its("request")
|
||||
.then((req) => {
|
||||
expect(req.headers, "request headers").to.have.property("api_key_1", "my_api_key")
|
||||
})
|
||||
})
|
||||
|
||||
it("should not remember the previous auth value when you logout and reauthorise", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/4641.yaml")
|
||||
.get("button.btn.authorize") // open authorize popup
|
||||
.click()
|
||||
.get(".modal-ux-content > :nth-child(1)") // only deal with api_key_1 for this test
|
||||
.within(fillInApiKeyAndAuthorise("my_api_key"))
|
||||
.get(".modal-ux-content > :nth-child(1)") // only deal with api_key_1 for this test
|
||||
.within(clickLogoutAndReauthorise)
|
||||
.get(".close-modal") // close authorise popup button
|
||||
.click()
|
||||
.get("#operations-default-get_4641_1") // expand the route details onClick
|
||||
.click()
|
||||
.within(clickTryItOutAndExecute)
|
||||
.wait("@request")
|
||||
.its("request")
|
||||
.then((req) => {
|
||||
expect(req.headers, "request headers").not.to.have.property("api_key_1")
|
||||
})
|
||||
})
|
||||
|
||||
it("should only forget the value of the auth the user logged out from", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/4641.yaml")
|
||||
.get("button.btn.authorize") // open authorize popup
|
||||
.click()
|
||||
.get(".modal-ux-content > :nth-child(1)") // deal with api_key_1
|
||||
.within(fillInApiKeyAndAuthorise("my_api_key"))
|
||||
.get(".modal-ux-content > :nth-child(2)") // deal with api_key_2
|
||||
.within(fillInApiKeyAndAuthorise("my_second_api_key"))
|
||||
.get(".modal-ux-content > :nth-child(1)") // deal with api_key_1 again
|
||||
.within(clickLogoutAndReauthorise)
|
||||
.get(".close-modal") // close authorise popup button
|
||||
.click()
|
||||
.get("#operations-default-get_4641_2") // expand the route details onClick
|
||||
.click()
|
||||
.within(clickTryItOutAndExecute)
|
||||
.wait("@request")
|
||||
.its("request")
|
||||
.then((req) => {
|
||||
expect(req.headers, "request headers").not.to.have.property("api_key_1")
|
||||
expect(req.headers, "request headers").to.have.property("api_key_2", "my_second_api_key")
|
||||
})
|
||||
})
|
||||
})
|
11
frontend/web/api-doc/test/e2e-cypress/tests/bugs/4838.js
Normal file
11
frontend/web/api-doc/test/e2e-cypress/tests/bugs/4838.js
Normal file
@ -0,0 +1,11 @@
|
||||
import repeat from "lodash/repeat"
|
||||
|
||||
describe("#4838: empty request bodies result in endless loading", () => {
|
||||
it("should render model content changes correctly", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/4838.yaml")
|
||||
.get("#operations-Some-post_some_route")
|
||||
.click()
|
||||
.contains("This should be visible")
|
||||
})
|
||||
})
|
19
frontend/web/api-doc/test/e2e-cypress/tests/bugs/4865.js
Normal file
19
frontend/web/api-doc/test/e2e-cypress/tests/bugs/4865.js
Normal file
@ -0,0 +1,19 @@
|
||||
describe("#4865: multiple invocations + OAS3 plugin", () => {
|
||||
it("control: should render the OAS3 badge correctly", () => {
|
||||
// This is a sanity check to make sure the badge is present.
|
||||
// If this is failing, it's probably not related to #4865.
|
||||
cy.visit("/?url=/documents/petstore-expanded.openapi.yaml")
|
||||
.get("#swagger-ui")
|
||||
.get("pre.version")
|
||||
.contains("OAS3")
|
||||
})
|
||||
|
||||
it("test: should render the OAS3 badge correctly after re-initializing the UI", () => {
|
||||
cy.visit("/?url=/documents/petstore-expanded.openapi.yaml")
|
||||
.window()
|
||||
.then(win => win.onload()) // re-initializes Swagger UI
|
||||
.get("#swagger-ui")
|
||||
.get("pre.version")
|
||||
.contains("OAS3")
|
||||
})
|
||||
})
|
17
frontend/web/api-doc/test/e2e-cypress/tests/bugs/4867.js
Normal file
17
frontend/web/api-doc/test/e2e-cypress/tests/bugs/4867.js
Normal file
@ -0,0 +1,17 @@
|
||||
describe("#4867: callback parameter rendering", () => {
|
||||
it("should render parameters correctly", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/4867.yaml")
|
||||
.get("#operations-default-myOp")
|
||||
.click()
|
||||
.contains("Callbacks")
|
||||
.click()
|
||||
|
||||
.get(".callbacks-container .opblock-summary-path")
|
||||
.should("have.attr", "data-path", "http://$request.query.url")
|
||||
.click()
|
||||
|
||||
.get(".parameters-container")
|
||||
.contains("myParam")
|
||||
})
|
||||
})
|
20
frontend/web/api-doc/test/e2e-cypress/tests/bugs/4943.js
Normal file
20
frontend/web/api-doc/test/e2e-cypress/tests/bugs/4943.js
Normal file
@ -0,0 +1,20 @@
|
||||
describe("#4943: XML example not rendered correctly with oneOf", () => {
|
||||
it("should render integer property correctly", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/4943.yaml")
|
||||
.get("#operations-Test-postTest")
|
||||
.click()
|
||||
.get(".microlight")
|
||||
.contains("<b>0</b>")
|
||||
})
|
||||
it("should render oneOf property correctly", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/4943.yaml")
|
||||
.get("#operations-Test-postTest")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(".microlight")
|
||||
.contains("<c>\n\t</c>")
|
||||
})
|
||||
})
|
30
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5043.js
Normal file
30
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5043.js
Normal file
@ -0,0 +1,30 @@
|
||||
describe("#5043: path-level $ref path items should inherit global consumes/produces", () => {
|
||||
it("should render consumes options correctly", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5043/swagger.yaml")
|
||||
.get("#operations-pet-findPetsByStatus")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(".content-type")
|
||||
.contains("application/json")
|
||||
.get(".content-type")
|
||||
.contains("application/xml")
|
||||
.get(".content-type")
|
||||
.contains("text/csv")
|
||||
})
|
||||
it("should render produces options correctly", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5043/swagger.yaml")
|
||||
.get("#operations-pet-findPetsByStatus")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(".body-param-content-type select")
|
||||
.contains("application/json")
|
||||
.get(".body-param-content-type select")
|
||||
.contains("application/xml")
|
||||
.get(".body-param-content-type select")
|
||||
.contains("text/csv")
|
||||
})
|
||||
})
|
15
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5060.js
Normal file
15
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5060.js
Normal file
@ -0,0 +1,15 @@
|
||||
describe("#5060: unwanted smart quotes in rendered Markdown", () => {
|
||||
it("should not convert regular quotes to smart quotes", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5060.yaml")
|
||||
.get("div.description")
|
||||
.should($el => {
|
||||
const text = $el.get(0).textContent
|
||||
expect(text).to.include(`Example of a simple GET request via curl with bearer HTTP Authentication`)
|
||||
expect(text).to.include(`curl -X GET "https://foobar.com/stuff"`)
|
||||
expect(text).to.include(`-H "Accept: application/json"`)
|
||||
expect(text).to.include(`-H "Authorization: Bearer abc123.xyz.789"`)
|
||||
expect(text.indexOf(`“`)).to.equal(-1)
|
||||
})
|
||||
})
|
||||
})
|
32
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5070.js
Normal file
32
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5070.js
Normal file
@ -0,0 +1,32 @@
|
||||
describe("#5070: Required field not highlighted on click of Execute button (second time)", () => {
|
||||
it("should not clear error class=invalid on input field (Swagger)", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/petstore.swagger.yaml")
|
||||
.get("#operations-pet-getPetById")
|
||||
.click()
|
||||
// Expand Try It Out
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
// Execute without user input
|
||||
.get(".execute.opblock-control__btn")
|
||||
.click()
|
||||
.get(".parameters-col_description input")
|
||||
.should($el => {
|
||||
expect($el).to.have.length(1)
|
||||
const className = $el[0].className
|
||||
expect(className).to.match(/invalid/i)
|
||||
})
|
||||
// Cancel Try It Out
|
||||
.get(".cancel")
|
||||
.click()
|
||||
// Expand Try It Out (Again)
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(".parameters-col_description input")
|
||||
.should($el => {
|
||||
expect($el).to.have.length(1)
|
||||
const className = $el[0].className
|
||||
expect(className).to.match(/invalid/i)
|
||||
})
|
||||
})
|
||||
})
|
22
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5072.js
Normal file
22
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5072.js
Normal file
@ -0,0 +1,22 @@
|
||||
describe("#5072: x-www-form-urlencoded request body input when `properties` is missing", () => {
|
||||
it("should provide a JSON input for an empty object schema", () => {
|
||||
cy
|
||||
.visit("?url=/documents/bugs/5072/empty.yaml")
|
||||
.get("#operations-default-postObject")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(`.opblock-section-request-body textarea`)
|
||||
.should("have.value", "{}")
|
||||
})
|
||||
it("should provide a JSON input for an additionalProperties object schema", () => {
|
||||
cy
|
||||
.visit("?url=/documents/bugs/5072/additional.yaml")
|
||||
.get("#operations-default-postObject")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(`.opblock-section-request-body textarea`)
|
||||
.contains(`"additionalProp1": "string"`)
|
||||
})
|
||||
})
|
121
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5129.js
Normal file
121
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5129.js
Normal file
@ -0,0 +1,121 @@
|
||||
describe("#5129: parameter required + allowEmptyValue interactions", () => {
|
||||
describe("allowEmptyValue parameter", () => {
|
||||
const opId = "#operations-default-get_aev"
|
||||
it("should omit the parameter by default", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev")
|
||||
})
|
||||
it("should include a value", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters-col_description input[type=text]`)
|
||||
.type("asdf")
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev?param=asdf")
|
||||
})
|
||||
it("should include an empty value when empty value box is checked", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters-col_description input[type=checkbox]`)
|
||||
.check()
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev?param=")
|
||||
})
|
||||
it("should include a value when empty value box is checked and then input is provided", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters-col_description input[type=checkbox]`)
|
||||
.check()
|
||||
.get(`.parameters-col_description input[type=text]`)
|
||||
.type("1234")
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev?param=1234")
|
||||
})
|
||||
})
|
||||
describe("allowEmptyValue + required parameter", () => {
|
||||
const opId = "#operations-default-get_aev_and_required"
|
||||
it("should refuse to execute by default", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.wait(1000)
|
||||
.get(".request-url pre")
|
||||
.should("not.exist")
|
||||
})
|
||||
it("should include a value", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters-col_description input[type=text]`)
|
||||
.type("asdf")
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev/and/required?param=asdf")
|
||||
})
|
||||
it("should include an empty value when empty value box is checked", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters-col_description input[type=checkbox]`)
|
||||
.check()
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev/and/required?param=")
|
||||
})
|
||||
it("should include a value when empty value box is checked and then input is provided", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/5129.yaml")
|
||||
.get(opId)
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters-col_description input[type=checkbox]`)
|
||||
.check()
|
||||
.get(`.parameters-col_description input[type=text]`)
|
||||
.type("1234")
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.get(".request-url pre")
|
||||
.should("have.text", "http://localhost:3230/aev/and/required?param=1234")
|
||||
})
|
||||
})
|
||||
})
|
10
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5138.js
Normal file
10
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5138.js
Normal file
@ -0,0 +1,10 @@
|
||||
describe("#5138: unwanted `url`/`urls` interactions", () => {
|
||||
it("should stably render the first `urls` entry", () => {
|
||||
cy
|
||||
.visit("/pages/5138/")
|
||||
.get("h2.title")
|
||||
.contains("USPTO Data Set API")
|
||||
.wait(3000)
|
||||
.contains("USPTO Data Set API")
|
||||
})
|
||||
})
|
19
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5164.js
Normal file
19
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5164.js
Normal file
@ -0,0 +1,19 @@
|
||||
describe("#5164: multipart property initial values", () => {
|
||||
it("should provide correct initial values for objects and arrays", () => {
|
||||
const correctObjectValue = JSON.stringify({
|
||||
"one": "abc",
|
||||
"two": 123
|
||||
}, null, 2)
|
||||
|
||||
cy
|
||||
.visit("?url=/documents/bugs/5164.yaml")
|
||||
.get("#operations-default-post_")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(`.parameters[data-property-name="first"] textarea`)
|
||||
.should("have.value", correctObjectValue)
|
||||
.get(`.parameters[data-property-name="second"] input`)
|
||||
.should("have.value", "hi")
|
||||
})
|
||||
})
|
18
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5188.js
Normal file
18
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5188.js
Normal file
@ -0,0 +1,18 @@
|
||||
describe("#5188: non-string operation summary value", () => {
|
||||
it("should gracefully handle an object value for an operation summary", () => {
|
||||
cy
|
||||
.visit("?url=/documents/bugs/5188.yaml")
|
||||
.get("#operations-default-objectSummary")
|
||||
.click()
|
||||
.get(".opblock-summary-description")
|
||||
.contains("[object Object]")
|
||||
})
|
||||
it("should gracefully handle a missing value for an operation summary", () => {
|
||||
cy
|
||||
.visit("?url=/documents/bugs/5188.yaml")
|
||||
.get("#operations-default-noSummary")
|
||||
.click()
|
||||
// check for response rendering; makes sure the Operation itself rendered
|
||||
.contains("Invalid input")
|
||||
})
|
||||
})
|
38
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5452.js
Normal file
38
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5452.js
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
describe("#5452: <Select /> crashing in Parameters", function() {
|
||||
describe("in OpenAPI 3", () => {
|
||||
it("should not result in a render error", function() {
|
||||
cy.visit("http://localhost:3230/?url=/documents/bugs/5452/openapi.yaml")
|
||||
.get("#operations-default-get_endpoint")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(".parameters > tbody > tr > .parameters-col_description > select")
|
||||
.select("")
|
||||
.get(".parameters > tbody > tr > .parameters-col_description > select")
|
||||
.should("exist")
|
||||
.select("fruit")
|
||||
.get(".parameters > tbody > tr > .parameters-col_description > select")
|
||||
.should("exist")
|
||||
})
|
||||
})
|
||||
describe("in Swagger 2", () => {
|
||||
it("should not result in a render error", function() {
|
||||
cy.visit("http://localhost:3230/?url=/documents/bugs/5452/swagger.yaml")
|
||||
.get("#operations-default-get_endpoint")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(".parameters > tbody > tr > .parameters-col_description > select")
|
||||
.select("")
|
||||
.get(".parameters > tbody > tr > .parameters-col_description > select")
|
||||
.should("exist")
|
||||
.select("fruit")
|
||||
.get(".parameters > tbody > tr > .parameters-col_description > select")
|
||||
.should("exist")
|
||||
})
|
||||
})
|
||||
})
|
11
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5453.js
Normal file
11
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5453.js
Normal file
@ -0,0 +1,11 @@
|
||||
// http://github.com/swagger-api/swagger-ui/issues/5453
|
||||
|
||||
describe("#5453: Responses w/o `content` should not render ModelExample", () => {
|
||||
it("should not render a ModelExample section", () => {
|
||||
cy.visit("/?url=/documents/bugs/5453.yaml")
|
||||
.get("#operations-default-get_foo")
|
||||
.click()
|
||||
.get(".responses-inner")
|
||||
.should("not.have.descendants", ".model-example")
|
||||
})
|
||||
})
|
11
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5455.js
Normal file
11
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5455.js
Normal file
@ -0,0 +1,11 @@
|
||||
// http://github.com/swagger-api/swagger-ui/issues/5455
|
||||
|
||||
describe("#5455: Request bodies w/o `examples` should not render a dropdown", () => {
|
||||
it("should not render a <select> element", () => {
|
||||
cy.visit("/?url=/documents/bugs/5455.yaml")
|
||||
.get("#operations-default-post_foo")
|
||||
.click()
|
||||
.get(".opblock-section-request-body > .opblock-description-wrapper")
|
||||
.should("not.have.descendants", "select")
|
||||
})
|
||||
})
|
22
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5458.js
Normal file
22
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5458.js
Normal file
@ -0,0 +1,22 @@
|
||||
// http://github.com/swagger-api/swagger-ui/issues/5458
|
||||
|
||||
const expectedValue = `{
|
||||
"foo": "custom value"
|
||||
}`
|
||||
|
||||
describe("#5458: Swagger 2.0 `Response.examples` mappings", () => {
|
||||
it("should render a custom example when a schema is not defined", () => {
|
||||
cy.visit("/?url=/documents/bugs/5458.yaml")
|
||||
.get("#operations-default-get_foo1")
|
||||
.click()
|
||||
.get(".model-example .highlight-code")
|
||||
.contains(expectedValue)
|
||||
})
|
||||
it("should render a custom example when a schema is defined", () => {
|
||||
cy.visit("/?url=/documents/bugs/5458.yaml")
|
||||
.get("#operations-default-get_foo2")
|
||||
.click()
|
||||
.get(".model-example .highlight-code")
|
||||
.contains(expectedValue)
|
||||
})
|
||||
})
|
20
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5660.js
Normal file
20
frontend/web/api-doc/test/e2e-cypress/tests/bugs/5660.js
Normal file
@ -0,0 +1,20 @@
|
||||
// http://github.com/swagger-api/swagger-ui/issues/5660
|
||||
|
||||
const expectedValue = "nullable: true"
|
||||
|
||||
describe("#5660: Nullable object", () => {
|
||||
it("should render `nullable` marker for object itself", () => {
|
||||
cy.visit("/?url=/documents/bugs/5660-model.yaml")
|
||||
.get("#model-SomeObject .model-toggle")
|
||||
.click()
|
||||
.get("#model-SomeObject > .model-box")
|
||||
.contains(expectedValue)
|
||||
})
|
||||
it("should render `nullable` marker for next object in property", () => {
|
||||
cy.visit("/?url=/documents/bugs/5660-property.yaml")
|
||||
.get("#model-SomeObject .model-toggle")
|
||||
.click()
|
||||
.get("#model-SomeObject > .model-box")
|
||||
.contains(expectedValue)
|
||||
})
|
||||
})
|
42
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6016.js
Normal file
42
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6016.js
Normal file
@ -0,0 +1,42 @@
|
||||
describe("Entries should be valid property name", () => {
|
||||
it("should render a OAS3.0 definition that uses 'entries' as a 'components' property name", () => {
|
||||
cy.visit("/?url=/documents/bugs/6016-oas3.yaml")
|
||||
.get("#operations-tag-default")
|
||||
.should("exist")
|
||||
})
|
||||
it("should render expanded Operations of OAS3.0 definition that uses 'entries' as a 'components' property name", () => {
|
||||
cy.visit("/?url=/documents/bugs/6016-oas3.yaml")
|
||||
.get("#operations-default-test_test__get")
|
||||
.click()
|
||||
.get("#operations-default-test_test__get > div .opblock-body")
|
||||
.should("exist")
|
||||
|
||||
})
|
||||
it("should render expanded Models of OAS3.0 definition that uses 'entries' as a 'components' property name", () => {
|
||||
cy.visit("/?url=/documents/bugs/6016-oas3.yaml")
|
||||
.get("#model-Testmodel > span .model-box")
|
||||
.click()
|
||||
.get("div .model-box")
|
||||
.should("exist")
|
||||
})
|
||||
it("should render a OAS2.0 definition that uses 'entries' as a 'definitions' property name", () => {
|
||||
cy.visit("/?url=/documents/bugs/6016-oas2.yaml")
|
||||
.get("#operations-default-post_pet")
|
||||
.should("exist")
|
||||
})
|
||||
it("should render expanded Operations of OAS2.0 definition that uses 'entries' as a 'definitions' property name", () => {
|
||||
cy.visit("/?url=/documents/bugs/6016-oas2.yaml")
|
||||
.get("#operations-default-post_pet")
|
||||
.click()
|
||||
.get("#operations-default-post_pet > div .opblock-body")
|
||||
.should("exist")
|
||||
|
||||
})
|
||||
it("should render expanded Models of OAS2.0 definition that uses 'entries' as a 'defintions' property name", () => {
|
||||
cy.visit("/?url=/documents/bugs/6016-oas2.yaml")
|
||||
.get("#model-Pet > span .model-box")
|
||||
.click()
|
||||
.get("div .model-box")
|
||||
.should("exist")
|
||||
})
|
||||
})
|
54
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6158.js
Normal file
54
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6158.js
Normal file
@ -0,0 +1,54 @@
|
||||
describe("#6158: read-only property is not hidden in `POST/PUT`", () => {
|
||||
describe("POST", () => {
|
||||
it("should hide property 'id'", () => {
|
||||
cy.visit("/?url=/documents/bugs/6158.yaml")
|
||||
.get("#operations-User-post_users")
|
||||
.click()
|
||||
.get(".parameters[data-property-name='id']")
|
||||
.should("not.exist")
|
||||
.get(".parameters[data-property-name='name']")
|
||||
.should("exist")
|
||||
})
|
||||
it("should hide property 'id' when trying it out", () => {
|
||||
cy.visit("/?url=/documents/bugs/6158.yaml")
|
||||
.get("#operations-User-post_users")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(".parameters[data-property-name='id']")
|
||||
.should("not.exist")
|
||||
.get("input[placeholder='id']")
|
||||
.should("not.exist")
|
||||
.get(".parameters[data-property-name='name']")
|
||||
.should("exist")
|
||||
.get("input[placeholder='name']")
|
||||
.should("exist")
|
||||
})
|
||||
})
|
||||
describe("PUT", () => {
|
||||
it("should hide property 'id'", () => {
|
||||
cy.visit("/?url=/documents/bugs/6158.yaml")
|
||||
.get("#operations-User-put_users")
|
||||
.click()
|
||||
.get(".parameters[data-property-name='id']")
|
||||
.should("not.exist")
|
||||
.get(".parameters[data-property-name='name']")
|
||||
.should("exist")
|
||||
})
|
||||
it("should hide property 'id' when trying it out", () => {
|
||||
cy.visit("/?url=/documents/bugs/6158.yaml")
|
||||
.get("#operations-User-put_users")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(".parameters[data-property-name='id']")
|
||||
.should("not.exist")
|
||||
.get("input[placeholder='id']")
|
||||
.should("not.exist")
|
||||
.get(".parameters[data-property-name='name']")
|
||||
.should("exist")
|
||||
.get("input[placeholder='name']")
|
||||
.should("exist")
|
||||
})
|
||||
})
|
||||
})
|
45
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6183.js
Normal file
45
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6183.js
Normal file
@ -0,0 +1,45 @@
|
||||
describe("When trying it out", () => {
|
||||
it("should render the response headers as comma separated lists", () => {
|
||||
cy.intercept(
|
||||
{
|
||||
method: "GET",
|
||||
url: /^\/response-headers/,
|
||||
hostname: "httpbin.org",
|
||||
},
|
||||
{
|
||||
body: {
|
||||
"Access-Control-Expose-Headers": "X-Header1, X-Header2, X-Header3, Access-Control-Expose-Headers",
|
||||
"Content-Length": "289",
|
||||
"Content-Type": "application/json",
|
||||
"X-Header1": "value1,value2",
|
||||
"X-Header2": "value3,value4",
|
||||
"X-Header3": ["value5", "value6"]
|
||||
},
|
||||
headers: {
|
||||
"access-control-expose-headers": "X-Header1,X-Header2,X-Header3,Access-Control-Expose-Headers",
|
||||
"content-type": "application/json",
|
||||
"x-header1": "value1,value2",
|
||||
"x-header2": "value3,value4",
|
||||
"x-header3": "value5,value6",
|
||||
}
|
||||
})
|
||||
|
||||
cy.visit("/?url=/documents/bugs/6183.yaml")
|
||||
.get("#operations-default-get_response_headers")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
.wait(1000)
|
||||
.get(".response-col_description .microlight")
|
||||
.find(("span:contains(\"value1,value2\")"))
|
||||
.should("exist")
|
||||
.get(".response-col_description .microlight")
|
||||
.find(("span:contains(\"value3,value4\")"))
|
||||
.should("exist")
|
||||
.get(".response-col_description .microlight")
|
||||
.find(("span:contains(\"value5,value6\")"))
|
||||
.should("exist")
|
||||
})
|
||||
})
|
43
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6276.js
Normal file
43
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6276.js
Normal file
@ -0,0 +1,43 @@
|
||||
describe("#6276: Query parameter filter=true is filtering by the value 'true'", () => {
|
||||
describe("With filter=true", () => {
|
||||
it("should display the filter bar", () => {
|
||||
cy.visit("/?url=/documents/petstore.swagger.yaml&filter=true")
|
||||
.get(".operation-filter-input")
|
||||
.should("exist")
|
||||
.should("be.empty")
|
||||
.get(".opblock-tag[data-tag='pet']")
|
||||
.should("exist")
|
||||
.get(".opblock-tag[data-tag='store']")
|
||||
.should("exist")
|
||||
.get(".opblock-tag[data-tag='user']")
|
||||
.should("exist")
|
||||
})
|
||||
})
|
||||
describe("With filter=false", () => {
|
||||
it("should not display the filter bar", () => {
|
||||
cy.visit("/?url=/documents/petstore.swagger.yaml&filter=false")
|
||||
.get(".operation-filter-input")
|
||||
.should("not.exist")
|
||||
.get(".opblock-tag[data-tag='pet']")
|
||||
.should("exist")
|
||||
.get(".opblock-tag[data-tag='store']")
|
||||
.should("exist")
|
||||
.get(".opblock-tag[data-tag='user']")
|
||||
.should("exist")
|
||||
})
|
||||
})
|
||||
describe("With filter=pet", () => {
|
||||
it("should display the filter bar and only show the operations tagged with pet", () => {
|
||||
cy.visit("/?url=/documents/petstore.swagger.yaml&filter=pet")
|
||||
.get(".operation-filter-input")
|
||||
.should("exist")
|
||||
.should("have.value", "pet")
|
||||
.get(".opblock-tag[data-tag='pet']")
|
||||
.should("exist")
|
||||
.get(".opblock-tag[data-tag='store']")
|
||||
.should("not.exist")
|
||||
.get(".opblock-tag[data-tag='user']")
|
||||
.should("not.exist")
|
||||
})
|
||||
})
|
||||
})
|
11
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6351.js
Normal file
11
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6351.js
Normal file
@ -0,0 +1,11 @@
|
||||
// http://github.com/swagger-api/swagger-ui/issues/6351
|
||||
|
||||
describe("#6351: Server dropdown should change when switched via oas3Actions.setSelectedServer", () => {
|
||||
it("should show different selected server", () => {
|
||||
cy.visit("/?url=/documents/bugs/6351.yaml")
|
||||
.get("select").should("have.value", "http://testserver1.com")
|
||||
.window()
|
||||
.then(win => win.ui.oas3Actions.setSelectedServer("http://testserver2.com"))
|
||||
.get("select").should("have.value", "http://testserver2.com")
|
||||
})
|
||||
})
|
44
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6369.js
Normal file
44
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6369.js
Normal file
@ -0,0 +1,44 @@
|
||||
describe("#6369: Object model render of field: deprecated", () => {
|
||||
describe("OAS3", () => {
|
||||
it("should display row with td:deprecated when set to true", () => {
|
||||
cy.visit("/?url=/documents/bugs/6369-oas3-display.yaml")
|
||||
.get("#model-IdentificationProfile > .model-box")
|
||||
.click()
|
||||
.get("#model-IdentificationProfile .model-box .model .inner-object table")
|
||||
.find("tr")
|
||||
.should("have.length", 3)
|
||||
.contains("td", "deprecated")
|
||||
})
|
||||
it("should not display row with td:deprecated when set to false", () => {
|
||||
cy.visit("/?url=/documents/bugs/6369-oas3-no-display.yaml")
|
||||
.get("#model-IdentificationProfile > .model-box")
|
||||
.click()
|
||||
.get("#model-IdentificationProfile .model-box .model .inner-object table")
|
||||
.find("tr")
|
||||
.should("have.length", 2)
|
||||
.get("#model-IdentificationProfile .model-box .model .inner-object table")
|
||||
.find(("td:contains(\"deprecated\")"))
|
||||
.should("not.exist")
|
||||
})
|
||||
})
|
||||
describe ("OAS2", () => {
|
||||
it("should display row with td:deprecated when set to true", () => {
|
||||
cy.visit("/?url=/documents/bugs/6369-oas2-display.yaml")
|
||||
.get("#model-IdentificationProfile > .model-box")
|
||||
.click()
|
||||
.get("#model-IdentificationProfile .model-box .model .inner-object")
|
||||
.contains("td", "deprecated")
|
||||
})
|
||||
it("should not display row with td:deprecated when set to false", () => {
|
||||
cy.visit("/?url=/documents/bugs/6369-oas2-no-display.yaml")
|
||||
.get("#model-IdentificationProfile > .model-box")
|
||||
.click()
|
||||
.get("#model-IdentificationProfile .model-box .model .inner-object table")
|
||||
.find("tr")
|
||||
.should("have.length", 2)
|
||||
.get("#model-IdentificationProfile .model-box .model .inner-object table")
|
||||
.find(("td:contains(\"deprecated\")"))
|
||||
.should("not.exist")
|
||||
})
|
||||
})
|
||||
})
|
33
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6442.js
Normal file
33
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6442.js
Normal file
@ -0,0 +1,33 @@
|
||||
describe("#6442: 'Examples' keyword definitions can not be rendered as xml", () => {
|
||||
it("should render response examples accourdingly to content-type xml", () => {
|
||||
const xmlIndicator = "<x>should be xml</x>"
|
||||
|
||||
cy
|
||||
.visit("?url=/documents/bugs/6442.yaml")
|
||||
.get("#operations-default-xmlTest")
|
||||
.click()
|
||||
.get(".responses-wrapper")
|
||||
.within(() => {
|
||||
cy
|
||||
.get(".microlight")
|
||||
.should("include.text", xmlIndicator)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("#6442: 'Example' keyword definitions can not be rendered as xml", () => {
|
||||
it("should render response examples accourdingly to content-type xml", () => {
|
||||
const xmlIndicator = "<x>should be xml</x>"
|
||||
|
||||
cy
|
||||
.visit("?url=/documents/bugs/6442.yaml")
|
||||
.get("#operations-default-xmlTest2")
|
||||
.click()
|
||||
.get(".responses-wrapper")
|
||||
.within(() => {
|
||||
cy
|
||||
.get(".microlight")
|
||||
.should("include.text", xmlIndicator)
|
||||
})
|
||||
})
|
||||
})
|
65
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6475.js
Normal file
65
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6475.js
Normal file
@ -0,0 +1,65 @@
|
||||
describe("#6475: 'Examples' keyword definitions can not be rendered as xml", () => {
|
||||
it("should render requestBody examples preview accourdingly to content-type xml", () => {
|
||||
const xmlIndicator = "<x>should be xml</x>"
|
||||
|
||||
cy
|
||||
.visit("?url=/documents/bugs/6475.yaml")
|
||||
.get("#operations-default-xmlTest_examples")
|
||||
.click()
|
||||
.get(".opblock-section-request-body")
|
||||
.within(() => {
|
||||
cy
|
||||
.get(".microlight")
|
||||
.should("include.text", xmlIndicator)
|
||||
})
|
||||
})
|
||||
it("should requestBody examples input accourdingly to content-type xml", () => {
|
||||
const xmlIndicator = "<x>should be xml</x>"
|
||||
|
||||
cy
|
||||
.visit("?url=/documents/bugs/6475.yaml")
|
||||
.get("#operations-default-xmlTest_examples")
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(".opblock-section-request-body")
|
||||
.within(() => {
|
||||
cy
|
||||
.get("textarea")
|
||||
.contains(xmlIndicator)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("#6475: 'Example' keyword definitions can not be rendered as xml", () => {
|
||||
it("should render requestBody examples preview accourdingly to content-type xml", () => {
|
||||
const xmlIndicator = "<x>should be xml</x>"
|
||||
|
||||
cy
|
||||
.visit("?url=/documents/bugs/6475.yaml")
|
||||
.get("#operations-default-xmlTest_example")
|
||||
.click()
|
||||
.get(".opblock-section-request-body")
|
||||
.within(() => {
|
||||
cy
|
||||
.get(".microlight")
|
||||
.should("include.text", xmlIndicator)
|
||||
})
|
||||
})
|
||||
it("should requestBody examples input accourdingly to content-type xml", () => {
|
||||
const xmlIndicator = "<x>should be xml</x>"
|
||||
|
||||
cy
|
||||
.visit("?url=/documents/bugs/6475.yaml")
|
||||
.get("#operations-default-xmlTest_example")
|
||||
.click()
|
||||
.get(".btn.try-out__btn")
|
||||
.click()
|
||||
.get(".opblock-section-request-body")
|
||||
.within(() => {
|
||||
cy
|
||||
.get("textarea")
|
||||
.contains(xmlIndicator)
|
||||
})
|
||||
})
|
||||
})
|
11
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6540.js
Normal file
11
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6540.js
Normal file
@ -0,0 +1,11 @@
|
||||
describe("#6540: XML example not rendered correctly with oneOf", () => {
|
||||
it("should render xml like json", () => {
|
||||
const expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test>\n\t<a>string</a>\n\t<b>0</b>\n\t<c>\n\t\t<ObjectType>Text</ObjectType>\n\t\t<Data>This is a text</Data>\n\t</c>\n\t<c>\n\t\t<ObjectType>image</ObjectType>\n\t\t<Data>This is a image</Data>\n\t</c>\n\t<d>\n\t\t<ObjectType>Text</ObjectType>\n\t\t<Data>This is a text</Data>\n\t</d>\n\t<d>\n\t\t<ObjectType>image</ObjectType>\n\t\t<Data>This is a image</Data>\n\t</d>\n</test>"
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/6540.yaml")
|
||||
.get("#operations-Test-postTest")
|
||||
.click()
|
||||
.get(".microlight")
|
||||
.contains(expected)
|
||||
})
|
||||
})
|
11
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6627.js
Normal file
11
frontend/web/api-doc/test/e2e-cypress/tests/bugs/6627.js
Normal file
@ -0,0 +1,11 @@
|
||||
describe("#6627: XML example when defined as array", () => {
|
||||
it("should render xml like json", () => {
|
||||
const expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Users>\n\t<User id=\"123\" name=\"bob\">\n\t</User>\n\t<User id=\"456\" name=\"jane\">\n\t</User>\n</Users>"
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/6627.yaml")
|
||||
.get("#operations-default-get_users")
|
||||
.click()
|
||||
.get(".microlight")
|
||||
.contains(expected)
|
||||
})
|
||||
})
|
14
frontend/web/api-doc/test/e2e-cypress/tests/bugs/7996.js
Normal file
14
frontend/web/api-doc/test/e2e-cypress/tests/bugs/7996.js
Normal file
@ -0,0 +1,14 @@
|
||||
describe("#7996: tag description text fills container when externalDocs section absent", () => {
|
||||
it("should show externalDocs div when externalDocs present in specification", () => {
|
||||
cy
|
||||
.visit("?url=/documents/bugs/7996-tags-externalDocs.yaml")
|
||||
.get("#operations-tag-foo .info__externaldocs")
|
||||
.should("exist")
|
||||
})
|
||||
it("should have no externalDocs div when externalDocs absent from specification", () => {
|
||||
cy
|
||||
.visit("?url=/documents/bugs/7996-tags-externalDocs.yaml")
|
||||
.get("#operations-tag-bar .info__externaldocs")
|
||||
.should("not.exist")
|
||||
})
|
||||
})
|
24
frontend/web/api-doc/test/e2e-cypress/tests/bugs/8217.js
Normal file
24
frontend/web/api-doc/test/e2e-cypress/tests/bugs/8217.js
Normal file
@ -0,0 +1,24 @@
|
||||
describe("#8217: Reset Request Body not using default values", () => {
|
||||
it("it reset the user edited value and executes with the default value in case of try out reset. (#6517)", () => {
|
||||
cy
|
||||
.visit("?url=/documents/bugs/8217.yaml")
|
||||
.get("#operations-default-addPet")
|
||||
.click()
|
||||
// Expand Try It Out
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
// replace default sample with bad value
|
||||
.get(`.parameters[data-property-name="bodyParameter"] input`)
|
||||
.type("{selectall}not the default value")
|
||||
// Reset Try It Out
|
||||
.get(".try-out__btn.reset")
|
||||
.click()
|
||||
// Submit using default value
|
||||
.get(".btn.execute")
|
||||
.click()
|
||||
// No required validation error on body parameter
|
||||
.get(`.parameters[data-property-name="bodyParameter"] input`)
|
||||
.should("have.value", "default")
|
||||
.and("not.have.class", "invalid")
|
||||
})
|
||||
})
|
@ -0,0 +1,26 @@
|
||||
import repeat from "lodash/repeat"
|
||||
|
||||
describe("Editor #1868: model changes break rendering", () => {
|
||||
it("should render model content changes correctly", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/bugs/editor-1868.yaml")
|
||||
|
||||
.get(".model-toggle.collapsed")
|
||||
.click()
|
||||
|
||||
.get("#model-MyModel")
|
||||
.contains("a")
|
||||
|
||||
.window()
|
||||
.then(win => {
|
||||
// Simulate Swagger Editor updating a model
|
||||
const content = win.ui.specSelectors.specStr()
|
||||
win.ui.specActions.updateSpec(content + `\n b:\n type: string`)
|
||||
})
|
||||
|
||||
.get("#model-MyModel")
|
||||
.contains("a")
|
||||
.get("#model-MyModel")
|
||||
.contains("b")
|
||||
})
|
||||
})
|
35
frontend/web/api-doc/test/e2e-cypress/tests/bugs/swos-63.js
Normal file
35
frontend/web/api-doc/test/e2e-cypress/tests/bugs/swos-63.js
Normal file
@ -0,0 +1,35 @@
|
||||
describe("SWOS-63: Schema/Model labeling", () => {
|
||||
describe("SchemaS/Models section", () => {
|
||||
it("should render `Schemas` for OpenAPI 3", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/petstore-expanded.openapi.yaml")
|
||||
.get("section.models > h4")
|
||||
.contains("Schemas")
|
||||
})
|
||||
it("should render `Models` for OpenAPI 2", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/petstore.swagger.yaml")
|
||||
.get("section.models > h4")
|
||||
.contains("Models")
|
||||
})
|
||||
})
|
||||
describe("ModelExample within Operation", () => {
|
||||
it("should render `Schemas` for OpenAPI 3", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/petstore-expanded.openapi.yaml")
|
||||
.get("#operations-default-findPets")
|
||||
.click()
|
||||
.get("button.tablinks[data-name=model]")
|
||||
.contains("Schema")
|
||||
})
|
||||
it("should render `Models` for OpenAPI 2", () => {
|
||||
cy
|
||||
.visit("/?url=/documents/petstore.swagger.yaml")
|
||||
.get("section.models > h4")
|
||||
.get("#operations-pet-addPet")
|
||||
.click()
|
||||
.get("button.tablinks[data-name=model]")
|
||||
.contains("Model")
|
||||
})
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user