feat: add tryItOutEnabled configuration (#6865)
* feat: add tryItOutEnabled configuration allow users to set tryItOutEnabled: true to display the "Try it out" section by default tryItOutEnabled to take === "true" for the query string value or === true if someone implements query string type parsing in the query
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
openapi: 3.0.2
|
||||
info:
|
||||
title: try it out enabled test
|
||||
version: 0.0.1
|
||||
description: |-
|
||||
a simple test to ensure tryItOutEnabled=true expands "Try it out"
|
||||
paths:
|
||||
/:
|
||||
get:
|
||||
summary: an operation
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
22
test/e2e-cypress/tests/features/try-it-out-enabled.js
Normal file
22
test/e2e-cypress/tests/features/try-it-out-enabled.js
Normal file
@@ -0,0 +1,22 @@
|
||||
describe("Try it out enabled configuration", () => {
|
||||
it("should enable the try it out section when true", () => {
|
||||
|
||||
cy
|
||||
.visit("?tryItOutEnabled=true&url=/documents/features/try-it-out-enabled.yaml")
|
||||
.get("#operations-default-get_")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.should("have.text","Cancel")
|
||||
})
|
||||
|
||||
it("should disable the try it out section when false", () => {
|
||||
|
||||
cy
|
||||
.visit("?tryItOutEnabled=false&url=/documents/features/try-it-out-enabled.yaml")
|
||||
.get("#operations-default-get_")
|
||||
.click()
|
||||
.get(".try-out__btn")
|
||||
.should("have.text","Try it out ")
|
||||
})
|
||||
})
|
||||
|
||||
@@ -245,6 +245,7 @@ describe("docker: env translator", function() {
|
||||
OAUTH2_REDIRECT_URL: "http://google.com/",
|
||||
SHOW_MUTATED_REQUEST: "true",
|
||||
SUPPORTED_SUBMIT_METHODS: `["get", "post"]`,
|
||||
TRY_IT_OUT_ENABLED: "true",
|
||||
VALIDATOR_URL: "http://smartbear.com/"
|
||||
}
|
||||
|
||||
@@ -270,6 +271,7 @@ describe("docker: env translator", function() {
|
||||
oauth2RedirectUrl: "http://google.com/",
|
||||
showMutatedRequest: true,
|
||||
supportedSubmitMethods: ["get", "post"],
|
||||
tryItOutEnabled: true,
|
||||
validatorUrl: "http://smartbear.com/",`
|
||||
).trim())
|
||||
})
|
||||
@@ -299,6 +301,7 @@ describe("docker: env translator", function() {
|
||||
OAUTH2_REDIRECT_URL: "http://google.com/",
|
||||
SHOW_MUTATED_REQUEST: "true",
|
||||
SUPPORTED_SUBMIT_METHODS: `["get", "post"]`,
|
||||
TRY_IT_OUT_ENABLED: "false",
|
||||
VALIDATOR_URL: "http://smartbear.com/"
|
||||
}
|
||||
|
||||
@@ -331,6 +334,7 @@ describe("docker: env translator", function() {
|
||||
oauth2RedirectUrl: "http://google.com/",
|
||||
showMutatedRequest: true,
|
||||
supportedSubmitMethods: ["get", "post"],
|
||||
tryItOutEnabled: false,
|
||||
validatorUrl: "http://smartbear.com/",`
|
||||
).trim())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user