fix: use specPath prop to resolve operations in OperationContainer (#4272)
* Use `parameterWithMeta` to get parameter data in <ParameterRow> * Prefer specPath when fetching resolved subtrees in OperationContainer * Add test for OAS3 callback rendering * Remove debugger statement
This commit is contained in:
41
test/e2e/scenarios/oas3/callbacks.js
Normal file
41
test/e2e/scenarios/oas3/callbacks.js
Normal file
@@ -0,0 +1,41 @@
|
||||
describe("render pet api container", function () {
|
||||
let mainPage
|
||||
let apiWrapper
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3200")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input", 5000)
|
||||
.pause(5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3200/test-specs/callbacks.openapi.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
apiWrapper = mainPage.section.apiWrapper
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
describe("POST /pet", () => {
|
||||
it("should render a callback correctly", function (client) {
|
||||
apiWrapper.waitForElementVisible("#operations-pet-addPet", 10000)
|
||||
// Expand the operation
|
||||
.click("#operations-pet-addPet")
|
||||
.waitForElementVisible("#operations-pet-addPet > div:nth-child(2) > div", 5000)
|
||||
// Switch to Callbacks tab
|
||||
.click("#operations-pet-addPet div.tab-header > div.tab-item.false > h4 > span")
|
||||
.waitForElementVisible("#operations-pet-addPet div.callbacks-container", 5000)
|
||||
.assert.containsText("#operations--post_request_body__url > div > span.opblock-summary-path", "$request.body#/url")
|
||||
.click("#operations--post_request_body__url")
|
||||
.waitForElementVisible("#operations--post_request_body__url div.response-col_description__inner > div > div > p", 5000)
|
||||
.assert.containsText("#operations--post_request_body__url div.response-col_description__inner > div > div > p", "webhook successfully processed and no retries will be performed")
|
||||
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
41
test/e2e/specs/callbacks.openapi.yaml
Normal file
41
test/e2e/specs/callbacks.openapi.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
openapi: 3.0.0
|
||||
servers:
|
||||
- url: http://petstore.swagger.io/v2
|
||||
info:
|
||||
version: 1.0.0
|
||||
title: Swagger Petstore
|
||||
termsOfService: http://swagger.io/terms/
|
||||
contact:
|
||||
email: apiteam@swagger.io
|
||||
license:
|
||||
name: Apache 2.0
|
||||
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
paths:
|
||||
"/pet":
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Add a new pet to the store
|
||||
description: ''
|
||||
operationId: addPet
|
||||
parameters: []
|
||||
responses:
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
callbacks:
|
||||
myWebhook:
|
||||
'$request.body#/url':
|
||||
post:
|
||||
requestBody:
|
||||
description: Callback payload
|
||||
content:
|
||||
'application/json':
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: webhook successfully processed and no retries will be performed
|
||||
Reference in New Issue
Block a user