response-extension.js 1.9 KB

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