|
| 1 | +describe("Response extension feature", () => { |
| 2 | + describe("in Swagger 2", () => { |
| 3 | + const swagger2BaseUrl = "/?showExtensions=true&docExpansion=full&url=/documents/features/response-extension.swagger.yaml" |
| 4 | + |
| 5 | + describe("without x- values", () => { |
| 6 | + it("should omit response extensions section", () => { |
| 7 | + cy.visit(swagger2BaseUrl) |
| 8 | + .get("tr.response[data-code='200'] td.response-col_description div.response__extension") |
| 9 | + .should("not.exist") |
| 10 | + }) |
| 11 | + }) |
| 12 | + |
| 13 | + describe("with x- values", () => { |
| 14 | + it("should list each value", () => { |
| 15 | + const page = cy.visit(swagger2BaseUrl) |
| 16 | + |
| 17 | + page.get("tr.response[data-code='404'] td.response-col_description div.response__extension:nth-child(2)") |
| 18 | + .should("have.text", "x-error: true") |
| 19 | + |
| 20 | + page.get("tr.response[data-code='404'] td.response-col_description div.response__extension:nth-child(3)") |
| 21 | + .should("have.text", "x-error-codes: List [ \"NOT_FOUND\" ]") |
| 22 | + }) |
| 23 | + }) |
| 24 | + }) |
| 25 | + |
| 26 | + describe("in OpenAPI 3", () => { |
| 27 | + const openAPI3BaseUrl = "/?showExtensions=true&docExpansion=full&url=/documents/features/response-extension.openapi.yaml" |
| 28 | + |
| 29 | + describe("without x- values", () => { |
| 30 | + it("should omit response extensions section", () => { |
| 31 | + cy.visit(openAPI3BaseUrl) |
| 32 | + .get("tr.response[data-code='200'] td.response-col_description div.response__extension") |
| 33 | + .should("not.exist") |
| 34 | + }) |
| 35 | + }) |
| 36 | + |
| 37 | + describe("with x- values", () => { |
| 38 | + it("should list each value", () => { |
| 39 | + const page = cy.visit(openAPI3BaseUrl) |
| 40 | + |
| 41 | + page.get("tr.response[data-code='404'] td.response-col_description div.response__extension:nth-child(2)") |
| 42 | + .should("have.text", "x-error: true") |
| 43 | + |
| 44 | + page.get("tr.response[data-code='404'] td.response-col_description div.response__extension:nth-child(3)") |
| 45 | + .should("have.text", "x-error-codes: List [ \"NOT_FOUND\" ]") |
| 46 | + }) |
| 47 | + }) |
| 48 | + }) |
| 49 | +}) |
0 commit comments