feat: apply cumulative update to address various issues (#10324)
This commit is contained in:
@@ -15,7 +15,7 @@ describe("Deep linking feature", () => {
|
||||
describe("Operation with whitespace in tag+id", () => {
|
||||
const elementToGet = ".opblock-post"
|
||||
const correctFragment = "#/my%20Tag/my%20Operation"
|
||||
|
||||
|
||||
OperationDeeplinkTestFactory({
|
||||
baseUrl: swagger2BaseUrl,
|
||||
elementToGet,
|
||||
@@ -109,7 +109,7 @@ describe("Deep linking feature", () => {
|
||||
describe("Operation with whitespace in tag+id", () => {
|
||||
const elementToGet = ".opblock-post"
|
||||
const correctFragment = "#/my%20Tag/my%20Operation"
|
||||
|
||||
|
||||
OperationDeeplinkTestFactory({
|
||||
baseUrl: openAPI3BaseUrl,
|
||||
elementToGet: ".opblock-post",
|
||||
@@ -117,7 +117,7 @@ describe("Deep linking feature", () => {
|
||||
correctFragment,
|
||||
correctHref: "#/my%20Tag/my%20Operation"
|
||||
})
|
||||
|
||||
|
||||
const legacyFragment = "#/my_Tag/my_Operation"
|
||||
|
||||
it("should expand the operation when reloaded and provided the legacy fragment", () => {
|
||||
@@ -190,7 +190,7 @@ describe("Deep linking feature", () => {
|
||||
})
|
||||
})
|
||||
|
||||
function OperationDeeplinkTestFactory({ baseUrl, elementToGet, correctElementId, correctFragment, correctHref }) {
|
||||
function OperationDeeplinkTestFactory({ baseUrl, elementToGet, correctElementId, correctFragment, correctHref }) {
|
||||
it("should generate a correct element ID", () => {
|
||||
cy.visit(baseUrl)
|
||||
.get(elementToGet)
|
||||
@@ -245,7 +245,7 @@ function OperationDeeplinkTestFactory({ baseUrl, elementToGet, correctElementId,
|
||||
})
|
||||
}
|
||||
|
||||
function TagDeeplinkTestFactory({ baseUrl, elementToGet, correctElementId, correctFragment, correctHref, isTagCase = false }) {
|
||||
function TagDeeplinkTestFactory({ baseUrl, elementToGet, correctElementId, correctFragment, correctHref }) {
|
||||
it("should generate a correct element ID", () => {
|
||||
cy.visit(baseUrl)
|
||||
.get(elementToGet)
|
||||
@@ -289,4 +289,4 @@ function TagDeeplinkTestFactory({ baseUrl, elementToGet, correctElementId, corre
|
||||
.get(`.opblock-tag-section.is-open`)
|
||||
.should("have.length", 1)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ function ExternalDocsTest(baseUrl) {
|
||||
.get(".info__extdocs")
|
||||
.should("exist")
|
||||
.and("contain.text", "Read external docs")
|
||||
.and("have.attr", "href", "http://swagger.io")
|
||||
.and("have.attr", "href", "http://swagger.io/")
|
||||
})
|
||||
|
||||
it("should display link to external docs without description", () => {
|
||||
@@ -32,7 +32,7 @@ function ExternalDocsTest(baseUrl) {
|
||||
.get(".info__extdocs")
|
||||
.should("exist")
|
||||
.and("contain.text", "http://swagger.io")
|
||||
.and("have.attr", "href", "http://swagger.io")
|
||||
.and("have.attr", "href", "http://swagger.io/")
|
||||
})
|
||||
})
|
||||
|
||||
@@ -43,7 +43,7 @@ function ExternalDocsTest(baseUrl) {
|
||||
.should("exist")
|
||||
.find("a")
|
||||
.should("contain.text", "Pet Documentation")
|
||||
.and("have.attr", "href", "http://swagger.io")
|
||||
.and("have.attr", "href", "http://swagger.io/")
|
||||
})
|
||||
|
||||
it("should display link to external docs without description", () => {
|
||||
@@ -52,7 +52,7 @@ function ExternalDocsTest(baseUrl) {
|
||||
.should("exist")
|
||||
.find("a")
|
||||
.should("contain.text", "http://swagger.io")
|
||||
.and("have.attr", "href", "http://swagger.io")
|
||||
.and("have.attr", "href", "http://swagger.io/")
|
||||
})
|
||||
})
|
||||
|
||||
@@ -65,7 +65,7 @@ function ExternalDocsTest(baseUrl) {
|
||||
.click()
|
||||
.get(`.models #model-${type} .external-docs a`)
|
||||
.should("contain.text", `${type} Docs`)
|
||||
.and("have.attr", "href", "http://swagger.io")
|
||||
.and("have.attr", "href", "http://swagger.io/")
|
||||
})
|
||||
|
||||
it("should display link without description", () => {
|
||||
@@ -74,7 +74,7 @@ function ExternalDocsTest(baseUrl) {
|
||||
.click()
|
||||
.get(`.models #model-${type}WithoutDescription .external-docs a`)
|
||||
.should("contain.text", "http://swagger.io")
|
||||
.and("have.attr", "href", "http://swagger.io")
|
||||
.and("have.attr", "href", "http://swagger.io/")
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ function ExternalDocsTest(baseUrl) {
|
||||
.get("#operations-pet-updatePet .opblock-external-docs-wrapper .opblock-external-docs__description")
|
||||
.should("contain.text", "More details about putting a pet")
|
||||
.get("#operations-pet-updatePet .opblock-external-docs-wrapper .opblock-external-docs__link")
|
||||
.should("have.attr", "href", "http://swagger.io")
|
||||
.should("have.attr", "href", "http://swagger.io/")
|
||||
})
|
||||
|
||||
it("should display link to external docs without description", () => {
|
||||
@@ -102,7 +102,7 @@ function ExternalDocsTest(baseUrl) {
|
||||
.get("#operations-pet-addPet .opblock-external-docs-wrapper .opblock-external-docs__description")
|
||||
.should("not.exist")
|
||||
.get("#operations-pet-addPet .opblock-external-docs-wrapper .opblock-external-docs__link")
|
||||
.should("have.attr", "href", "http://swagger.io")
|
||||
.should("have.attr", "href", "http://swagger.io/")
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ describe("Model collapse/expand feature", () => {
|
||||
})
|
||||
})
|
||||
|
||||
function ModelCollapseTest(baseUrl, urlFragment) {
|
||||
function ModelCollapseTest(baseUrl) {
|
||||
it("Models section should be expanded on load", () => {
|
||||
cy.visit(baseUrl)
|
||||
.get(".models")
|
||||
|
||||
@@ -617,7 +617,7 @@ describe("OpenAPI 3.0 Multiple Examples - core features", () => {
|
||||
.click()
|
||||
// Set an invalid value
|
||||
.get(
|
||||
".parameters-container > div > table > tbody > tr > td.parameters-col_description > div:nth-child(2) > textarea"
|
||||
".parameters-container > div > table > tbody > tr > td.parameters-col_description > div:nth-child(2) textarea"
|
||||
)
|
||||
.type("{{{{ [[[[ <<<< invalid JSON here.")
|
||||
// Execute the operation
|
||||
|
||||
43
test/e2e-cypress/e2e/features/oas3-extension.cy.js
Normal file
43
test/e2e-cypress/e2e/features/oas3-extension.cy.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
describe("OpenAPI 3.0 extensions", () => {
|
||||
describe("displays extensions", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/oas3-extension.yaml&showExtensions=true"
|
||||
)
|
||||
|
||||
cy.get(".model-box-control").contains("User").click()
|
||||
cy.get(".property-row").contains("[...]").click()
|
||||
})
|
||||
|
||||
it("object extensions are visible", () => {
|
||||
cy.get(".extension").contains(`x-object-extension`).should("be.visible")
|
||||
cy.get(".extension")
|
||||
.contains(`x-object-objectExtension`)
|
||||
.should("be.visible")
|
||||
})
|
||||
|
||||
it("primitive extensions are visible", () => {
|
||||
cy.get(".extension")
|
||||
.contains(`x-primitive-extension`)
|
||||
.should("be.visible")
|
||||
cy.get(".extension")
|
||||
.contains(`x-primitive-objectExtension`)
|
||||
.should("be.visible")
|
||||
})
|
||||
})
|
||||
|
||||
it("should hide extensions if showExtensions option is set to false", () => {
|
||||
cy.visit("/?url=/documents/features/oas3-extension.yaml")
|
||||
cy.get(".model-box-control").contains("User").click()
|
||||
cy.get(".property-row").contains("[...]").click()
|
||||
|
||||
cy.contains("x-primitive-extension").should("not.exist")
|
||||
cy.contains("x-primitive-objectExtension").should("not.exist")
|
||||
cy.contains("x-object-extension").should("not.exist")
|
||||
cy.contains("x-object-objectExtension").should("not.exist")
|
||||
})
|
||||
})
|
||||
@@ -4,9 +4,7 @@
|
||||
|
||||
describe("OpenAPI 3.0 Multiple Servers", () => {
|
||||
it("should render and execute for server '/test-url-1'", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/oas3-multiple-servers.yaml"
|
||||
)
|
||||
cy.visit("/?url=/documents/features/oas3-multiple-servers.yaml")
|
||||
.get(".scheme-container .schemes .servers label > select")
|
||||
.select("/test-url-1")
|
||||
.get("#operations-default-get_")
|
||||
@@ -21,9 +19,7 @@ describe("OpenAPI 3.0 Multiple Servers", () => {
|
||||
.should("contains.text", "/test-url-1")
|
||||
})
|
||||
it("should render and execute for server '/test-url-2'", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/oas3-multiple-servers.yaml"
|
||||
)
|
||||
cy.visit("/?url=/documents/features/oas3-multiple-servers.yaml")
|
||||
.get(".scheme-container .schemes .servers label > select")
|
||||
.select("/test-url-2")
|
||||
.get("#operations-default-get_")
|
||||
@@ -38,9 +34,7 @@ describe("OpenAPI 3.0 Multiple Servers", () => {
|
||||
.should("contains.text", "/test-url-2")
|
||||
})
|
||||
it("should render and execute for server '/test-url-1' after sequence: select '/test-url-2' -> Try-It-Out -> select '/test-url-1'", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/oas3-multiple-servers.yaml"
|
||||
)
|
||||
cy.visit("/?url=/documents/features/oas3-multiple-servers.yaml")
|
||||
.get(".scheme-container .schemes .servers label > select")
|
||||
.select("/test-url-2")
|
||||
.get("#operations-default-get_")
|
||||
@@ -58,14 +52,10 @@ describe("OpenAPI 3.0 Multiple Servers", () => {
|
||||
.should("contains.text", "/test-url-1")
|
||||
})
|
||||
it("should render and execute for server '/test-url-switch-1' after changing api definition", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/oas3-multiple-servers.yaml"
|
||||
)
|
||||
cy.visit("/?url=/documents/features/oas3-multiple-servers.yaml")
|
||||
.get(".scheme-container .schemes .servers label > select")
|
||||
.select("/test-url-2")
|
||||
cy.visit(
|
||||
"/?url=/documents/features/oas3-multiple-servers-switch.yaml"
|
||||
)
|
||||
cy.visit("/?url=/documents/features/oas3-multiple-servers-switch.yaml")
|
||||
.get(".scheme-container .schemes .servers label > select")
|
||||
.select("/test-url-switch-2")
|
||||
.get("#operations-default-get_")
|
||||
|
||||
@@ -4,79 +4,99 @@
|
||||
|
||||
describe("OpenAPI 3.0 Allow Empty Values in Request Body", () => {
|
||||
it("should not apply or render to required fields", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/petstore-only-pet.openapi.yaml"
|
||||
)
|
||||
cy.visit("/?url=/documents/features/petstore-only-pet.openapi.yaml")
|
||||
.get("#operations-pet-addPet")
|
||||
.click()
|
||||
.get(".opblock-section .opblock-section-request-body .body-param-content-type > select")
|
||||
.get(
|
||||
".opblock-section .opblock-section-request-body .body-param-content-type > select"
|
||||
)
|
||||
.select("application/x-www-form-urlencoded")
|
||||
// Expand Try It Out
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
// Request Body
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(2) > .parameters-col_description .parameter__empty_value_toggle input")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(2) > .parameters-col_description .parameter__empty_value_toggle input"
|
||||
)
|
||||
.should("not.exist")
|
||||
})
|
||||
|
||||
it("by default, should be checked for all non-required fields", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/petstore-only-pet.openapi.yaml"
|
||||
)
|
||||
cy.visit("/?url=/documents/features/petstore-only-pet.openapi.yaml")
|
||||
.get("#operations-pet-addPet")
|
||||
.click()
|
||||
.get(".opblock-section .opblock-section-request-body .body-param-content-type > select")
|
||||
.get(
|
||||
".opblock-section .opblock-section-request-body .body-param-content-type > select"
|
||||
)
|
||||
.select("application/x-www-form-urlencoded")
|
||||
// Expand Try It Out
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
// Request Body
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .json-schema-form-item-remove")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .json-schema-form-item-remove"
|
||||
)
|
||||
.click()
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .parameter__empty_value_toggle input")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .parameter__empty_value_toggle input"
|
||||
)
|
||||
.should("be.checked")
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(6) > .parameters-col_description select")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(6) > .parameters-col_description select"
|
||||
)
|
||||
.select("--")
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(6) > .parameters-col_description .parameter__empty_value_toggle input")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(6) > .parameters-col_description .parameter__empty_value_toggle input"
|
||||
)
|
||||
.should("be.checked")
|
||||
})
|
||||
|
||||
it("checkbox should be toggle-able", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/petstore-only-pet.openapi.yaml"
|
||||
)
|
||||
cy.visit("/?url=/documents/features/petstore-only-pet.openapi.yaml")
|
||||
.get("#operations-pet-addPet")
|
||||
.click()
|
||||
.get(".opblock-section .opblock-section-request-body .body-param-content-type > select")
|
||||
.get(
|
||||
".opblock-section .opblock-section-request-body .body-param-content-type > select"
|
||||
)
|
||||
.select("application/x-www-form-urlencoded")
|
||||
// Expand Try It Out
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
// Request Body
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .json-schema-form-item-remove")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .json-schema-form-item-remove"
|
||||
)
|
||||
.click()
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .parameter__empty_value_toggle input")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .parameter__empty_value_toggle input"
|
||||
)
|
||||
.should("be.checked")
|
||||
.uncheck()
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .parameter__empty_value_toggle input")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .parameter__empty_value_toggle input"
|
||||
)
|
||||
.should("not.be.checked")
|
||||
})
|
||||
|
||||
it("on execute, should allow send with all empty values", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/petstore-only-pet.openapi.yaml"
|
||||
)
|
||||
cy.visit("/?url=/documents/features/petstore-only-pet.openapi.yaml")
|
||||
.get("#operations-pet-addPet")
|
||||
.click()
|
||||
.get(".opblock-section .opblock-section-request-body .body-param-content-type > select")
|
||||
.get(
|
||||
".opblock-section .opblock-section-request-body .body-param-content-type > select"
|
||||
)
|
||||
.select("application/x-www-form-urlencoded")
|
||||
// Expand Try It Out
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
// Remove example values
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .json-schema-form-item-remove")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .json-schema-form-item-remove"
|
||||
)
|
||||
.click()
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(6) > .parameters-col_description select")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(6) > .parameters-col_description select"
|
||||
)
|
||||
.select("--")
|
||||
// Execute
|
||||
.get(".execute.opblock-control__btn")
|
||||
@@ -89,23 +109,29 @@ describe("OpenAPI 3.0 Allow Empty Values in Request Body", () => {
|
||||
})
|
||||
|
||||
it("on execute, should allow send with some empty values", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/petstore-only-pet.openapi.yaml"
|
||||
)
|
||||
cy.visit("/?url=/documents/features/petstore-only-pet.openapi.yaml")
|
||||
.get("#operations-pet-addPet")
|
||||
.click()
|
||||
.get(".opblock-section .opblock-section-request-body .body-param-content-type > select")
|
||||
.get(
|
||||
".opblock-section .opblock-section-request-body .body-param-content-type > select"
|
||||
)
|
||||
.select("application/x-www-form-urlencoded")
|
||||
// Expand Try It Out
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
// Request Body
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .json-schema-form-item-remove")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .json-schema-form-item-remove"
|
||||
)
|
||||
.click()
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .parameter__empty_value_toggle input")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .parameter__empty_value_toggle input"
|
||||
)
|
||||
.uncheck()
|
||||
// add item to pass required validation
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(4) input")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(4) input"
|
||||
)
|
||||
.clear()
|
||||
// Execute
|
||||
.get(".execute.opblock-control__btn")
|
||||
@@ -119,24 +145,32 @@ describe("OpenAPI 3.0 Allow Empty Values in Request Body", () => {
|
||||
})
|
||||
|
||||
it("on execute, should allow send with skip all empty values", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/petstore-only-pet.openapi.yaml"
|
||||
)
|
||||
cy.visit("/?url=/documents/features/petstore-only-pet.openapi.yaml")
|
||||
.get("#operations-pet-addPet")
|
||||
.click()
|
||||
.get(".opblock-section .opblock-section-request-body .body-param-content-type > select")
|
||||
.get(
|
||||
".opblock-section .opblock-section-request-body .body-param-content-type > select"
|
||||
)
|
||||
.select("application/x-www-form-urlencoded")
|
||||
// Expand Try It Out
|
||||
.get(".try-out__btn")
|
||||
.click()
|
||||
// Request Body
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .json-schema-form-item-remove")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .json-schema-form-item-remove"
|
||||
)
|
||||
.click()
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .parameter__empty_value_toggle input")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(5) > .parameters-col_description .parameter__empty_value_toggle input"
|
||||
)
|
||||
.uncheck()
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(6) > .parameters-col_description select")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(6) > .parameters-col_description select"
|
||||
)
|
||||
.select("--")
|
||||
.get(".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(6) > .parameters-col_description .parameter__empty_value_toggle input")
|
||||
.get(
|
||||
".opblock-body .opblock-section .opblock-section-request-body .parameters:nth-child(6) > .parameters-col_description .parameter__empty_value_toggle input"
|
||||
)
|
||||
.uncheck()
|
||||
// Execute
|
||||
.get(".execute.opblock-control__btn")
|
||||
@@ -148,5 +182,4 @@ describe("OpenAPI 3.0 Allow Empty Values in Request Body", () => {
|
||||
.should("not.contains.text", "tags=")
|
||||
.should("not.contains.text", "status=")
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
78
test/e2e-cypress/e2e/features/oas31-extension.cy.js
Normal file
78
test/e2e-cypress/e2e/features/oas31-extension.cy.js
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
const showsExtensions = (keyword) => {
|
||||
it("extensions are visible on keyword click", () => {
|
||||
cy.get(".json-schema-2020-12-json-viewer__name")
|
||||
.contains("x-primitiveExtension")
|
||||
.should("not.be.visible")
|
||||
cy.get(".json-schema-2020-12-json-viewer__name")
|
||||
.contains("x-arrayExtension")
|
||||
.should("not.be.visible")
|
||||
cy.get(".json-schema-2020-12-json-viewer__name")
|
||||
.contains("x-objectExtension")
|
||||
.should("not.be.visible")
|
||||
|
||||
cy.get(".json-schema-2020-12-keyword__name").contains(keyword).click()
|
||||
|
||||
cy.get(".json-schema-2020-12-json-viewer__name")
|
||||
.contains("x-primitiveExtension")
|
||||
.should("be.visible")
|
||||
cy.get(".json-schema-2020-12-json-viewer__name")
|
||||
.contains("x-arrayExtension")
|
||||
.should("be.visible")
|
||||
cy.get(".json-schema-2020-12-json-viewer__name")
|
||||
.contains("x-objectExtension")
|
||||
.should("be.visible")
|
||||
})
|
||||
}
|
||||
|
||||
describe("OpenAPI 3.1 extension keyword", () => {
|
||||
describe("displays extensions", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/oas31-extension.yaml&showExtensions=true"
|
||||
)
|
||||
})
|
||||
|
||||
describe("Discriminator extension", () => {
|
||||
beforeEach(() => {
|
||||
cy.get(".json-schema-2020-12").contains("My Pet").click()
|
||||
})
|
||||
showsExtensions("Discriminator")
|
||||
})
|
||||
|
||||
describe("External documentation extension", () => {
|
||||
beforeEach(() => {
|
||||
cy.get(".json-schema-2020-12").contains("Object").click()
|
||||
})
|
||||
showsExtensions("External documentation")
|
||||
})
|
||||
|
||||
describe("XML extension", () => {
|
||||
beforeEach(() => {
|
||||
cy.get(".json-schema-2020-12").contains("Book").click()
|
||||
})
|
||||
showsExtensions("XML")
|
||||
})
|
||||
})
|
||||
|
||||
it("should hide extensions if showExtensions option is set to false", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/oas31-extension.yaml&showExtensions=false"
|
||||
)
|
||||
cy.get(".json-schema-2020-12").contains("Object").click()
|
||||
cy.get(".json-schema-2020-12-keyword__name")
|
||||
.contains("External documentation")
|
||||
.click()
|
||||
|
||||
cy.get(".json-schema-2020-12-keyword__name--secondary")
|
||||
.contains("url")
|
||||
.should("be.visible")
|
||||
|
||||
cy.contains("x-primitiveExtension").should("not.exist")
|
||||
cy.contains("x-arrayExtension").should("not.exist")
|
||||
cy.contains("x-objectExtension").should("not.exist")
|
||||
})
|
||||
})
|
||||
41
test/e2e-cypress/e2e/features/parameter-schema.cy.js
Normal file
41
test/e2e-cypress/e2e/features/parameter-schema.cy.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
describe("Operation parameters", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/?url=/documents/features/parameter-schema.yaml")
|
||||
})
|
||||
|
||||
it("should render example for parameters of type object", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/object").click()
|
||||
|
||||
cy.get(".model-example textarea")
|
||||
.should("exist")
|
||||
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
|
||||
})
|
||||
|
||||
it("should render schema for parameters of type object", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/object").click()
|
||||
|
||||
cy.get(".model-example button").contains("Schema").click()
|
||||
cy.get(".model-example .model").should("exist")
|
||||
})
|
||||
|
||||
it("should render example for parameters of type array of objects", () => {
|
||||
cy.visit("/?url=/documents/features/parameter-schema.yaml")
|
||||
|
||||
cy.get(".opblock-summary-path span").contains("/arrayOfObjects").click()
|
||||
|
||||
cy.get(".model-example textarea")
|
||||
.should("exist")
|
||||
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
|
||||
})
|
||||
|
||||
it("should render schema for parameters of type array of objects", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/arrayOfObjects").click()
|
||||
|
||||
cy.get(".model-example button").contains("Schema").click()
|
||||
cy.get(".model-example .model").should("exist")
|
||||
})
|
||||
})
|
||||
@@ -21,7 +21,7 @@ describe("Parameter with oneOf and anyOf keywords in OpenAPI 3.0.x", () => {
|
||||
.eq(3)
|
||||
.find("textarea")
|
||||
.should("exist")
|
||||
.and("contain", "\"eq\": \"active\"")
|
||||
.and("contain", '"eq": "active"')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -44,6 +44,6 @@ describe("Parameter with oneOf and anyOf keywords in OpenAPI 3.1.0.", () => {
|
||||
.eq(3)
|
||||
.find("textarea")
|
||||
.should("exist")
|
||||
.and("contain", "\"eq\": \"active\"")
|
||||
.and("contain", '"eq": "active"')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
describe("JSON Schema 2020-12 examples keyword", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/?url=/documents/features/json-schema-2020-12-examples.yaml")
|
||||
})
|
||||
|
||||
it("should render `Examples` section", () => {
|
||||
cy.get(".json-schema-2020-12-accordion").click()
|
||||
cy.get(".json-schema-2020-12-keyword--examples").should("exist")
|
||||
})
|
||||
|
||||
it("should render primitive examples value", () => {
|
||||
cy.get(".json-schema-2020-12-accordion").click()
|
||||
cy.contains("Examples").click()
|
||||
|
||||
cy.get(".json-schema-2020-12-keyword--examples")
|
||||
.contains("#0")
|
||||
.as("primitiveExample")
|
||||
.should("exist")
|
||||
|
||||
cy.get("@primitiveExample")
|
||||
.siblings(".json-schema-2020-12-json-viewer__value")
|
||||
.contains("1")
|
||||
.should("exist")
|
||||
})
|
||||
|
||||
it("should render array examples value", () => {
|
||||
cy.get(".json-schema-2020-12-accordion").click()
|
||||
cy.contains("Examples").click()
|
||||
|
||||
cy.get(".json-schema-2020-12-keyword--examples")
|
||||
.contains("#1")
|
||||
.as("arrayExample")
|
||||
.should("exist")
|
||||
|
||||
cy.get("@arrayExample").click()
|
||||
|
||||
cy.get("@arrayExample")
|
||||
.parent()
|
||||
.contains("#0")
|
||||
.as("arrayExampleItem")
|
||||
.should("exist")
|
||||
|
||||
cy.get("@arrayExampleItem")
|
||||
.siblings(".json-schema-2020-12-json-viewer__value")
|
||||
.contains("2")
|
||||
.should("exist")
|
||||
})
|
||||
|
||||
it("should render object examples values", () => {
|
||||
cy.get(".json-schema-2020-12-accordion").click()
|
||||
cy.contains("Examples").click()
|
||||
|
||||
cy.get(".json-schema-2020-12-keyword--examples")
|
||||
.contains("#2")
|
||||
.as("objectExample")
|
||||
.should("exist")
|
||||
|
||||
cy.get("@objectExample").click()
|
||||
|
||||
cy.get("@objectExample")
|
||||
.parent()
|
||||
.contains("prop")
|
||||
.as("objectExampleProperty")
|
||||
.should("exist")
|
||||
|
||||
cy.get("@objectExampleProperty")
|
||||
.siblings(".json-schema-2020-12-json-viewer__value")
|
||||
.contains("3")
|
||||
.should("exist")
|
||||
})
|
||||
})
|
||||
@@ -4,17 +4,17 @@
|
||||
|
||||
describe("JSON Schema 2020-12 complex keywords expansion", () => {
|
||||
it("should deeply expand all Schemas and complex keywords", () => {
|
||||
cy.visit("/pages/json-schema-2020-12-expansion/").then(
|
||||
() => {
|
||||
cy.get(".json-schema-2020-12-accordion")
|
||||
.find(".json-schema-2020-12-accordion__icon--collapsed")
|
||||
.should("not.exist")
|
||||
cy.contains("anyOf1-p1-p2-p1").should("exist")
|
||||
cy.contains("oneOf1-p1-p2-p1").should("exist")
|
||||
cy.contains("Prefix items").should("exist")
|
||||
cy.contains("exampleDef").should("exist")
|
||||
cy.contains("https://json-schema.org/draft/2020-12/vocab/core").should("exist")
|
||||
}
|
||||
)
|
||||
cy.visit("/pages/json-schema-2020-12-expansion/").then(() => {
|
||||
cy.get(".json-schema-2020-12-accordion")
|
||||
.find(".json-schema-2020-12-accordion__icon--collapsed")
|
||||
.should("not.exist")
|
||||
cy.contains("anyOf1-p1-p2-p1").should("exist")
|
||||
cy.contains("oneOf1-p1-p2-p1").should("exist")
|
||||
cy.contains("Prefix items").should("exist")
|
||||
cy.contains("exampleDef").should("exist")
|
||||
cy.contains("https://json-schema.org/draft/2020-12/vocab/core").should(
|
||||
"exist"
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
describe("JSON Schema 2020-12 extension keywords", () => {
|
||||
describe("display extension keywords", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/json-schema-2020-12-extension-keywords.yaml&showExtensions=true"
|
||||
)
|
||||
})
|
||||
|
||||
it("should render `Extension Keywords` section", () => {
|
||||
cy.get(".json-schema-2020-12-accordion").click()
|
||||
cy.get(".json-schema-2020-12-keyword--extension-keywords").should("exist")
|
||||
})
|
||||
|
||||
it("should render extension keywords with primitive values", () => {
|
||||
cy.get(".json-schema-2020-12-accordion").click()
|
||||
cy.contains("Extension Keywords").click()
|
||||
|
||||
cy.get(".json-schema-2020-12-json-viewer-extension-keyword")
|
||||
.contains("primitiveExtension")
|
||||
.as("primitiveExtension")
|
||||
.should("exist")
|
||||
|
||||
cy.get("@primitiveExtension")
|
||||
.siblings(".json-schema-2020-12-json-viewer__value")
|
||||
.contains("1")
|
||||
.should("exist")
|
||||
})
|
||||
|
||||
it("should render extension keywords with array values", () => {
|
||||
cy.get(".json-schema-2020-12-accordion").click()
|
||||
cy.contains("Extension Keywords").click()
|
||||
|
||||
cy.get(".json-schema-2020-12-json-viewer-extension-keyword")
|
||||
.contains("arrayExtension")
|
||||
.should("exist")
|
||||
|
||||
cy.contains("arrayExtension").click()
|
||||
|
||||
cy.get(".json-schema-2020-12-json-viewer__children")
|
||||
.contains("#0")
|
||||
.as("arrayExtensionItem")
|
||||
.should("exist")
|
||||
|
||||
cy.get("@arrayExtensionItem")
|
||||
.siblings(".json-schema-2020-12-json-viewer__value")
|
||||
.contains("2")
|
||||
.should("exist")
|
||||
})
|
||||
|
||||
it("should render extension keywords with object values", () => {
|
||||
cy.get(".json-schema-2020-12-accordion").click()
|
||||
cy.contains("Extension Keywords").click()
|
||||
|
||||
cy.get(".json-schema-2020-12-json-viewer-extension-keyword")
|
||||
.contains("objectExtension")
|
||||
.should("exist")
|
||||
|
||||
cy.contains("objectExtension").click()
|
||||
|
||||
cy.get(".json-schema-2020-12-json-viewer__children")
|
||||
.contains("prop")
|
||||
.as("objectExtensionProperty")
|
||||
.should("exist")
|
||||
|
||||
cy.get("@objectExtensionProperty")
|
||||
.siblings(".json-schema-2020-12-json-viewer__value")
|
||||
.contains("3")
|
||||
.should("exist")
|
||||
})
|
||||
|
||||
it("should not render OpenAPI 3.1.0 keywords as extension keywords", () => {
|
||||
cy.get(".json-schema-2020-12-accordion").click()
|
||||
cy.contains("Extension Keywords").click()
|
||||
|
||||
cy.get(".json-schema-2020-12-keyword--extension-keywords")
|
||||
.children()
|
||||
.contains("Default")
|
||||
.should("not.exist")
|
||||
})
|
||||
})
|
||||
|
||||
it("shouldn't display extensions when showExtensions option is set to false", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/json-schema-2020-12-extension-keywords.yaml"
|
||||
)
|
||||
|
||||
cy.get(".json-schema-2020-12-accordion").click()
|
||||
cy.contains("Extension Keywords").should("not.exist")
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
describe("JSON Schema 2020-12 uniqueItems keyword", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/?url=/documents/features/json-schema-2020-12-unique-items.yaml")
|
||||
})
|
||||
|
||||
it("should render `unique` label", () => {
|
||||
cy.contains("UniqueItems")
|
||||
.siblings("span")
|
||||
.contains("unique")
|
||||
.should("exist")
|
||||
})
|
||||
|
||||
it("should render `unique items` label with range constraints", () => {
|
||||
cy.contains("UniqueItemsAndRangeConstraint")
|
||||
.siblings("span")
|
||||
.contains("[1, 5] unique items")
|
||||
.should("exist")
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
describe("Request body with complex schema properties", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/oas3-request-body-complex-schema-properties.yaml"
|
||||
)
|
||||
})
|
||||
|
||||
it("should render example for properties of type object", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/object").click()
|
||||
cy.get("button").contains("Try it out").click()
|
||||
|
||||
cy.get(".model-example textarea")
|
||||
.should("exist")
|
||||
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
|
||||
})
|
||||
|
||||
it("should render schema for properties of type object", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/object").click()
|
||||
cy.get("button").contains("Try it out").click()
|
||||
|
||||
cy.get(".model-example button").contains("Schema").click()
|
||||
cy.get(".model-example .model").should("exist")
|
||||
})
|
||||
|
||||
it("should render example for properties of type array of objects", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/arrayOfObjects").click()
|
||||
cy.get("button").contains("Try it out").click()
|
||||
|
||||
cy.get(".model-example textarea")
|
||||
.should("exist")
|
||||
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
|
||||
})
|
||||
|
||||
it("should render schema for properties of type array of objects", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/arrayOfObjects").click()
|
||||
cy.get("button").contains("Try it out").click()
|
||||
|
||||
cy.get(".model-example button").contains("Schema").click()
|
||||
cy.get(".model-example .model").should("exist")
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
describe("Operation parameters with schema and union type", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("/?url=/documents/features/oas31-parameter-schema.yaml")
|
||||
})
|
||||
|
||||
it("should render example for parameters with union type including object", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/objectTypeUnion").click()
|
||||
cy.get(".model-example textarea")
|
||||
.should("exist")
|
||||
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
|
||||
})
|
||||
|
||||
it("should render schema for parameters with union type including object", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/objectTypeUnion").click()
|
||||
|
||||
cy.get(".model-example button").contains("Schema").click()
|
||||
cy.get(".model-example .json-schema-2020-12").should("exist")
|
||||
})
|
||||
|
||||
it("should render example for parameters with union type including array of objects", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/arrayTypeUnion").click()
|
||||
|
||||
cy.get(".model-example textarea")
|
||||
.should("exist")
|
||||
.and(
|
||||
"have.value",
|
||||
'[\n {\n "id": "string",\n "name": "string"\n }\n]'
|
||||
)
|
||||
})
|
||||
|
||||
it("should render schema for parameters with union type including array of objects", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/arrayTypeUnion").click()
|
||||
|
||||
cy.get(".model-example button").contains("Schema").click()
|
||||
cy.get(".model-example .json-schema-2020-12").should("exist")
|
||||
})
|
||||
|
||||
it("should render example for parameters of type array with union type of items including object", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/arrayItemTypeUnion").click()
|
||||
|
||||
cy.get(".model-example textarea")
|
||||
.should("exist")
|
||||
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
|
||||
})
|
||||
|
||||
it("should render schema for parameters of type array with union type of items including object", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/arrayItemTypeUnion").click()
|
||||
|
||||
cy.get(".model-example button").contains("Schema").click()
|
||||
cy.get(".model-example .json-schema-2020-12").should("exist")
|
||||
})
|
||||
|
||||
it("should render example for parameters with union type including array and union type of items including object", () => {
|
||||
cy.get(".opblock-summary-path span")
|
||||
.contains("/arrayTypeAndItemTypeUnion")
|
||||
.click()
|
||||
|
||||
cy.get(".model-example textarea")
|
||||
.should("exist")
|
||||
.and(
|
||||
"have.value",
|
||||
'[\n {\n "id": "string",\n "name": "string"\n }\n]'
|
||||
)
|
||||
})
|
||||
|
||||
it("should render example for parameters with union type including array and union type of items including object", () => {
|
||||
cy.get(".opblock-summary-path span")
|
||||
.contains("/arrayTypeAndItemTypeUnion")
|
||||
.click()
|
||||
|
||||
cy.get(".model-example button").contains("Schema").click()
|
||||
cy.get(".model-example .json-schema-2020-12").should("exist")
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
describe("Request body properties with schema and union type", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/oas31-request-body-complex-schema-properties.yaml"
|
||||
)
|
||||
})
|
||||
|
||||
it("should render example for properties with union type including object", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/objectTypeUnion").click()
|
||||
cy.get("button").contains("Try it out").click()
|
||||
|
||||
cy.get(".model-example textarea")
|
||||
.should("exist")
|
||||
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
|
||||
})
|
||||
|
||||
it("should render schema for properties with union type including object", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/objectTypeUnion").click()
|
||||
cy.get("button").contains("Try it out").click()
|
||||
|
||||
cy.get(".model-example button").contains("Schema").click()
|
||||
cy.get(".model-example .json-schema-2020-12").should("exist")
|
||||
})
|
||||
|
||||
it("should render example for properties with union type including array of objects", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/arrayTypeUnion").click()
|
||||
cy.get("button").contains("Try it out").click()
|
||||
|
||||
cy.get(".model-example textarea")
|
||||
.should("exist")
|
||||
.and(
|
||||
"have.value",
|
||||
'[\n {\n "id": "string",\n "name": "string"\n }\n]'
|
||||
)
|
||||
})
|
||||
|
||||
it("should render schema for properties with union type including array of objects", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/arrayTypeUnion").click()
|
||||
cy.get("button").contains("Try it out").click()
|
||||
|
||||
cy.get(".model-example button").contains("Schema").click()
|
||||
cy.get(".model-example .json-schema-2020-12").should("exist")
|
||||
})
|
||||
|
||||
it("should render example for properties of type array with union type of items including object", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/arrayItemTypeUnion").click()
|
||||
cy.get("button").contains("Try it out").click()
|
||||
|
||||
cy.get(".model-example textarea")
|
||||
.should("exist")
|
||||
.and("have.value", '{\n "id": "string",\n "name": "string"\n}')
|
||||
})
|
||||
|
||||
it("should render schema for properties of type array with union type of items including object", () => {
|
||||
cy.get(".opblock-summary-path span").contains("/arrayItemTypeUnion").click()
|
||||
cy.get("button").contains("Try it out").click()
|
||||
|
||||
cy.get(".model-example button").contains("Schema").click()
|
||||
cy.get(".model-example .json-schema-2020-12").should("exist")
|
||||
})
|
||||
|
||||
it("should render example for properties with union type including array and union type of items including object", () => {
|
||||
cy.get(".opblock-summary-path span")
|
||||
.contains("/arrayTypeAndItemTypeUnion")
|
||||
.click()
|
||||
cy.get("button").contains("Try it out").click()
|
||||
|
||||
cy.get(".model-example textarea")
|
||||
.should("exist")
|
||||
.and(
|
||||
"have.value",
|
||||
'[\n {\n "id": "string",\n "name": "string"\n }\n]'
|
||||
)
|
||||
})
|
||||
|
||||
it("should render example for properties with union type including array and union type of items including object", () => {
|
||||
cy.get(".opblock-summary-path span")
|
||||
.contains("/arrayTypeAndItemTypeUnion")
|
||||
.click()
|
||||
cy.get("button").contains("Try it out").click()
|
||||
|
||||
cy.get(".model-example button").contains("Schema").click()
|
||||
cy.get(".model-example .json-schema-2020-12").should("exist")
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @prettier
|
||||
*/
|
||||
|
||||
describe("OpenAPI 3.1.0 schema expansion", () => {
|
||||
it("should expand to the default expansion level", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/oas31-schema-expansion.yaml&defaultModelsExpandDepth=3&showExtensions=true"
|
||||
)
|
||||
|
||||
cy.get(".json-schema-2020-12-property").contains("prop2").should("exist")
|
||||
cy.get(".json-schema-2020-12-property")
|
||||
.contains("prop3")
|
||||
.should("not.exist")
|
||||
|
||||
cy.get(".json-schema-2020-12-keyword--xml")
|
||||
.contains("x-extension")
|
||||
.should("exist")
|
||||
cy.get(".json-schema-2020-12-keyword--xml")
|
||||
.contains("prop1")
|
||||
.should("not.exist")
|
||||
})
|
||||
|
||||
it("should deeply expand nested collapsed keywords", () => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/oas31-schema-expansion.yaml&showExtensions=true"
|
||||
)
|
||||
|
||||
cy.get(".json-schema-2020-12-expand-deep-button").click()
|
||||
cy.get(".json-schema-2020-12-keyword--xml")
|
||||
.contains("prop4")
|
||||
.should("exist")
|
||||
|
||||
cy.get(".json-schema-2020-12-keyword--xml").contains("prop1").click()
|
||||
cy.get(".json-schema-2020-12-keyword--xml")
|
||||
.contains("prop4")
|
||||
.should("not.exist")
|
||||
|
||||
cy.get(".json-schema-2020-12-keyword--xml").contains("XML").click()
|
||||
cy.get(
|
||||
".json-schema-2020-12-keyword--xml .json-schema-2020-12-expand-deep-button"
|
||||
)
|
||||
.first()
|
||||
.click()
|
||||
cy.get(".json-schema-2020-12-keyword--xml")
|
||||
.contains("prop4")
|
||||
.should("exist")
|
||||
})
|
||||
})
|
||||
@@ -9,7 +9,10 @@ describe("OpenAPI 3.0 Request Body upload file button", () => {
|
||||
.get("#operations-default-uploadApplicationOctetStream")
|
||||
.click()
|
||||
.get(".opblock-section-request-body .opblock-description-wrapper i")
|
||||
.should("have.text", "Example values are not available for application/octet-stream media types.")
|
||||
.should(
|
||||
"have.text",
|
||||
"Example values are not available for application/octet-stream media types."
|
||||
)
|
||||
})
|
||||
it("should display a file upload button", () => {
|
||||
cy.visit("/?url=/documents/features/request-body-upload-file.yaml")
|
||||
@@ -27,7 +30,10 @@ describe("OpenAPI 3.0 Request Body upload file button", () => {
|
||||
.get("#operations-default-uploadImagePng")
|
||||
.click()
|
||||
.get(".opblock-section-request-body .opblock-description-wrapper i")
|
||||
.should("have.text", "Example values are not available for image/png media types.")
|
||||
.should(
|
||||
"have.text",
|
||||
"Example values are not available for image/png media types."
|
||||
)
|
||||
})
|
||||
it("should display a file upload button", () => {
|
||||
cy.visit("/?url=/documents/features/request-body-upload-file.yaml")
|
||||
@@ -45,7 +51,10 @@ describe("OpenAPI 3.0 Request Body upload file button", () => {
|
||||
.get("#operations-default-uploadAudioWav")
|
||||
.click()
|
||||
.get(".opblock-section-request-body .opblock-description-wrapper i")
|
||||
.should("have.text", "Example values are not available for audio/wav media types.")
|
||||
.should(
|
||||
"have.text",
|
||||
"Example values are not available for audio/wav media types."
|
||||
)
|
||||
})
|
||||
it("should display a file upload button", () => {
|
||||
cy.visit("/?url=/documents/features/request-body-upload-file.yaml")
|
||||
@@ -63,7 +72,10 @@ describe("OpenAPI 3.0 Request Body upload file button", () => {
|
||||
.get("#operations-default-uploadVideoMpeg")
|
||||
.click()
|
||||
.get(".opblock-section-request-body .opblock-description-wrapper i")
|
||||
.should("have.text", "Example values are not available for video/mpeg media types.")
|
||||
.should(
|
||||
"have.text",
|
||||
"Example values are not available for video/mpeg media types."
|
||||
)
|
||||
})
|
||||
it("should display a file upload button", () => {
|
||||
cy.visit("/?url=/documents/features/request-body-upload-file.yaml")
|
||||
@@ -81,7 +93,10 @@ describe("OpenAPI 3.0 Request Body upload file button", () => {
|
||||
.get("#operations-default-uploadSchemaFormatBinary")
|
||||
.click()
|
||||
.get(".opblock-section-request-body .opblock-description-wrapper i")
|
||||
.should("have.text", "Example values are not available for application/x-custom media types.")
|
||||
.should(
|
||||
"have.text",
|
||||
"Example values are not available for application/x-custom media types."
|
||||
)
|
||||
})
|
||||
it("should display a file upload button", () => {
|
||||
cy.visit("/?url=/documents/features/request-body-upload-file.yaml")
|
||||
@@ -99,7 +114,10 @@ describe("OpenAPI 3.0 Request Body upload file button", () => {
|
||||
.get("#operations-default-uploadSchemaFormatBase64")
|
||||
.click()
|
||||
.get(".opblock-section-request-body .opblock-description-wrapper i")
|
||||
.should("have.text", "Example values are not available for application/x-custom media types.")
|
||||
.should(
|
||||
"have.text",
|
||||
"Example values are not available for application/x-custom media types."
|
||||
)
|
||||
})
|
||||
it("should display a file upload button", () => {
|
||||
cy.visit("/?url=/documents/features/request-body-upload-file.yaml")
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
|
||||
describe("JSON Schema Form: Enum & Boolean in a Parameter", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit(
|
||||
"/?url=/documents/features/schema-form-enum-boolean.yaml"
|
||||
)
|
||||
cy.visit("/?url=/documents/features/schema-form-enum-boolean.yaml")
|
||||
.get("#operations-pet-findPetsByStatus")
|
||||
.click()
|
||||
// Expand Try It Out
|
||||
@@ -47,56 +45,37 @@ describe("JSON Schema Form: Enum & Boolean in a Parameter", () => {
|
||||
})
|
||||
it("should NOT be able to execute with empty @enumIsRequired and @booleanIsRequired values", () => {
|
||||
// Execute
|
||||
cy.get("@executeBtn")
|
||||
.click()
|
||||
cy.get("@enumIsRequired")
|
||||
.should("have.class", "invalid")
|
||||
cy.get("@booleanIsRequired")
|
||||
.should("have.class", "invalid")
|
||||
cy.get("@executeBtn").click()
|
||||
cy.get("@enumIsRequired").should("have.class", "invalid")
|
||||
cy.get("@booleanIsRequired").should("have.class", "invalid")
|
||||
// cURL component
|
||||
cy.get(".responses-wrapper .curl-command")
|
||||
.should("not.exist")
|
||||
cy.get(".responses-wrapper .curl-command").should("not.exist")
|
||||
})
|
||||
it("should NOT be able to execute with empty @booleanIsRequired value, but valid @enumIsRequired", () => {
|
||||
cy.get("@enumIsRequired")
|
||||
.select("pending")
|
||||
cy.get("@enumIsRequired").select("pending")
|
||||
// Execute
|
||||
cy.get("@executeBtn")
|
||||
.click()
|
||||
cy.get("@enumIsRequired")
|
||||
.should("not.have.class", "invalid")
|
||||
cy.get("@booleanIsRequired")
|
||||
.should("have.class", "invalid")
|
||||
cy.get("@executeBtn").click()
|
||||
cy.get("@enumIsRequired").should("not.have.class", "invalid")
|
||||
cy.get("@booleanIsRequired").should("have.class", "invalid")
|
||||
// cURL component
|
||||
cy.get(".responses-wrapper .curl-command")
|
||||
.should("not.exist")
|
||||
cy.get(".responses-wrapper .curl-command").should("not.exist")
|
||||
})
|
||||
it("should NOT be able to execute with empty @enumIsRequired value, but valid @booleanIsRequired", () => {
|
||||
cy.get("@booleanIsRequired")
|
||||
.select("false")
|
||||
cy.get("@booleanIsRequired").select("false")
|
||||
// Execute
|
||||
cy.get("@executeBtn")
|
||||
.click()
|
||||
cy.get("@enumIsRequired")
|
||||
.should("have.class", "invalid")
|
||||
cy.get("@booleanIsRequired")
|
||||
.should("not.have.class", "invalid")
|
||||
cy.get("@executeBtn").click()
|
||||
cy.get("@enumIsRequired").should("have.class", "invalid")
|
||||
cy.get("@booleanIsRequired").should("not.have.class", "invalid")
|
||||
// cURL component
|
||||
cy.get(".responses-wrapper .curl-command")
|
||||
.should("not.exist")
|
||||
cy.get(".responses-wrapper .curl-command").should("not.exist")
|
||||
})
|
||||
it("should execute, if @booleanIsOptional value is 'false'", () => {
|
||||
cy.get("@enumIsRequired")
|
||||
.select("pending")
|
||||
cy.get("@booleanIsRequired")
|
||||
.select("false")
|
||||
cy.get("@booleanIsOptional")
|
||||
.select("false")
|
||||
cy.get("@enumIsRequired").select("pending")
|
||||
cy.get("@booleanIsRequired").select("false")
|
||||
cy.get("@booleanIsOptional").select("false")
|
||||
// Execute
|
||||
cy.get("@executeBtn")
|
||||
.click()
|
||||
cy.get("@enumIsRequired")
|
||||
.should("not.have.class", "invalid")
|
||||
cy.get("@executeBtn").click()
|
||||
cy.get("@enumIsRequired").should("not.have.class", "invalid")
|
||||
cy.get("@booleanIsRequired")
|
||||
.should("not.have.class", "invalid")
|
||||
.should("not.contains.text", "expectIsOptional")
|
||||
@@ -107,15 +86,11 @@ describe("JSON Schema Form: Enum & Boolean in a Parameter", () => {
|
||||
.should("contains.text", "expectIsOptional=false")
|
||||
})
|
||||
it("should execute, but NOT send @booleanIsOptional value if not provided", () => {
|
||||
cy.get("@enumIsRequired")
|
||||
.select("pending")
|
||||
cy.get("@booleanIsRequired")
|
||||
.select("false")
|
||||
cy.get("@enumIsRequired").select("pending")
|
||||
cy.get("@booleanIsRequired").select("false")
|
||||
// Execute
|
||||
cy.get("@executeBtn")
|
||||
.click()
|
||||
cy.get("@enumIsRequired")
|
||||
.should("not.have.class", "invalid")
|
||||
cy.get("@executeBtn").click()
|
||||
cy.get("@enumIsRequired").should("not.have.class", "invalid")
|
||||
cy.get("@booleanIsRequired")
|
||||
.should("not.have.class", "invalid")
|
||||
.should("not.contains.text", "expectIsOptional")
|
||||
@@ -125,5 +100,4 @@ describe("JSON Schema Form: Enum & Boolean in a Parameter", () => {
|
||||
.get(".responses-wrapper .curl-command span")
|
||||
.should("not.contains.text", "expectIsOptional")
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
@@ -9,9 +9,9 @@ describe("Parse YAML as YAML@1.2 with json_schema for all JSON-supported types",
|
||||
.click()
|
||||
// Responses -> example value tab
|
||||
.get(".language-json > :nth-child(3)")
|
||||
.should("have.text", "\"without-quotes\"")
|
||||
.should("have.text", '"without-quotes"')
|
||||
.get(".language-json > :nth-child(5)")
|
||||
.should("have.text", "\"1999-11-31\"")
|
||||
.should("have.text", '"1999-11-31"')
|
||||
// Responses -> schema tab
|
||||
.get(".model-example > .tab > :nth-child(2)")
|
||||
.click()
|
||||
|
||||
@@ -8,17 +8,17 @@ describe("Syntax Highlighting for JSON value cases", () => {
|
||||
describe("OAS 2", () => {
|
||||
it("should render full syntax highlighted string in Request (param body) example", () => {
|
||||
cy.visit("/?url=/documents/features/syntax-highlighting-json-oas2.yaml")
|
||||
.get("#operations-default-post_setServices")
|
||||
.click()
|
||||
.get(".body-param__example > .language-json > :nth-child(10)")
|
||||
.should("have.text", "\"79daf5b4-aa4b-1452-eae5-42c231477ba7\"")
|
||||
.get("#operations-default-post_setServices")
|
||||
.click()
|
||||
.get(".body-param__example > .language-json > :nth-child(10)")
|
||||
.should("have.text", '"79daf5b4-aa4b-1452-eae5-42c231477ba7"')
|
||||
})
|
||||
it("should render full syntax highlighted string in Response example", () => {
|
||||
cy.visit("/?url=/documents/features/syntax-highlighting-json-oas2.yaml")
|
||||
.get("#operations-default-post_setServices")
|
||||
.click()
|
||||
.get(".example > .language-json > :nth-child(28)")
|
||||
.should("have.text", "\"5ff06f632bb165394501b05d3a833355\"")
|
||||
.get("#operations-default-post_setServices")
|
||||
.click()
|
||||
.get(".example > .language-json > :nth-child(28)")
|
||||
.should("have.text", '"5ff06f632bb165394501b05d3a833355"')
|
||||
})
|
||||
})
|
||||
describe("OAS 3", () => {
|
||||
@@ -27,14 +27,14 @@ describe("Syntax Highlighting for JSON value cases", () => {
|
||||
.get("#operations-default-post_setServices")
|
||||
.click()
|
||||
.get(".body-param__example > .language-json > :nth-child(15)")
|
||||
.should("have.text", "\"22a124b4-594b-4452-bdf5-fc3ef1477ba7\"")
|
||||
.should("have.text", '"22a124b4-594b-4452-bdf5-fc3ef1477ba7"')
|
||||
})
|
||||
it("should render full syntax highlighted string in Response example", () => {
|
||||
cy.visit("/?url=/documents/features/syntax-highlighting-json-oas3.yaml")
|
||||
.get("#operations-default-post_setServices")
|
||||
.click()
|
||||
.get(".example > .language-json > :nth-child(33)")
|
||||
.should("have.text", "\"f0009babde9dbe204540d79cf754408e\"")
|
||||
.should("have.text", '"f0009babde9dbe204540d79cf754408e"')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user