diff --git a/src/core/plugins/oas31/components/webhooks.jsx b/src/core/plugins/oas31/components/webhooks.jsx index 49ce6b2f338..ce97f6d7fd1 100644 --- a/src/core/plugins/oas31/components/webhooks.jsx +++ b/src/core/plugins/oas31/components/webhooks.jsx @@ -7,6 +7,9 @@ import { List } from "immutable" const Webhooks = ({ specSelectors, getComponent }) => { const operationDTOs = specSelectors.selectWebhooksOperations() + if (!operationDTOs) { + return null + } const pathItemNames = Object.keys(operationDTOs) const OperationContainer = getComponent("OperationContainer", true) diff --git a/test/e2e-cypress/e2e/features/webhooks.cy.js b/test/e2e-cypress/e2e/features/webhooks.cy.js index aca41d30be1..e82d1017a77 100644 --- a/test/e2e-cypress/e2e/features/webhooks.cy.js +++ b/test/e2e-cypress/e2e/features/webhooks.cy.js @@ -16,10 +16,12 @@ describe("Render Webhooks Component", () => { }) }) describe("OpenAPI 3.0.x", () => { - const baseUrl = "/?url=/documents/features/webhooks-openAPI31.yaml" + const baseUrl = "/?url=/documents/features/webhooks-openAPI30.yaml" it("should render nothing", () => { cy.visit(baseUrl) - .get(".webhooks") + cy.get("#swagger-ui .information-container") + .should("exist") + cy.get(".webhooks", {timeout: 0}) .should("not.exist") }) })