api
This commit is contained in:
2
frontend/web/api-doc/test/e2e-selenium/README.md
Normal file
2
frontend/web/api-doc/test/e2e-selenium/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
These tests are currently broken, and need to be either updated or migrated into
|
||||
`../e2e-cypress`.
|
220
frontend/web/api-doc/test/e2e-selenium/db.json
Normal file
220
frontend/web/api-doc/test/e2e-selenium/db.json
Normal file
@ -0,0 +1,220 @@
|
||||
{
|
||||
"pet": [
|
||||
{
|
||||
"id": 1,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
},
|
||||
{
|
||||
"id": 11,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
},
|
||||
{
|
||||
"id": 12,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
}
|
||||
]
|
||||
}
|
31
frontend/web/api-doc/test/e2e-selenium/nightwatch.json
Normal file
31
frontend/web/api-doc/test/e2e-selenium/nightwatch.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"src_folders" : ["test/e2e-selenium/scenarios"],
|
||||
"output_folder" : "reports",
|
||||
"live_output": true,
|
||||
"custom_commands_path" : "",
|
||||
"custom_assertions_path" : "",
|
||||
"page_objects_path" : "test/e2e-selenium/pages",
|
||||
"globals_path" : "",
|
||||
|
||||
"test_runner" : {
|
||||
"type" : "mocha",
|
||||
"options" : {
|
||||
"ui" : "bdd",
|
||||
"reporter" : "list"
|
||||
}
|
||||
},
|
||||
|
||||
"webdriver": {
|
||||
"start_process": true,
|
||||
"server_path": "node_modules/.bin/chromedriver",
|
||||
"port": 9515
|
||||
},
|
||||
|
||||
"test_settings": {
|
||||
"default": {
|
||||
"desiredCapabilities": {
|
||||
"browserName": "chrome"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
544
frontend/web/api-doc/test/e2e-selenium/pages/main.js
Normal file
544
frontend/web/api-doc/test/e2e-selenium/pages/main.js
Normal file
@ -0,0 +1,544 @@
|
||||
module.exports = {
|
||||
sections: {
|
||||
topbar: {
|
||||
selector: ".topbar",
|
||||
elements: {
|
||||
inputBox: {
|
||||
selector: "input"
|
||||
},
|
||||
btnExplore: {
|
||||
selector: "button"
|
||||
}
|
||||
}
|
||||
},
|
||||
informationContainer: {
|
||||
selector: ".information-container.wrapper",
|
||||
elements: {
|
||||
title: {
|
||||
selector: ".title"
|
||||
},
|
||||
version: {
|
||||
selector: ".version"
|
||||
},
|
||||
baseUrl: {
|
||||
selector: ".base-url"
|
||||
},
|
||||
mainUrl: {
|
||||
selector: ".main a"
|
||||
},
|
||||
mainUrlContent: {
|
||||
selector: ".main a span"
|
||||
},
|
||||
description: {
|
||||
selector: ".description p"
|
||||
},
|
||||
swaggerUrl: {
|
||||
selector: ".description p a:nth-of-type(1)"
|
||||
},
|
||||
swaggerircUrl: {
|
||||
selector: ".description p a:nth-of-type(2)"
|
||||
},
|
||||
termsLink: {
|
||||
selector: ".info > div:nth-child(3) a"
|
||||
},
|
||||
contactDevLink: {
|
||||
selector: ".info > div:nth-child(4) a"
|
||||
},
|
||||
apacheLink: {
|
||||
selector: ".info > div:nth-child(5) a"
|
||||
},
|
||||
aboutSwaggerLink: {
|
||||
selector: ".info > a"
|
||||
}
|
||||
}
|
||||
},
|
||||
schemeContainer: {
|
||||
selector: ".scheme-container",
|
||||
elements: {
|
||||
httpOption: {
|
||||
selector: "select option"
|
||||
},
|
||||
btnAuthorize: {
|
||||
selector: "button.authorize"
|
||||
},
|
||||
authorizationModal: {
|
||||
selector: ".dialog-ux"
|
||||
},
|
||||
appName: {
|
||||
selector: ".auth-container h5"
|
||||
},
|
||||
authorizationUrl: {
|
||||
selector: ".auth-container code"
|
||||
},
|
||||
readPetsScope: {
|
||||
selector: "input[data-value='read:pets']"
|
||||
},
|
||||
writePetsScope: {
|
||||
selector: "input[data-value='write:pets']"
|
||||
},
|
||||
selectAllScopes: {
|
||||
selector: ".auth-container h2 a[data-all]"
|
||||
},
|
||||
selectNoneScopes: {
|
||||
selector: ".auth-container h2 a:not([data-all])"
|
||||
},
|
||||
flow: {
|
||||
selector: ".flow code"
|
||||
},
|
||||
inputClientID: {
|
||||
selector: "#client_id"
|
||||
},
|
||||
checkWritePetStoreAuth: {
|
||||
selector: "#write:pets-checkbox-petstore_auth"
|
||||
},
|
||||
checkReadPetStoreAuth: {
|
||||
selector: "#read:pets-checkbox-petstore_auth"
|
||||
}
|
||||
}
|
||||
},
|
||||
apiWrapper: {
|
||||
selector: "div.swagger-ui > div:nth-child(2) > div:nth-child(4) > section > div",
|
||||
elements: {
|
||||
petAPIWrapper: {
|
||||
selector: "div.swagger-ui div:nth-child(4) > section > div > span:nth-child(1) > div"
|
||||
},
|
||||
petAPIWrapperBar: {
|
||||
selector: "div.swagger-ui div:nth-child(4) > section > div > span:nth-child(1) > div .opblock-tag"
|
||||
},
|
||||
|
||||
/**
|
||||
* Post pet/ api
|
||||
*/
|
||||
petOperationPostContainer: {
|
||||
selector: "div#operations-pet-addPet"
|
||||
},
|
||||
petOperationPostTitle: {
|
||||
selector: "div#operations-pet-addPet .opblock-summary-post span.opblock-summary-path span"
|
||||
},
|
||||
petOperationPostCollpase: {
|
||||
selector: "div#operations-pet-addPet .opblock-summary-post"
|
||||
},
|
||||
petOperationPostCollapseContainer: {
|
||||
selector: "div#operations-pet-addPet>div:nth-child(2)"
|
||||
},
|
||||
petOperationPostTryBtn: {
|
||||
selector: "div#operations-pet-addPet button.try-out__btn"
|
||||
},
|
||||
petOperationPostTryText: {
|
||||
selector: "div#operations-pet-addPet textarea.body-param__text"
|
||||
},
|
||||
petOperationPostExecuteBtn: {
|
||||
selector: "div#operations-pet-addPet button.execute"
|
||||
},
|
||||
petOperationPostTryTextArea: {
|
||||
selector: "div#operations-pet-addPet textarea"
|
||||
},
|
||||
petOperationPostResultsBox: {
|
||||
selector: "div#operations-pet-addPet pre.microlight"
|
||||
},
|
||||
petOperationPostMockCategoryID: {
|
||||
selector: "div#operations-pet-addPet pre.microlight span:nth-child(17)"
|
||||
},
|
||||
petOperationPostMockCategoryName: {
|
||||
selector: "div#operations-pet-addPet pre.microlight span:nth-child(23)"
|
||||
},
|
||||
petOperationPostMockName: {
|
||||
selector: "div#operations-pet-addPet pre.microlight span:nth-child(31)"
|
||||
},
|
||||
petOperationPostTagID: {
|
||||
selector: "div#operations-pet-addPet pre.microlight span:nth-child(54)"
|
||||
},
|
||||
petOperationPostTagName: {
|
||||
selector: "div#operations-pet-addPet pre.microlight span:nth-child(60)"
|
||||
},
|
||||
petOperationPostStatus: {
|
||||
selector: "div#operations-pet-addPet pre.microlight span:nth-child(70)"
|
||||
},
|
||||
|
||||
/**
|
||||
* Put pet/ api
|
||||
*/
|
||||
petOperationPutContainer: {
|
||||
selector: "div#operations-pet-updatePet"
|
||||
},
|
||||
petOperationPutTitle: {
|
||||
selector: "div#operations-pet-updatePet .opblock-summary-put span.opblock-summary-path span"
|
||||
},
|
||||
petOperationPutCollpase: {
|
||||
selector: "div#operations-pet-updatePet .opblock-summary-put"
|
||||
},
|
||||
petOperationPutCollapseContainer: {
|
||||
selector: "div#operations-pet-updatePet>div:nth-child(2)"
|
||||
},
|
||||
petOperationPutTryBtn: {
|
||||
selector: "div#operations-pet-updatePet button.try-out__btn"
|
||||
},
|
||||
petOperationPutTryText: {
|
||||
selector: "div#operations-pet-updatePet textarea.body-param__text"
|
||||
},
|
||||
petOperationPutExecuteBtn: {
|
||||
selector: "div#operations-pet-updatePet button.execute"
|
||||
},
|
||||
petOperationPutTryTextArea: {
|
||||
selector: "div#operations-pet-updatePet textarea"
|
||||
},
|
||||
petOperationPutResultsBox: {
|
||||
selector: "div#operations-pet-updatePet pre.microlight"
|
||||
},
|
||||
petOperationPutMockCategoryID: {
|
||||
selector: "div#operations-pet-updatePet pre.microlight span:nth-child(17)"
|
||||
},
|
||||
petOperationPutMockCategoryName: {
|
||||
selector: "div#operations-pet-updatePet pre.microlight span:nth-child(23)"
|
||||
},
|
||||
petOperationPutMockName: {
|
||||
selector: "div#operations-pet-updatePet pre.microlight span:nth-child(31)"
|
||||
},
|
||||
petOperationPutTagID: {
|
||||
selector: "div#operations-pet-updatePet pre.microlight span:nth-child(54)"
|
||||
},
|
||||
petOperationPutTagName: {
|
||||
selector: "div#operations-pet-updatePet pre.microlight span:nth-child(60)"
|
||||
},
|
||||
petOperationPutStatus: {
|
||||
selector: "div#operations-pet-updatePet pre.microlight span:nth-child(70)"
|
||||
},
|
||||
|
||||
/**
|
||||
* Get /pet/findByTags
|
||||
*/
|
||||
petOperationGetByTagContainer: {
|
||||
selector: "div#operations-pet-findPetsByTags"
|
||||
},
|
||||
petOperationGetByTagTitle: {
|
||||
selector: "div#operations-pet-findPetsByTags .opblock-summary-get span.opblock-summary-path__deprecated span"
|
||||
},
|
||||
petOperationGetByTagCollpase: {
|
||||
selector: "div#operations-pet-findPetsByTags .opblock-summary-get"
|
||||
},
|
||||
petOperationGetByTagCollapseContainer: {
|
||||
selector: "div#operations-pet-findPetsByTags .ReactCollapse--collapse"
|
||||
},
|
||||
petOperationGetByTagTryBtn: {
|
||||
selector: "div#operations-pet-findPetsByTags button.try-out__btn"
|
||||
},
|
||||
petOperationGetByTagTryAdded: {
|
||||
selector: "div#operations-pet-findPetsByTags button.json-schema-form-item-add"
|
||||
},
|
||||
petOperationGetByTagExecuteBtn: {
|
||||
selector: "div#operations-pet-findPetsByTags button.execute"
|
||||
},
|
||||
petOperationGetByTagTryTextArea: {
|
||||
selector: "div#operations-pet-findPetsByTags textarea"
|
||||
},
|
||||
petOperationGetByTagResultsBox: {
|
||||
selector: "div#operations-pet-findPetsByTags pre.microlight"
|
||||
},
|
||||
petOperationGetByTagMockCategoryID: {
|
||||
selector: "div#operations-pet-findPetsByTags pre.microlight span:nth-child(17)"
|
||||
},
|
||||
petOperationGetByTagMockCategoryName: {
|
||||
selector: "div#operations-pet-findPetsByTags pre.microlight span:nth-child(23)"
|
||||
},
|
||||
petOperationGetByTagMockName: {
|
||||
selector: "div#operations-pet-findPetsByTags pre.microlight span:nth-child(31)"
|
||||
},
|
||||
petOperationGetByTagTagID: {
|
||||
selector: "div#operations-pet-findPetsByTags pre.microlight span:nth-child(54)"
|
||||
},
|
||||
petOperationGetByTagTagName: {
|
||||
selector: "div#operations-pet-findPetsByTags pre.microlight span:nth-child(60)"
|
||||
},
|
||||
petOperationGetByTagStatus: {
|
||||
selector: "div#operations-pet-findPetsByTags pre.microlight span:nth-child(70)"
|
||||
},
|
||||
|
||||
/**
|
||||
* Get /pet/{petId}
|
||||
*/
|
||||
petOperationGetByIdContainer: {
|
||||
selector: "div#operations-pet-getPetById"
|
||||
},
|
||||
petOperationGetByIdTitle: {
|
||||
selector: "div#operations-pet-getPetById .opblock-summary-get span.opblock-summary-path span"
|
||||
},
|
||||
petOperationGetByIdCollpase: {
|
||||
selector: "div#operations-pet-getPetById .opblock-summary-get"
|
||||
},
|
||||
petOperationGetByIdCollapseContainer: {
|
||||
selector: "div#operations-pet-getPetById .ReactCollapse--collapse"
|
||||
},
|
||||
petOperationGetByIdTryBtn: {
|
||||
selector: "div#operations-pet-getPetById button.try-out__btn"
|
||||
},
|
||||
petOperationGetByIdExecuteBtn: {
|
||||
selector: "div#operations-pet-getPetById button.execute"
|
||||
},
|
||||
petOperationGetByIdParameter: {
|
||||
selector: "div#operations-pet-getPetById div.parameters-col_description input"
|
||||
},
|
||||
petOperationGetByIdResultsBox: {
|
||||
selector: "div#operations-pet-getPetById pre.microlight"
|
||||
},
|
||||
|
||||
/**
|
||||
* Delete pet/
|
||||
*/
|
||||
petOperationDeleteContainer: {
|
||||
selector: "div#operations-pet-deletePet"
|
||||
},
|
||||
petOperationDeleteTitle: {
|
||||
selector: "div#operations-pet-deletePet .opblock-summary-delete span.opblock-summary-path span"
|
||||
},
|
||||
petOperationDeleteCollpase: {
|
||||
selector: "div#operations-pet-deletePet .opblock-summary-delete"
|
||||
},
|
||||
petOperationDeleteCollapseContainer: {
|
||||
selector: "div#operations-pet-deletePet>div:nth-child(2)"
|
||||
},
|
||||
petOperationDeleteTryBtn: {
|
||||
selector: "div#operations-pet-deletePet button.try-out__btn"
|
||||
},
|
||||
petOperationDeleteExecuteBtn: {
|
||||
selector: "div#operations-pet-deletePet button.execute"
|
||||
},
|
||||
petOperationDeleteTryTextArea: {
|
||||
selector: "div#operations-pet-deletePet textarea"
|
||||
},
|
||||
petOperationDeleteResultsBox: {
|
||||
selector: "div#operations-pet-deletePet pre.microlight"
|
||||
},
|
||||
petOperationDeleteMockCategoryID: {
|
||||
selector: "div#operations-pet-deletePet pre.microlight span:nth-child(17)"
|
||||
},
|
||||
petOperationDeleteMockCategoryName: {
|
||||
selector: "div#operations-pet-deletePet pre.microlight span:nth-child(23)"
|
||||
},
|
||||
petOperationDeleteMockName: {
|
||||
selector: "div#operations-pet-deletePet pre.microlight span:nth-child(31)"
|
||||
},
|
||||
petOperationDeleteTagID: {
|
||||
selector: "div#operations-pet-deletePet pre.microlight span:nth-child(54)"
|
||||
},
|
||||
petOperationDeleteTagName: {
|
||||
selector: "div#operations-pet-deletePet pre.microlight span:nth-child(60)"
|
||||
},
|
||||
petOperationDeleteStatus: {
|
||||
selector: "div#operations-pet-deletePet pre.microlight span:nth-child(70)"
|
||||
},
|
||||
|
||||
/**
|
||||
* ***********Store************
|
||||
*/
|
||||
storeAPIWrapper: {
|
||||
selector: "div.swagger-ui div:nth-child(4) > section > div > span:nth-child(2) > div"
|
||||
},
|
||||
storeAPIWrapperBar: {
|
||||
selector: "div.swagger-ui div:nth-child(4) > section > div > span:nth-child(2) > div .opblock-tag"
|
||||
},
|
||||
/**
|
||||
* Get /store/inventory
|
||||
*/
|
||||
storeOperationGetContainer: {
|
||||
selector: "div#operations-store-getInventory"
|
||||
},
|
||||
storeOperationGetTitle: {
|
||||
selector: "div#operations-store-getInventory .opblock-summary-get span.opblock-summary-path span"
|
||||
},
|
||||
storeOperationGetCollpase: {
|
||||
selector: "div#operations-store-getInventory .opblock-summary-get"
|
||||
},
|
||||
storeOperationGetCollapseContainer: {
|
||||
selector: "div#operations-store-getInventory>div:nth-child(2)"
|
||||
},
|
||||
storeOperationGetTryBtn: {
|
||||
selector: "div#operations-store-getInventory button.try-out__btn"
|
||||
},
|
||||
storeOperationGetExecuteBtn: {
|
||||
selector: "div#operations-store-getInventory button.execute"
|
||||
},
|
||||
storeOperationResponseProps1: {
|
||||
selector: "div#operations-store-getInventory pre.example.microlight span:nth-child(6)"
|
||||
},
|
||||
storeOperationResponseProps2: {
|
||||
selector: "div#operations-store-getInventory pre.example.microlight span:nth-child(12)"
|
||||
},
|
||||
storeOperationResponseProps3: {
|
||||
selector: "div#operations-store-getInventory pre.example.microlight span:nth-child(18)"
|
||||
},
|
||||
/**
|
||||
* Post /store/order
|
||||
*/
|
||||
storeOperationPostContainer: {
|
||||
selector: "div#operations-store-placeOrder"
|
||||
},
|
||||
storeOperationPostTitle: {
|
||||
selector: "div#operations-store-placeOrder .opblock-summary-post span.opblock-summary-path span"
|
||||
},
|
||||
storeOperationPostCollpase: {
|
||||
selector: "div#operations-store-placeOrder .opblock-summary-post"
|
||||
},
|
||||
storeOperationPostCollapseContainer: {
|
||||
selector: "div#operations-store-placeOrder>div:nth-child(2)"
|
||||
},
|
||||
storeOperationPostTryBtn: {
|
||||
selector: "div#operations-store-placeOrder button.try-out__btn"
|
||||
},
|
||||
storeOperationPostExecuteBtn: {
|
||||
selector: "div#operations-store-placeOrder button.execute"
|
||||
},
|
||||
storeOperationPostResponseId: {
|
||||
selector: "div#operations-store-placeOrder pre.example.microlight span:nth-child(22)"
|
||||
},
|
||||
storeOperationPostResponsePetId: {
|
||||
selector: "div#operations-store-placeOrder pre.example.microlight span:nth-child(31)"
|
||||
},
|
||||
storeOperationPostResponseQuantity: {
|
||||
selector: "div#operations-store-placeOrder pre.example.microlight span:nth-child(40)"
|
||||
},
|
||||
storeOperationPostResponseStatus: {
|
||||
selector: "div#operations-store-placeOrder pre.example.microlight span:nth-child(66)"
|
||||
},
|
||||
storeOperationPostResponseComplete: {
|
||||
selector: "div#operations-store-placeOrder pre.example.microlight span:nth-child(75)"
|
||||
},
|
||||
/**
|
||||
* Delete /store/order/{orderId}
|
||||
*/
|
||||
storeOperationDeleteContainer: {
|
||||
selector: "div#operations-store-deleteOrder"
|
||||
},
|
||||
storeOperationDeleteTitle: {
|
||||
selector: "div#operations-store-deleteOrder .opblock-summary-delete span.opblock-summary-path span"
|
||||
},
|
||||
storeOperationDeleteCollpase: {
|
||||
selector: "div#operations-store-deleteOrder .opblock-summary-delete"
|
||||
},
|
||||
storeOperationDeleteCollapseContainer: {
|
||||
selector: "div#operations-store-deleteOrder>div:nth-child(2)"
|
||||
},
|
||||
storeOperationDeleteTryBtn: {
|
||||
selector: "div#operations-store-deleteOrder button.try-out__btn"
|
||||
},
|
||||
storeOperationDeleteExecuteBtn: {
|
||||
selector: "div#operations-store-deleteOrder button.execute"
|
||||
},
|
||||
storeOperationGetResponseHeaders: {
|
||||
selector: "div#operations-store-deleteOrder pre span"
|
||||
},
|
||||
/**
|
||||
* *********User**************
|
||||
*/
|
||||
userAPIWrapper: {
|
||||
selector: "div.swagger-ui div:nth-child(4) > section > div > span:nth-child(3) > div"
|
||||
},
|
||||
userAPIWrapperBar: {
|
||||
selector: "div.swagger-ui div:nth-child(4) > section > div > span:nth-child(3) > div .opblock-tag"
|
||||
},
|
||||
/**
|
||||
* Put /user/login
|
||||
*/
|
||||
userOperationPutContainer: {
|
||||
selector: "div#operations-user-updateUser"
|
||||
},
|
||||
userOperationPutTitle: {
|
||||
selector: "div#operations-user-updateUser .opblock-summary-put span.opblock-summary-path span"
|
||||
},
|
||||
userOperationPutCollpase: {
|
||||
selector: "div#operations-user-updateUser .opblock-summary-put"
|
||||
},
|
||||
userOperationPutCollapseContainer: {
|
||||
selector: "div#operations-user-updateUser>div:nth-child(2)"
|
||||
},
|
||||
userOperationPutTryBtn: {
|
||||
selector: "div#operations-user-updateUser button.try-out__btn"
|
||||
},
|
||||
userOperationPutExecuteBtn: {
|
||||
selector: "div#operations-user-updateUser button.execute"
|
||||
},
|
||||
userOperationPutParameter: {
|
||||
selector: "div#operations-user-updateUser div.parameters-col_description input"
|
||||
},
|
||||
userOperationPutResponseHeader: {
|
||||
selector: "div#operations-user-updateUser div.parameters-col_description input"
|
||||
},
|
||||
/**
|
||||
* Delete /user
|
||||
*/
|
||||
userOperationDeleteContainer: {
|
||||
selector: "div#operations-user-deleteUser"
|
||||
},
|
||||
userOperationDeleteTitle: {
|
||||
selector: "div#operations-user-deleteUser .opblock-summary-delete span.opblock-summary-path span"
|
||||
},
|
||||
userOperationDeleteCollpase: {
|
||||
selector: "div#operations-user-deleteUser .opblock-summary-delete"
|
||||
},
|
||||
userOperationDeleteCollapseContainer: {
|
||||
selector: "div#operations-user-deleteUser>div:nth-child(2)"
|
||||
},
|
||||
userOperationDeleteTryBtn: {
|
||||
selector: "div#operations-user-deleteUser button.try-out__btn"
|
||||
},
|
||||
userOperationDeleteExecuteBtn: {
|
||||
selector: "div#operations-user-deleteUser button.execute"
|
||||
},
|
||||
userOperationDeleteParameter: {
|
||||
selector: "div#operations-user-deleteUser div.parameters-col_description input"
|
||||
},
|
||||
userOperationDeleteResponseHeader: {
|
||||
selector: "div#operations-user-deleteUser div.parameters-col_description input"
|
||||
},
|
||||
|
||||
}
|
||||
},
|
||||
/* Model Container */
|
||||
modelWrapper: {
|
||||
selector: "div.swagger-ui > div:nth-child(2) > div:nth-child(5)",
|
||||
elements: {
|
||||
modelContainer: {
|
||||
selector: ".swagger-ui .models"
|
||||
},
|
||||
modelCollapse: {
|
||||
selector: ".swagger-ui .models h4"
|
||||
},
|
||||
orderModel: {
|
||||
selector: "section.models div.model-container:nth-child(1)"
|
||||
},
|
||||
orderModelCallapse: {
|
||||
selector: "section.models div.model-container:nth-child(1) span.model-toggle"
|
||||
},
|
||||
categoryModel: {
|
||||
selector: "section.models div.model-container:nth-child(2)"
|
||||
},
|
||||
categoryModelCallapse: {
|
||||
selector: "section.models div.model-container:nth-child(2) span.model-toggle"
|
||||
},
|
||||
userModel: {
|
||||
selector: "section.models div.model-container:nth-child(3)"
|
||||
},
|
||||
userModelCallapse: {
|
||||
selector: "section.models div.model-container:nth-child(3) span.model-toggle"
|
||||
},
|
||||
tagModel: {
|
||||
selector: "section.models div.model-container:nth-child(4)"
|
||||
},
|
||||
tagModelCallapse: {
|
||||
selector: "section.models div.model-container:nth-child(4) span.model-toggle"
|
||||
},
|
||||
petModel: {
|
||||
selector: "section.models div.model-container:nth-child(5)"
|
||||
},
|
||||
petModelCallapse: {
|
||||
selector: "section.models div.model-container:nth-child(5) span.model-toggle"
|
||||
},
|
||||
apiResponseModel: {
|
||||
selector: "section.models div.model-container:nth-child(6)"
|
||||
},
|
||||
apiResponseModelCallapse: {
|
||||
selector: "section.models div.model-container:nth-child(6) span.model-toggle"
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
describe("bug #4196: HTTP basic auth credential retention", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4196.yaml")
|
||||
.click("button.download-url-button")
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("should display the most recent auth data across modal close/opens", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.click("button.btn.authorize") // Open modal
|
||||
.waitForElementVisible("section>input", 5000)
|
||||
.setValue("section>input", "aaa") // Set user
|
||||
.waitForElementVisible(`section>input[type="password"]`, 5000)
|
||||
.setValue(`section>input[type="password"]`, "aaa") // Set password
|
||||
.click(".auth-btn-wrapper button:nth-child(1)") // Click Authorize
|
||||
.assert.containsText("div.wrapper:nth-child(4)>code", "aaa")
|
||||
.click(".auth-btn-wrapper button:nth-child(2)") // Close modal
|
||||
.pause(50)
|
||||
.click("button.btn.authorize") // Open modal
|
||||
.pause(50)
|
||||
.click(".auth-btn-wrapper button:nth-child(1)") // Logout
|
||||
.waitForElementVisible("section>input", 5000)
|
||||
.setValue("section>input", "bbb") // Set user
|
||||
.waitForElementVisible(`section>input[type="password"]`, 5000)
|
||||
.setValue(`section>input[type="password"]`, "bbb") // Set password
|
||||
.click(".auth-btn-wrapper button:nth-child(1)") // Click Authorize
|
||||
.pause(1000)
|
||||
.assert.containsText("div.wrapper:nth-child(4)>code", "bbb")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,31 @@
|
||||
describe("bug #4374: OAS3 parameters should be visibly validated in Try-It-Out", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 10000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/bugs/4374.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("indicates an error when a required parameter is not selected", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/pet/findByStatus")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.click(".try-out__btn")
|
||||
.click(".btn.execute")
|
||||
.pause(100)
|
||||
.assert.cssClassPresent(".parameters-col_description select", "invalid")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,28 @@
|
||||
describe("bug #4409: operationId normalization and layout tracking", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4409.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("expands an operation that has a normalizable operationId", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/myApi")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock-body", 5000)
|
||||
.assert.cssClassPresent(".opblock", "is-open")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,28 @@
|
||||
describe("bug #4409: operationId normalization and layout tracking", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4409.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("expands an operation that has a normalizable operationId", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/myApi")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock-body", 5000)
|
||||
.assert.cssClassPresent(".opblock", "is-open")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,28 @@
|
||||
describe("bug #4409: operationId normalization and layout tracking", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4409.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("expands an operation that has a normalizable operationId", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/myApi")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock-body", 5000)
|
||||
.assert.cssClassPresent(".opblock", "is-open")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,28 @@
|
||||
describe("bug #4536: model name consistency", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4536.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("consistently displays a model's name regardless of expansion state", function (client) {
|
||||
client.waitForElementVisible("span.model.model-title", 10000)
|
||||
.assert.containsText("span.model.model-title", "TitleName")
|
||||
.click("span.model.model-title")
|
||||
.pause(500)
|
||||
.assert.containsText("span.model-title__text", "TitleName")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,35 @@
|
||||
describe("bug #4587: clearing header param values", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4587.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
|
||||
it("sets a required initial value based the first enum value", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.click("#operations-sql-execSql")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.setValue(`tr[data-param-name="x-irest-conn"] input`, "hi")
|
||||
.click("button.btn.execute")
|
||||
.waitForElementVisible(".request-url", 2000)
|
||||
.setValue(`tr[data-param-name="x-irest-conn"] input`, `\u0008\u0008\u0008`) // backspaces
|
||||
.pause(900)
|
||||
.click("button.btn.execute")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.not.contain(`x-irest-conn`)
|
||||
})
|
||||
})
|
@ -0,0 +1,42 @@
|
||||
describe("bug #4756: enum initial values", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/bugs/4756.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
|
||||
it("sets a required initial value based the first enum value", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.click("#operations-default-post_zero")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.click("button.btn.execute")
|
||||
.waitForElementVisible(".request-url", 2000)
|
||||
.assert.containsText(".request-url > pre", "http://www.example.com/test/API/zero?one=0")
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("sets a required initial value based on a default value", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.click("#operations-default-post_one")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.click("button.btn.execute")
|
||||
.waitForElementVisible(".request-url", 2000)
|
||||
.assert.containsText(".request-url > pre", "http://www.example.com/test/API/one?one=1")
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,44 @@
|
||||
describe("bug: unable to change array input", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/bugs/frozen-array-input.yaml")
|
||||
.click("button.download-url-button")
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("consistently displays a model's name regardless of expansion state", function (client) {
|
||||
client.waitForElementVisible(".opblock-summary-description", 10000)
|
||||
.assert.containsText("span.opblock-summary-path > a > span", "/test")
|
||||
.click("#operations-default-get_test")
|
||||
.pause(500)
|
||||
.click("button.btn.try-out__btn")
|
||||
.elements("css selector", ".json-schema-form-item", function (result) {
|
||||
this.assert.equal(result.value.length, 2, "initial number of array item inputs")
|
||||
})
|
||||
.click(".json-schema-form-item-add")
|
||||
.elements("css selector", ".json-schema-form-item", function (result) {
|
||||
this.assert.equal(result.value.length, 3, "number of array item inputs after clicking add")
|
||||
})
|
||||
.click(".json-schema-form-item-remove")
|
||||
.click(".json-schema-form-item-remove")
|
||||
.click(".json-schema-form-item-remove")
|
||||
.elements("css selector", ".json-schema-form-item", function (result) {
|
||||
this.assert.equal(result.value.length, 0, "number of array item inputs after removing all items")
|
||||
})
|
||||
.click(".json-schema-form-item-add")
|
||||
.setValue(".json-schema-form-item input", "myValue123")
|
||||
.click("button.execute")
|
||||
.pause(100)
|
||||
.assert.containsText(".request-url pre", "http://localhost:3230/test?fields=myValue123")
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,433 @@
|
||||
describe("feature: OpenAPI 3 allowEmptyValue", function () {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/features/allow-empty-value.openapi.yaml")
|
||||
.click("button.download-url-button")
|
||||
.waitForElementVisible(".opblock", 10000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
|
||||
describe("regular parameters", function () {
|
||||
it("should set and unset an integer value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="int"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset a string value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="str"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset a number value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="num"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset a boolean value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="bool"] select`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} [value="true"]`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} [value=""]`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset an array value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} .json-schema-form-item-add`)
|
||||
.setValue(`${inputSelector} input`, "asdf")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} .json-schema-form-item-remove`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
})
|
||||
|
||||
describe("allowEmptyValue parameters", function () {
|
||||
describe("normal behavior", function () {
|
||||
it("should set and unset an integer value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="int"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset a string value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="str"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset a number value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="num"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset a boolean value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="bool"] select`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} [value="true"]`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} [value=""]`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset an array value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} .json-schema-form-item-add`)
|
||||
.setValue(`${inputSelector} input`, "asdf")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} .json-schema-form-item-remove`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
})
|
||||
describe("send empty initial value behavior", function () {
|
||||
it("should send an empty integer value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="int"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?int="`)
|
||||
})
|
||||
it("should send an empty string value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="str"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?str="`)
|
||||
})
|
||||
it("should send an empty number value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="num"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?num="`)
|
||||
})
|
||||
it("should send an empty boolean value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="bool"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?bool="`)
|
||||
})
|
||||
it("should send an empty array value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?arr="`)
|
||||
})
|
||||
})
|
||||
describe("modify and send empty behavior", function () {
|
||||
it("should set, unset and send an empty integer value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="int"]`
|
||||
const inputSelector = `${paramSelector} input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?int="`)
|
||||
})
|
||||
it("should set, unset and send an empty string value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="str"]`
|
||||
const inputSelector = `${paramSelector} input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?str="`)
|
||||
})
|
||||
it("should set, unset and send an empty number value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="num"]`
|
||||
const inputSelector = `${paramSelector} input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?num="`)
|
||||
})
|
||||
it("should set, unset and send an empty boolean value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="bool"]`
|
||||
const inputSelector = `${paramSelector} select`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} option[value="true"]`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.click(`${inputSelector} option[value=""]`)
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?bool="`)
|
||||
})
|
||||
it("should set, unset and send an empty array value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${paramSelector} .json-schema-form-item-add`)
|
||||
.setValue(`${paramSelector} input`, "asdf")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${paramSelector} .json-schema-form-item-remove`)
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?arr="`)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,433 @@
|
||||
describe("feature: Swagger 2 allowEmptyValue", function () {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/features/allow-empty-value.swagger.yaml")
|
||||
.click("button.download-url-button")
|
||||
.waitForElementVisible(".opblock", 10000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
|
||||
describe("regular parameters", function () {
|
||||
it("should set and unset an integer value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="int"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset a string value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="str"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset a number value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="num"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset a boolean value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="bool"] select`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} [value="true"]`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} [value=""]`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
it("should set and unset an array value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_regularParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} .json-schema-form-item-add`)
|
||||
.setValue(`${inputSelector} input`, "asdf")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} .json-schema-form-item-remove`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/regularParams"`)
|
||||
})
|
||||
})
|
||||
|
||||
describe("allowEmptyValue parameters", function () {
|
||||
describe("normal behavior", function () {
|
||||
it("should set and unset an integer value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="int"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset a string value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="str"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset a number value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="num"] input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset a boolean value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="bool"] select`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} [value="true"]`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} [value=""]`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
it("should set and unset an array value", function (client) {
|
||||
const inputSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} .json-schema-form-item-add`)
|
||||
.setValue(`${inputSelector} input`, "asdf")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${inputSelector} .json-schema-form-item-remove`)
|
||||
.pause(200)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams"`)
|
||||
})
|
||||
})
|
||||
describe("send empty inital value behavior", function () {
|
||||
it("should send an empty integer value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="int"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?int="`)
|
||||
})
|
||||
it("should send an empty string value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="str"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?str="`)
|
||||
})
|
||||
it("should send an empty number value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="num"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?num="`)
|
||||
})
|
||||
it("should send an empty boolean value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="bool"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?bool="`)
|
||||
})
|
||||
it("should send an empty array value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // tick "send empty value" box and execute
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?arr="`)
|
||||
})
|
||||
})
|
||||
describe("modify and send empty behavior", function () {
|
||||
it("should set, unset and send an empty integer value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="int"]`
|
||||
const inputSelector = `${paramSelector} input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?int="`)
|
||||
})
|
||||
it("should set, unset and send an empty string value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="str"]`
|
||||
const inputSelector = `${paramSelector} input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?str="`)
|
||||
})
|
||||
it("should set, unset and send an empty number value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="num"]`
|
||||
const inputSelector = `${paramSelector} input`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.setValue(inputSelector, "123")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.setValue(inputSelector, "\u0008\u0008\u0008") // backspaces
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?num="`)
|
||||
})
|
||||
it("should set, unset and send an empty boolean value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="bool"]`
|
||||
const inputSelector = `${paramSelector} select`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${inputSelector} option[value="true"]`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, click "send empty", execute again, assert
|
||||
.click(`${inputSelector} option[value=""]`)
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?bool="`)
|
||||
})
|
||||
it("should set, unset and send an empty array value", function (client) {
|
||||
const paramSelector = `tr[data-param-name="arr"]`
|
||||
|
||||
client // open try-it-out
|
||||
.click("#operations-default-get_emptyValueParams")
|
||||
.waitForElementVisible("button.btn.try-out__btn", 5000)
|
||||
.click("button.btn.try-out__btn")
|
||||
.pause(200)
|
||||
|
||||
client // set parameter, to ensure an initial value is set
|
||||
.click(`${paramSelector} .json-schema-form-item-add`)
|
||||
.setValue(`${paramSelector} input`, "asdf")
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.pause(200)
|
||||
|
||||
client // remove initial value, execute again
|
||||
.click(`${paramSelector} .json-schema-form-item-remove`)
|
||||
.pause(400)
|
||||
.click(`${paramSelector} .parameter__empty_value_toggle input`)
|
||||
.click("button.btn.execute.opblock-control__btn")
|
||||
.expect.element("textarea.curl").text
|
||||
.to.contain(`GET "http://localhost:3230/emptyValueParams?arr="`)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,240 @@
|
||||
const dedent = require("dedent")
|
||||
|
||||
describe("feature: `example` field support", function () {
|
||||
|
||||
describe("Swagger 2", function() {
|
||||
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/features/example.swagger.yaml")
|
||||
.click("button.download-url-button")
|
||||
.waitForElementVisible(".opblock", 10000)
|
||||
.click("#operations-default-put_one")
|
||||
.waitForElementVisible("#operations-default-put_one.is-open", 5000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
|
||||
// Parameters
|
||||
// Supports complex root `example` values in Schema objects for bodies
|
||||
// Supports nested `example` values in Schema objects for bodies
|
||||
|
||||
describe("primitive parameters", function() {
|
||||
it("should respect a primitive x-example value", function (client) {
|
||||
client
|
||||
.click("button.try-out__btn")
|
||||
.assert.value(
|
||||
`tr[data-param-name="ValidParam"] input[type="text"]`,
|
||||
`12345`
|
||||
)
|
||||
})
|
||||
it("should ignore a primitive example value", function (client) {
|
||||
client
|
||||
.click("button.try-out__btn")
|
||||
.assert.value(
|
||||
`tr[data-param-name="NotValidParam"] input[type="text"]`,
|
||||
``
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("object parameters", function() {
|
||||
it("should correctly consider property-level schema examples", function(client) {
|
||||
client.assert.containsText(`div[data-param-name="body"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"one": "hello!",
|
||||
"two": {
|
||||
"uno": "wow!",
|
||||
"dos": "hey there!"
|
||||
}
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider root schema-level schema examples", function(client) {
|
||||
client.assert.containsText(`div[data-param-name="body2"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"foo": "hey",
|
||||
"bar": 123
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider nested schema-level schema examples", function(client) {
|
||||
client.assert.containsText(`div[data-param-name="body3"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"one": {
|
||||
"uno": "woohoo!",
|
||||
"dos": "amazing!"
|
||||
}
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("responses", function() {
|
||||
it("should correctly consider schema-level examples", function (client) {
|
||||
client.assert.containsText(`tr.response[data-code="201"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"code": 201,
|
||||
"payload": [
|
||||
{
|
||||
"id": 1,
|
||||
"code": "AE2",
|
||||
"name": "Yono"
|
||||
}
|
||||
]
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider property-level examples", function (client) {
|
||||
client.assert.containsText(`tr.response[data-code="202"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"code": 202,
|
||||
"payload": [
|
||||
{
|
||||
"id": 1,
|
||||
"code": "AE2",
|
||||
"name": "Yono"
|
||||
}
|
||||
]
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
describe("OpenAPI 3.0", function() {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/features/example.openapi.yaml")
|
||||
.click("button.download-url-button")
|
||||
.waitForElementVisible(".opblock-summary-description", 10000)
|
||||
.click("#operations-agent-editAgent")
|
||||
.waitForElementVisible("#operations-agent-editAgent.is-open", 5000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
describe("parameters", function() {
|
||||
it("should respect a primitive example value", function(client) {
|
||||
client
|
||||
.click("button.try-out__btn")
|
||||
.assert.value(
|
||||
`div.parameters-container > div > table > tbody > tr > td.col.parameters-col_description > input[type="text"]`,
|
||||
`12345`
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("request bodies", function() {
|
||||
it("should correctly consider media type-level examples", function (client) {
|
||||
client
|
||||
.click(`select.content-type option[value="application/json_media-type-level"]`)
|
||||
.assert.containsText(`pre.body-param__example`,
|
||||
dedent(`
|
||||
{
|
||||
"code": "AE1",
|
||||
"name": "Andrew"
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider schema-level examples", function (client) {
|
||||
client
|
||||
.click(`select.content-type option[value="application/json_schema-level"]`)
|
||||
.assert.containsText(`pre.body-param__example`,
|
||||
dedent(`
|
||||
{
|
||||
"code": "AE1",
|
||||
"name": "Andrew"
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider property-level examples", function (client) {
|
||||
client
|
||||
.click(`select.content-type option[value="application/json_property-level"]`)
|
||||
.assert.containsText(`pre.body-param__example`,
|
||||
dedent(`
|
||||
{
|
||||
"code": "AE1",
|
||||
"name": "Andrew"
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
})
|
||||
describe("responses", function() {
|
||||
it("should correctly consider media type-level examples", function (client) {
|
||||
client.assert.containsText(`tr.response[data-code="200"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"code": 200,
|
||||
"payload": [
|
||||
{
|
||||
"id": 1,
|
||||
"code": "AE2",
|
||||
"name": "Yono"
|
||||
}
|
||||
]
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider schema-level examples", function (client) {
|
||||
client.assert.containsText(`tr.response[data-code="201"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"code": 201,
|
||||
"payload": [
|
||||
{
|
||||
"id": 1,
|
||||
"code": "AE2",
|
||||
"name": "Yono"
|
||||
}
|
||||
]
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
it("should correctly consider property-level examples", function (client) {
|
||||
client.assert.containsText(`tr.response[data-code="202"] pre`,
|
||||
dedent(`
|
||||
{
|
||||
"code": 202,
|
||||
"payload": [
|
||||
{
|
||||
"id": 1,
|
||||
"code": "AE2",
|
||||
"name": "Yono"
|
||||
}
|
||||
]
|
||||
}
|
||||
`)
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,58 @@
|
||||
describe("parameter enum rendering", function () {
|
||||
describe("swagger 2.0", () => {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.waitForElementVisible(".download-url-input", 10000)
|
||||
.pause(1000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/features/parameter-enum-rendering.swagger.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("reveals a string parameter's enums and defaults when viewing that parameter", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/report")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.pause(500)
|
||||
.assert.containsText("div.parameter__enum", "today, yesterday, lastweek")
|
||||
.assert.containsText("div.parameter__default", "today")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
describe("openapi 3.0", () => {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.waitForElementVisible(".download-url-input", 10000)
|
||||
.pause(1000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/features/parameter-enum-rendering.openapi.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("reveals a string parameter's enums and defaults when viewing that parameter", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/report")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.pause(500)
|
||||
.assert.containsText("div.parameter__enum", "today, yesterday, lastweek")
|
||||
.assert.containsText("div.parameter__default", "today")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,64 @@
|
||||
describe("parameter example rendering", function () {
|
||||
describe("swagger 2.0", () => {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/features/example.swagger.yaml")
|
||||
.click("button.download-url-button")
|
||||
.waitForElementVisible(".opblock", 10000)
|
||||
.click("#operations-default-put_one")
|
||||
.waitForElementVisible("#operations-default-put_one.is-open", 5000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("reveals a string parameter's example when viewing that parameter", function (client) {
|
||||
client.waitForElementVisible(".opblock-tag-section", 10000)
|
||||
.assert.containsText(".opblock-summary-path span", "/one")
|
||||
.click(".opblock")
|
||||
.waitForElementVisible(".opblock.is-open", 5000)
|
||||
.pause(500)
|
||||
.assert.containsText(`tr[data-param-name="ValidParam"]`, `12345`)
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
})
|
||||
describe("openapi 3.0", () => {
|
||||
beforeEach(function (client, done) {
|
||||
client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "/test-specs/features/example.openapi.yaml")
|
||||
.click("button.download-url-button")
|
||||
.waitForElementVisible(".opblock-summary-description", 10000)
|
||||
.click("#operations-agent-editAgent")
|
||||
.waitForElementVisible("#operations-agent-editAgent.is-open", 5000)
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("reveals a string parameter's example when viewing that parameter", function (client) {
|
||||
it("should respect a primitive example value", function(client) {
|
||||
client
|
||||
.assert.value(
|
||||
`div.parameters-container > div > table > tbody > tr > td.col.parameters-col_description > input[type="text"]`,
|
||||
`12345`
|
||||
)
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,78 @@
|
||||
describe("Render Model Wrapper", function () {
|
||||
let modelWrapper, mainPage
|
||||
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.json")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
modelWrapper = mainPage.section.modelWrapper
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("Render model wrapper", function (client) {
|
||||
mainPage.expect.section("@modelWrapper").to.be.visible.before(5000)
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Render model wrapper collapse", function (client) {
|
||||
modelWrapper.waitForElementVisible("@modelContainer", 5000)
|
||||
.click("@modelCollapse")
|
||||
.assert.cssClassNotPresent("@modelContainer", "is-open")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing order model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@orderModel")
|
||||
.click("@orderModelCallapse")
|
||||
.assert.cssClassNotPresent("@orderModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing category model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@categoryModel")
|
||||
.click("@categoryModelCallapse")
|
||||
.assert.cssClassNotPresent("@categoryModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("Testing user model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@userModel")
|
||||
.click("@userModelCallapse")
|
||||
.assert.cssClassNotPresent("@userModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("Testing tag model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@tagModel")
|
||||
.click("@tagModelCallapse")
|
||||
.assert.cssClassNotPresent("@tagModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("Testing pet model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@petModel")
|
||||
.click("@petModelCallapse")
|
||||
.assert.cssClassNotPresent("@petModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("Testing apiResponse model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@apiResponseModel")
|
||||
.click("@apiResponseModelCallapse")
|
||||
.assert.cssClassNotPresent("@apiResponseModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
78
frontend/web/api-doc/test/e2e-selenium/scenarios/models.js
Normal file
78
frontend/web/api-doc/test/e2e-selenium/scenarios/models.js
Normal file
@ -0,0 +1,78 @@
|
||||
describe("Render Model Wrapper", function () {
|
||||
let modelWrapper, mainPage
|
||||
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.json")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
modelWrapper = mainPage.section.modelWrapper
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("Render model wrapper", function (client) {
|
||||
mainPage.expect.section("@modelWrapper").to.be.visible.before(5000)
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Render model wrapper collapse", function (client) {
|
||||
modelWrapper.waitForElementVisible("@modelContainer", 5000)
|
||||
.click("@modelCollapse")
|
||||
.assert.cssClassNotPresent("@modelContainer", "is-open")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing order model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@orderModel")
|
||||
.click("@orderModelCallapse")
|
||||
.assert.cssClassNotPresent("@orderModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing category model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@categoryModel")
|
||||
.click("@categoryModelCallapse")
|
||||
.assert.cssClassNotPresent("@categoryModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("Testing user model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@userModel")
|
||||
.click("@userModelCallapse")
|
||||
.assert.cssClassNotPresent("@userModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("Testing tag model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@tagModel")
|
||||
.click("@tagModelCallapse")
|
||||
.assert.cssClassNotPresent("@tagModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("Testing pet model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@petModel")
|
||||
.click("@petModelCallapse")
|
||||
.assert.cssClassNotPresent("@petModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("Testing apiResponse model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@apiResponseModel")
|
||||
.click("@apiResponseModelCallapse")
|
||||
.assert.cssClassNotPresent("@apiResponseModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,40 @@
|
||||
describe("render pet api container", function () {
|
||||
let mainPage
|
||||
let apiWrapper
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/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()
|
||||
})
|
||||
})
|
||||
})
|
52
frontend/web/api-doc/test/e2e-selenium/scenarios/oas3/pet.js
Normal file
52
frontend/web/api-doc/test/e2e-selenium/scenarios/oas3/pet.js
Normal file
@ -0,0 +1,52 @@
|
||||
describe("render pet api container", function () {
|
||||
let mainPage
|
||||
let apiWrapper
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.openapi.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
apiWrapper = mainPage.section.apiWrapper
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
describe("GET /pet/{petId}", () => {
|
||||
it("should render Try-It-Out flow correctly", function (client) {
|
||||
apiWrapper.waitForElementVisible("#operations-pet-updatePetWithForm", 10000)
|
||||
.assert.containsText("#operations-pet-updatePetWithForm > div > span.opblock-summary-path > a > span", "/pet")
|
||||
.click("#operations-pet-updatePetWithForm")
|
||||
.waitForElementVisible("#operations-pet-updatePetWithForm > div:nth-child(2) > div", 5000)
|
||||
.click("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.opblock-section > div.opblock-section-header > div.try-out > button")
|
||||
.waitForElementVisible("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button", 1000)
|
||||
.click("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button")
|
||||
.assert.cssClassNotPresent("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("should have stable input values", function (client) {
|
||||
client.waitForElementVisible("#operations-pet-updatePetWithForm", 10000)
|
||||
.assert.containsText("#operations-pet-updatePetWithForm > div > span.opblock-summary-path > a > span", "/pet")
|
||||
.click("#operations-pet-updatePetWithForm")
|
||||
.waitForElementVisible("#operations-pet-updatePetWithForm > div:nth-child(2) > div", 5000)
|
||||
.click("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.opblock-section > div.opblock-section-header > div.try-out > button")
|
||||
.waitForElementVisible("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button", 1000)
|
||||
.setValue("#operations-pet-updatePetWithForm td.parameters-col_description > input", "12345")
|
||||
.click("#operations-pet-updatePetWithForm > div:nth-child(2) > div > div.execute-wrapper > button")
|
||||
.pause(800) // for swagger-api/swagger-ui#4269, which happens above 350ms
|
||||
.assert.containsText("#operations-pet-updatePetWithForm div.responses-inner > div > div > div:nth-child(2) > div > pre", "http://localhost:3204/pet/12345")
|
||||
.assert.value("#operations-pet-updatePetWithForm td.parameters-col_description > input", "12345")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,28 @@
|
||||
const expect = require("expect")
|
||||
|
||||
describe("onComplete option", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.pause(80)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.json")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
it("triggers the page-provided onComplete exactly 1 times", function (client, done) {
|
||||
client.execute(function() {
|
||||
return window.completeCount
|
||||
}, [], (result) => {
|
||||
expect(result.value).toEqual(1)
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
})
|
@ -0,0 +1,112 @@
|
||||
describe("render store api container", function () {
|
||||
let mainPage
|
||||
let apiWrapper
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.json")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
apiWrapper = mainPage.section.apiWrapper
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("test rendered store container", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeAPIWrapper", 5000)
|
||||
.expect.element("@storeAPIWrapper").to.be.visible
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("callapse store wrapper", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeAPIWrapper", 5000)
|
||||
.click("@storeAPIWrapperBar")
|
||||
.assert.cssClassNotPresent("@storeAPIWrapper", "is-open")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("render get /store/inventory api container", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationGetContainer", 5000)
|
||||
.assert.containsText("@storeOperationGetTitle", "/store/inventory")
|
||||
.click("@storeOperationGetCollpase")
|
||||
.waitForElementVisible("@storeOperationGetCollapseContainer", 5000)
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.waitForElementVisible("@storeOperationGetExecuteBtn", 1000)
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationGetTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing get /store/inventory api Mock data ", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationGetContainer", 5000)
|
||||
.assert.containsText("@storeOperationGetTitle", "/store/inventory")
|
||||
.click("@storeOperationGetCollpase")
|
||||
.waitForElementVisible("@storeOperationGetCollapseContainer", 3000)
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.waitForElementVisible("@storeOperationGetExecuteBtn", 1000)
|
||||
.click("@storeOperationGetExecuteBtn")
|
||||
.waitForElementVisible("@storeOperationResponseProps1")
|
||||
.assert.containsText("@storeOperationResponseProps1", "0")
|
||||
.assert.containsText("@storeOperationResponseProps2", "0")
|
||||
.assert.containsText("@storeOperationResponseProps3", "0")
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationGetTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("render post /store/order api container", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationPostContainer")
|
||||
.assert.containsText("@storeOperationPostTitle", "/store/order")
|
||||
.click("@storeOperationPostCollpase")
|
||||
.waitForElementVisible("@storeOperationPostCollapseContainer", 3000)
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.waitForElementVisible("@storeOperationPostExecuteBtn", 1000)
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationPostTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing post /store/order api Mock Data", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationPostContainer")
|
||||
.assert.containsText("@storeOperationPostTitle", "/store/order")
|
||||
.click("@storeOperationPostCollpase")
|
||||
.waitForElementVisible("@storeOperationPostCollapseContainer", 3000)
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.waitForElementVisible("@storeOperationPostExecuteBtn", 1000)
|
||||
.click("@storeOperationPostExecuteBtn")
|
||||
.waitForElementVisible("@storeOperationPostResponseId")
|
||||
.assert.containsText("@storeOperationPostResponseId", "0")
|
||||
.assert.containsText("@storeOperationPostResponsePetId", "0")
|
||||
.assert.containsText("@storeOperationPostResponseQuantity", "0")
|
||||
.assert.containsText("@storeOperationPostResponseStatus", "placed")
|
||||
.assert.containsText("@storeOperationPostResponseComplete", "false")
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationPostTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("render delete /store/order/{orderId} api container", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationDeleteContainer")
|
||||
.assert.containsText("@storeOperationDeleteTitle", "/store/order/{orderId}")
|
||||
.click("@storeOperationDeleteCollpase")
|
||||
.waitForElementVisible("@storeOperationDeleteCollapseContainer", 3000)
|
||||
.click("@storeOperationDeleteTryBtn")
|
||||
.waitForElementVisible("@storeOperationDeleteExecuteBtn", 1000)
|
||||
.click("@storeOperationDeleteExecuteBtn")
|
||||
.waitForElementVisible("@storeOperationGetResponseHeaders", "content-type: application/xml")
|
||||
.click("@storeOperationDeleteTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationDeleteTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,112 @@
|
||||
describe("render store api container", function () {
|
||||
let mainPage
|
||||
let apiWrapper
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.json")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
apiWrapper = mainPage.section.apiWrapper
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("test rendered store container", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeAPIWrapper", 5000)
|
||||
.expect.element("@storeAPIWrapper").to.be.visible
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("callapse store wrapper", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeAPIWrapper", 5000)
|
||||
.click("@storeAPIWrapperBar")
|
||||
.assert.cssClassNotPresent("@storeAPIWrapper", "is-open")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("render get /store/inventory api container", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationGetContainer", 5000)
|
||||
.assert.containsText("@storeOperationGetTitle", "/store/inventory")
|
||||
.click("@storeOperationGetCollpase")
|
||||
.waitForElementVisible("@storeOperationGetCollapseContainer", 5000)
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.waitForElementVisible("@storeOperationGetExecuteBtn", 1000)
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationGetTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing get /store/inventory api Mock data ", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationGetContainer", 5000)
|
||||
.assert.containsText("@storeOperationGetTitle", "/store/inventory")
|
||||
.click("@storeOperationGetCollpase")
|
||||
.waitForElementVisible("@storeOperationGetCollapseContainer", 3000)
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.waitForElementVisible("@storeOperationGetExecuteBtn", 1000)
|
||||
.click("@storeOperationGetExecuteBtn")
|
||||
.waitForElementVisible("@storeOperationResponseProps1")
|
||||
.assert.containsText("@storeOperationResponseProps1", "0")
|
||||
.assert.containsText("@storeOperationResponseProps2", "0")
|
||||
.assert.containsText("@storeOperationResponseProps3", "0")
|
||||
.click("@storeOperationGetTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationGetTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("render post /store/order api container", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationPostContainer")
|
||||
.assert.containsText("@storeOperationPostTitle", "/store/order")
|
||||
.click("@storeOperationPostCollpase")
|
||||
.waitForElementVisible("@storeOperationPostCollapseContainer", 3000)
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.waitForElementVisible("@storeOperationPostExecuteBtn", 1000)
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationPostTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing post /store/order api Mock Data", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationPostContainer")
|
||||
.assert.containsText("@storeOperationPostTitle", "/store/order")
|
||||
.click("@storeOperationPostCollpase")
|
||||
.waitForElementVisible("@storeOperationPostCollapseContainer", 3000)
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.waitForElementVisible("@storeOperationPostExecuteBtn", 1000)
|
||||
.click("@storeOperationPostExecuteBtn")
|
||||
.waitForElementVisible("@storeOperationPostResponseId")
|
||||
.assert.containsText("@storeOperationPostResponseId", "0")
|
||||
.assert.containsText("@storeOperationPostResponsePetId", "0")
|
||||
.assert.containsText("@storeOperationPostResponseQuantity", "0")
|
||||
.assert.containsText("@storeOperationPostResponseStatus", "placed")
|
||||
.assert.containsText("@storeOperationPostResponseComplete", "false")
|
||||
.click("@storeOperationPostTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationPostTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("render delete /store/order/{orderId} api container", function (client) {
|
||||
apiWrapper.waitForElementVisible("@storeOperationDeleteContainer")
|
||||
.assert.containsText("@storeOperationDeleteTitle", "/store/order/{orderId}")
|
||||
.click("@storeOperationDeleteCollpase")
|
||||
.waitForElementVisible("@storeOperationDeleteCollapseContainer", 3000)
|
||||
.click("@storeOperationDeleteTryBtn")
|
||||
.waitForElementVisible("@storeOperationDeleteExecuteBtn", 1000)
|
||||
.click("@storeOperationDeleteExecuteBtn")
|
||||
.waitForElementVisible("@storeOperationGetResponseHeaders", "content-type: application/xml")
|
||||
.click("@storeOperationDeleteTryBtn")
|
||||
.assert.cssClassNotPresent("@storeOperationDeleteTryBtn", "cancel")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,78 @@
|
||||
describe("Render Model Wrapper", function () {
|
||||
let modelWrapper, mainPage
|
||||
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.json")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
modelWrapper = mainPage.section.modelWrapper
|
||||
|
||||
done()
|
||||
})
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
it("Render model wrapper", function (client) {
|
||||
mainPage.expect.section("@modelWrapper").to.be.visible.before(5000)
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Render model wrapper collapse", function (client) {
|
||||
modelWrapper.waitForElementVisible("@modelContainer", 5000)
|
||||
.click("@modelCollapse")
|
||||
.assert.cssClassNotPresent("@modelContainer", "is-open")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing order model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@orderModel")
|
||||
.click("@orderModelCallapse")
|
||||
.assert.cssClassNotPresent("@orderModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("Testing category model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@categoryModel")
|
||||
.click("@categoryModelCallapse")
|
||||
.assert.cssClassNotPresent("@categoryModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("Testing user model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@userModel")
|
||||
.click("@userModelCallapse")
|
||||
.assert.cssClassNotPresent("@userModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("Testing tag model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@tagModel")
|
||||
.click("@tagModelCallapse")
|
||||
.assert.cssClassNotPresent("@tagModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("Testing pet model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@petModel")
|
||||
.click("@petModelCallapse")
|
||||
.assert.cssClassNotPresent("@petModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("Testing apiResponse model", function (client) {
|
||||
modelWrapper.waitForElementVisible("@apiResponseModel")
|
||||
.click("@apiResponseModelCallapse")
|
||||
.assert.cssClassNotPresent("@apiResponseModelCallapse", "callapsed")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
26
frontend/web/api-doc/test/e2e-selenium/scenarios/refs.js
Normal file
26
frontend/web/api-doc/test/e2e-selenium/scenarios/refs.js
Normal file
@ -0,0 +1,26 @@
|
||||
describe("Remote $ref rendering", function () {
|
||||
let mainPage
|
||||
beforeEach(function (client, done) {
|
||||
|
||||
mainPage = client
|
||||
// expand the models so we don't have to manually do it
|
||||
.url("localhost:3230?defaultModelsExpandDepth=5")
|
||||
.page.main()
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.pause(2000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/refs/api1.yaml")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
it("renders a remote $ref correctly", function (client) {
|
||||
mainPage.expect.element("#model-TestResponse > span > div > span > span > span.inner-object > table > tbody > tr:nth-child(2) > td:nth-child(2) > span > span > div > div > p").text.to.equal("this is an api2prop")
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
@ -0,0 +1,61 @@
|
||||
describe("Render scheme", function () {
|
||||
let mainPage
|
||||
let schemeContainer
|
||||
beforeEach(function (client, done) {
|
||||
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
schemeContainer = mainPage.section.schemeContainer
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 5000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.json")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
it("render section", function (client) {
|
||||
mainPage.expect.section("@schemeContainer").to.be.visible.before(5000)
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("render scheme option", function (client) {
|
||||
schemeContainer.waitForElementVisible("@httpOption", 5000)
|
||||
.expect.element("@httpOption").to.be.selected
|
||||
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("render authorized button", function (client) {
|
||||
schemeContainer.waitForElementVisible("@btnAuthorize", 5000)
|
||||
.expect.element("@btnAuthorize").to.be.visible
|
||||
|
||||
client.end()
|
||||
})
|
||||
it("render click event", function (client) {
|
||||
schemeContainer.waitForElementVisible("@btnAuthorize", 5000)
|
||||
.click("@btnAuthorize")
|
||||
.assert.visible("@authorizationModal")
|
||||
.assert.containsText("@appName", "Application: your-app-name")
|
||||
.assert.containsText("@authorizationUrl", "http://petstore.swagger.io/oauth/dialog")
|
||||
.assert.containsText("@flow", "implicit")
|
||||
.assert.value("@inputClientID", "your-client-id")
|
||||
schemeContainer.expect.element("@readPetsScope").to.be.selected
|
||||
schemeContainer.expect.element("@writePetsScope").to.not.be.selected
|
||||
|
||||
schemeContainer.click("@selectAllScopes")
|
||||
schemeContainer.expect.element("@readPetsScope").to.be.selected
|
||||
schemeContainer.expect.element("@writePetsScope").to.be.selected
|
||||
|
||||
schemeContainer.click("@selectNoneScopes")
|
||||
schemeContainer.expect.element("@readPetsScope").to.not.be.selected
|
||||
schemeContainer.expect.element("@writePetsScope").to.not.be.selected
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
51
frontend/web/api-doc/test/e2e-selenium/scenarios/topbar.js
Normal file
51
frontend/web/api-doc/test/e2e-selenium/scenarios/topbar.js
Normal file
@ -0,0 +1,51 @@
|
||||
describe("initial render", function () {
|
||||
let mainPage
|
||||
describe("for topbar", function () {
|
||||
let topbar
|
||||
before(function (client, done) {
|
||||
done()
|
||||
})
|
||||
|
||||
after(function (client, done) {
|
||||
client.end(function () {
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
afterEach(function (client, done) {
|
||||
done()
|
||||
})
|
||||
|
||||
beforeEach(function (client, done) {
|
||||
mainPage = client
|
||||
.url("localhost:3230")
|
||||
.page.main()
|
||||
|
||||
topbar = mainPage.section.topbar
|
||||
|
||||
client.waitForElementVisible(".download-url-input:not([disabled])", 10000)
|
||||
.clearValue(".download-url-input")
|
||||
.setValue(".download-url-input", "http://localhost:3230/test-specs/petstore.json")
|
||||
.click("button.download-url-button")
|
||||
.pause(1000)
|
||||
|
||||
done()
|
||||
})
|
||||
|
||||
it("renders section", function (client) {
|
||||
mainPage.expect.section("@topbar").to.be.visible
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("renders input box", function (client) {
|
||||
topbar.expect.element("@inputBox").to.be.visible
|
||||
client.end()
|
||||
})
|
||||
|
||||
it("renders explore button", function (client) {
|
||||
topbar.expect.element("@btnExplore").to.be.visible
|
||||
|
||||
client.end()
|
||||
})
|
||||
})
|
||||
})
|
111
frontend/web/api-doc/test/e2e-selenium/static/index.html
Normal file
111
frontend/web/api-doc/test/e2e-selenium/static/index.html
Normal file
@ -0,0 +1,111 @@
|
||||
<!-- HTML for dev server -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Swagger UI</title>
|
||||
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
|
||||
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
||||
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
||||
<style>
|
||||
html
|
||||
{
|
||||
box-sizing: border-box;
|
||||
overflow: -moz-scrollbars-vertical;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
*,
|
||||
*:before,
|
||||
*:after
|
||||
{
|
||||
box-sizing: inherit;
|
||||
}
|
||||
body {
|
||||
margin:0;
|
||||
background: #fafafa;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
|
||||
<defs>
|
||||
<symbol viewBox="0 0 20 20" id="unlocked">
|
||||
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 20 20" id="locked">
|
||||
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 20 20" id="close">
|
||||
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 20 20" id="large-arrow">
|
||||
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 20 20" id="large-arrow-down">
|
||||
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
|
||||
</symbol>
|
||||
|
||||
|
||||
<symbol viewBox="0 0 24 24" id="jump-to">
|
||||
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 24 24" id="expand">
|
||||
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
||||
</symbol>
|
||||
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
|
||||
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
window["SwaggerUIBundle"] = window["swagger-ui-bundle"]
|
||||
window["SwaggerUIStandalonePreset"] = window["swagger-ui-standalone-preset"]
|
||||
// Build a system
|
||||
const ui = SwaggerUIBundle({
|
||||
url: "",
|
||||
dom_id: '#swagger-ui',
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
],
|
||||
layout: "StandaloneLayout",
|
||||
onComplete: () => {
|
||||
if(window.completeCount) {
|
||||
window.completeCount++
|
||||
} else {
|
||||
window.completeCount = 1
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
window.ui = ui
|
||||
|
||||
ui.initOAuth({
|
||||
clientId: "your-client-id",
|
||||
clientSecret: "your-client-secret-if-required",
|
||||
realm: "your-realms",
|
||||
appName: "your-app-name",
|
||||
scopeSeparator: " ",
|
||||
scopes: "read:pets profile openid",
|
||||
additionalQueryStringParams: {}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -0,0 +1,85 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: Demo API
|
||||
description: First test
|
||||
termsOfService: 'http://demo.io/terms-of-service/'
|
||||
contact:
|
||||
name: Demo Support
|
||||
email: support@demo.io
|
||||
version: 1.0.0
|
||||
servers:
|
||||
- url: '{server}/v1'
|
||||
variables:
|
||||
server:
|
||||
default: https://api.demo.io
|
||||
description: the API endpoint
|
||||
|
||||
paths:
|
||||
/session:
|
||||
put:
|
||||
summary: Returns a new authentication token
|
||||
tags:
|
||||
- session
|
||||
security:
|
||||
- basicAuth: []
|
||||
responses:
|
||||
'201':
|
||||
description: A session object
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
allOf:
|
||||
- type: object
|
||||
properties:
|
||||
user_id:
|
||||
type: string
|
||||
format: uuid
|
||||
readOnly: true
|
||||
example: 110e8400-e29b-11d4-a716-446655440000
|
||||
- $ref: '#/components/schemas/Session'
|
||||
'401':
|
||||
$ref: '#/components/responses/Unauthorized'
|
||||
|
||||
components:
|
||||
securitySchemes:
|
||||
basicAuth:
|
||||
type: http
|
||||
scheme: basic
|
||||
bearerAuth:
|
||||
type: http
|
||||
scheme: bearer
|
||||
bearerFormat: JWT
|
||||
schemas:
|
||||
Session:
|
||||
required:
|
||||
- token
|
||||
properties:
|
||||
token:
|
||||
type: string
|
||||
readOnly: true
|
||||
example: >-
|
||||
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.EkN-DOsnsuRjRO6BxXemmJDm3HbxrbRzXglbN2S4sOkopdU4IsDxTI8jO19W_A4K8ZPJijNLis4EZsHeY559a4DFOd50_OqgHGuERTqYZyuhtF39yxJPAjUESwxk2J5k_4zM3O-vtd1Ghyo4IbqKKSy6J9mTniYJPenn5-HIirE
|
||||
|
||||
Error:
|
||||
required:
|
||||
- message
|
||||
properties:
|
||||
message:
|
||||
description: a human readable message explaining the error
|
||||
type: string
|
||||
reason:
|
||||
description: a functional key about the error
|
||||
type: string
|
||||
responses:
|
||||
Unauthorized:
|
||||
description: Not authenticated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
||||
Default:
|
||||
description: unexpected error
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Error'
|
@ -0,0 +1,228 @@
|
||||
---
|
||||
openapi: 3.0.0
|
||||
servers:
|
||||
- url: http://localhost:3204/
|
||||
info:
|
||||
description: 'This is a sample server Petstore server. You can find out more about
|
||||
Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For
|
||||
this sample, you can use the api key `special-key` to test the authorization filters.'
|
||||
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
|
||||
tags:
|
||||
- name: pet
|
||||
description: Everything about your Pets
|
||||
externalDocs:
|
||||
description: Find out more
|
||||
url: http://swagger.io
|
||||
- name: store
|
||||
description: Access to Petstore orders
|
||||
- name: user
|
||||
description: Operations about user
|
||||
externalDocs:
|
||||
description: Find out more about our store
|
||||
url: http://swagger.io
|
||||
paths:
|
||||
"/pet/findByStatus":
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Finds Pets by status
|
||||
description: Multiple status values can be provided with comma separated strings
|
||||
operationId: findPetsByStatus
|
||||
parameters:
|
||||
- name: status
|
||||
in: query
|
||||
description: Status values that need to be considered for filter
|
||||
required: true
|
||||
explode: true
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
default: available
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/Pet"
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/Pet"
|
||||
'400':
|
||||
description: Invalid status value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
externalDocs:
|
||||
description: Find out more about Swagger
|
||||
url: http://swagger.io
|
||||
components:
|
||||
schemas:
|
||||
Order:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
petId:
|
||||
type: integer
|
||||
format: int64
|
||||
quantity:
|
||||
type: integer
|
||||
format: int32
|
||||
shipDate:
|
||||
type: string
|
||||
format: date-time
|
||||
status:
|
||||
type: string
|
||||
description: Order Status
|
||||
enum:
|
||||
- placed
|
||||
- approved
|
||||
- delivered
|
||||
complete:
|
||||
type: boolean
|
||||
default: false
|
||||
xml:
|
||||
name: Order
|
||||
Category:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
xml:
|
||||
name: Category
|
||||
User:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
username:
|
||||
type: string
|
||||
firstName:
|
||||
type: string
|
||||
lastName:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
phone:
|
||||
type: string
|
||||
userStatus:
|
||||
type: integer
|
||||
format: int32
|
||||
description: User Status
|
||||
xml:
|
||||
name: User
|
||||
Tag:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
xml:
|
||||
name: Tag
|
||||
Pet:
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- photoUrls
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
category:
|
||||
"$ref": "#/components/schemas/Category"
|
||||
name:
|
||||
type: string
|
||||
example: doggie
|
||||
photoUrls:
|
||||
type: array
|
||||
xml:
|
||||
name: photoUrl
|
||||
wrapped: true
|
||||
items:
|
||||
type: string
|
||||
tags:
|
||||
type: array
|
||||
xml:
|
||||
name: tag
|
||||
wrapped: true
|
||||
items:
|
||||
"$ref": "#/components/schemas/Tag"
|
||||
status:
|
||||
type: string
|
||||
description: pet status in the store
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
xml:
|
||||
name: Pet
|
||||
ApiResponse:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
type:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
requestBodies:
|
||||
Pet:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/Pet"
|
||||
application/xml:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/Pet"
|
||||
description: Pet object that needs to be added to the store
|
||||
required: true
|
||||
UserArray:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/User"
|
||||
description: List of user object
|
||||
required: true
|
||||
securitySchemes:
|
||||
petstore_auth:
|
||||
type: oauth2
|
||||
flows:
|
||||
implicit:
|
||||
authorizationUrl: http://petstore.swagger.io/oauth/dialog
|
||||
scopes:
|
||||
write:pets: modify pets in your account
|
||||
read:pets: read your pets
|
||||
api_key:
|
||||
type: apiKey
|
||||
name: api_key
|
||||
in: header
|
@ -0,0 +1,24 @@
|
||||
openapi: 3.0.0
|
||||
servers:
|
||||
- url: 'https://__host__/'
|
||||
info:
|
||||
description: Test API
|
||||
version: '1.0'
|
||||
title: Test API
|
||||
contact:
|
||||
name: Sample Person
|
||||
email: Sample.Person@adp.com
|
||||
tags:
|
||||
- name: Test API with Schema
|
||||
description: Test API with Schema
|
||||
paths:
|
||||
/myApi:
|
||||
get:
|
||||
operationId: some guid
|
||||
responses:
|
||||
'200':
|
||||
description: Returns documents
|
||||
description: Returns documents
|
||||
tags:
|
||||
- Test API with Schema
|
||||
summary: Test API with Schema
|
@ -0,0 +1,64 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: Callback Example
|
||||
version: 1.0.0
|
||||
paths:
|
||||
/streams:
|
||||
post:
|
||||
description: subscribes a client to receive out-of-band data
|
||||
parameters:
|
||||
- name: callbackUrl
|
||||
in: query
|
||||
required: true
|
||||
description: |
|
||||
the location where data will be sent. Must be network accessible
|
||||
by the source server
|
||||
schema:
|
||||
type: string
|
||||
format: uri
|
||||
example: https://tonys-server.com
|
||||
responses:
|
||||
'201':
|
||||
description: subscription successfully created
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
description: subscription information
|
||||
required:
|
||||
- subscriptionId
|
||||
properties:
|
||||
subscriptionId:
|
||||
description: this unique identifier allows management of the subscription
|
||||
type: string
|
||||
example: 2531329f-fb09-4ef7-887e-84e648214436
|
||||
callbacks:
|
||||
# the name `onData` is a convenience locator
|
||||
onData:
|
||||
$ref: '#/components/callbacks/onData'
|
||||
components:
|
||||
callbacks:
|
||||
onData:
|
||||
# when data is sent, it will be sent to the `callbackUrl` provided
|
||||
# when making the subscription PLUS the suffix `/data`
|
||||
'{$request.query.callbackUrl}/data':
|
||||
post:
|
||||
requestBody:
|
||||
description: subscription payload
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
properties:
|
||||
timestamp:
|
||||
type: string
|
||||
format: date-time
|
||||
userData:
|
||||
type: string
|
||||
responses:
|
||||
'202':
|
||||
description: |
|
||||
Your server implementation should return this HTTP status code
|
||||
if the data was received successfully
|
||||
'204':
|
||||
description: |
|
||||
Your server should return this HTTP status code if no longer interested
|
||||
in further updates
|
@ -0,0 +1,15 @@
|
||||
---
|
||||
post:
|
||||
description: Book
|
||||
operationId: buy
|
||||
summary: Buy a book
|
||||
tags:
|
||||
- Book
|
||||
consumes:
|
||||
- application/json
|
||||
- application/xml
|
||||
parameters:
|
||||
- name: requestBody
|
||||
in: body
|
||||
description: Buy a Book
|
||||
required: true
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
swagger: '2.0'
|
||||
paths:
|
||||
"/v1/book":
|
||||
"$ref": "./book.yaml"
|
@ -0,0 +1,9 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
version: 0.0.0
|
||||
title: test
|
||||
paths: {}
|
||||
|
||||
definitions:
|
||||
ModelName:
|
||||
title: TitleName
|
@ -0,0 +1,126 @@
|
||||
---
|
||||
swagger: '2.0'
|
||||
info:
|
||||
version: 0.0.1
|
||||
title: DDErl REST interface
|
||||
description: RESTful access to IMEM DB and DDErl
|
||||
schemes:
|
||||
- http
|
||||
- https
|
||||
securityDefinitions:
|
||||
basicAuth:
|
||||
type: basic
|
||||
description: HTTP Basic Authentication Username:Password
|
||||
basePath: "/dderlrest/0.0.1"
|
||||
paths:
|
||||
"/sql/":
|
||||
get:
|
||||
tags:
|
||||
- sql
|
||||
security:
|
||||
- basicAuth: []
|
||||
summary: execute sql
|
||||
operationId: execSql
|
||||
description: Prepare and execute SQL statements
|
||||
parameters:
|
||||
- name: x-irest-conn
|
||||
in: header
|
||||
required: false
|
||||
description: ErlImem connection identifier
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
schema:
|
||||
type: object
|
||||
headers:
|
||||
x-irest-conn:
|
||||
description: ErlImem connection identifier
|
||||
type: string
|
||||
'403':
|
||||
description: Malformed/Invalid
|
||||
schema:
|
||||
"$ref": "#/definitions/ErrorResponse"
|
||||
definitions:
|
||||
ErrorResponse:
|
||||
readOnly: true
|
||||
type: object
|
||||
required:
|
||||
- errorCode
|
||||
- errorMessage
|
||||
- errorDetails
|
||||
properties:
|
||||
errorCode:
|
||||
description: Error Code
|
||||
type: number
|
||||
example: 1400
|
||||
errorMessage:
|
||||
description: Error Message
|
||||
type: string
|
||||
example: malformed
|
||||
errorDetails:
|
||||
description: Error Details
|
||||
type: string
|
||||
example: mandatory properties missing or bad type
|
||||
ViewParams:
|
||||
readOnly: true
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- typ
|
||||
- value
|
||||
- name
|
||||
properties:
|
||||
name:
|
||||
description: Name
|
||||
type: string
|
||||
example: ":atom_user"
|
||||
value:
|
||||
description: Value
|
||||
type: string
|
||||
example: system
|
||||
typ:
|
||||
description: Datatype
|
||||
type: string
|
||||
enum:
|
||||
- atom
|
||||
- binary
|
||||
- raw
|
||||
- blob
|
||||
- rowid
|
||||
- binstr
|
||||
- clob
|
||||
- nclob
|
||||
- varchar2
|
||||
- nvarchar2
|
||||
- char
|
||||
- nchar
|
||||
- boolean
|
||||
- datetime
|
||||
- decimal
|
||||
- float
|
||||
- fun
|
||||
- integer
|
||||
- ipaddr
|
||||
- list
|
||||
- map
|
||||
- number
|
||||
- pid
|
||||
- ref
|
||||
- string
|
||||
- term
|
||||
- binterm
|
||||
- timestamp
|
||||
- tuple
|
||||
- userid
|
||||
example: atom
|
||||
dir:
|
||||
description: Direction
|
||||
type: string
|
||||
enum:
|
||||
- in
|
||||
- out
|
||||
default: in
|
@ -0,0 +1,51 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
title: test doc
|
||||
description: 'test doc '
|
||||
license:
|
||||
name: Copyright @2018
|
||||
version: 1.0.0
|
||||
host: www.example.com
|
||||
basePath: /test/API
|
||||
tags:
|
||||
- name: devices
|
||||
description: devices
|
||||
schemes:
|
||||
- http
|
||||
- https
|
||||
consumes:
|
||||
- application/x-www-form-urlencoded
|
||||
produces:
|
||||
- application/json
|
||||
paths:
|
||||
/zero:
|
||||
post:
|
||||
parameters:
|
||||
- in: query
|
||||
name: one
|
||||
type: string
|
||||
required: true
|
||||
enum:
|
||||
- 0
|
||||
- 1
|
||||
responses:
|
||||
200:
|
||||
description: 'response'
|
||||
examples:
|
||||
application/json: {"error":0}
|
||||
/one:
|
||||
post:
|
||||
parameters:
|
||||
- in: query
|
||||
name: one
|
||||
type: string
|
||||
required: true
|
||||
default: 1
|
||||
enum:
|
||||
- 0
|
||||
- 1
|
||||
responses:
|
||||
200:
|
||||
description: 'response'
|
||||
examples:
|
||||
application/json: {"error":0}
|
@ -0,0 +1,35 @@
|
||||
openapi: '3.0.0'
|
||||
info:
|
||||
description: >-
|
||||
Repro API
|
||||
title: Repro API
|
||||
version: '1.0'
|
||||
paths:
|
||||
/test:
|
||||
get:
|
||||
summary: Test get
|
||||
parameters:
|
||||
- name: fields
|
||||
in: query
|
||||
required: false
|
||||
explode: false
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
style: form
|
||||
example:
|
||||
- friends
|
||||
- family
|
||||
responses:
|
||||
200:
|
||||
description: Success!
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
@ -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
|
@ -0,0 +1,64 @@
|
||||
openapi: "3.0.0"
|
||||
|
||||
paths:
|
||||
/regularParams:
|
||||
get:
|
||||
parameters:
|
||||
- name: int
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
- name: str
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
- name: num
|
||||
in: query
|
||||
schema:
|
||||
type: number
|
||||
- name: bool
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
- name: arr
|
||||
in: query
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: ok
|
||||
/emptyValueParams:
|
||||
get:
|
||||
parameters:
|
||||
- name: int
|
||||
in: query
|
||||
schema:
|
||||
type: integer
|
||||
allowEmptyValue: true
|
||||
- name: str
|
||||
in: query
|
||||
schema:
|
||||
type: string
|
||||
allowEmptyValue: true
|
||||
- name: num
|
||||
in: query
|
||||
schema:
|
||||
type: number
|
||||
allowEmptyValue: true
|
||||
- name: bool
|
||||
in: query
|
||||
schema:
|
||||
type: boolean
|
||||
allowEmptyValue: true
|
||||
- name: arr
|
||||
in: query
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
allowEmptyValue: true
|
||||
responses:
|
||||
200:
|
||||
description: ok
|
@ -0,0 +1,57 @@
|
||||
swagger: "2.0"
|
||||
|
||||
consumes:
|
||||
- application/json
|
||||
- multipart/form-data
|
||||
paths:
|
||||
/regularParams:
|
||||
get:
|
||||
parameters:
|
||||
- name: int
|
||||
in: query
|
||||
type: integer
|
||||
- name: str
|
||||
in: query
|
||||
type: string
|
||||
- name: num
|
||||
in: query
|
||||
type: number
|
||||
- name: bool
|
||||
in: query
|
||||
type: boolean
|
||||
- name: arr
|
||||
in: query
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
responses:
|
||||
200:
|
||||
description: ok
|
||||
/emptyValueParams:
|
||||
get:
|
||||
parameters:
|
||||
- name: int
|
||||
in: query
|
||||
type: integer
|
||||
allowEmptyValue: true
|
||||
- name: str
|
||||
in: query
|
||||
type: string
|
||||
allowEmptyValue: true
|
||||
- name: num
|
||||
in: query
|
||||
type: number
|
||||
allowEmptyValue: true
|
||||
- name: bool
|
||||
in: query
|
||||
type: boolean
|
||||
allowEmptyValue: true
|
||||
- name: arr
|
||||
in: query
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
allowEmptyValue: true
|
||||
responses:
|
||||
200:
|
||||
description: ok
|
@ -0,0 +1,156 @@
|
||||
openapi: 3.0.0
|
||||
servers:
|
||||
- url: http://example.com/v1
|
||||
description: Production server version 1
|
||||
- url: http://staging-api.example.com
|
||||
description: Staging server
|
||||
info:
|
||||
description: |
|
||||
This is an API documentation of example.
|
||||
version: "0.1.0"
|
||||
title: Example
|
||||
termsOfService: 'http://www.example.com/terms/'
|
||||
contact:
|
||||
email: developer@example.com
|
||||
license:
|
||||
name: Proprietary license
|
||||
url: 'http://www.example.com/license/'
|
||||
tags:
|
||||
- name: agent
|
||||
description: Access to example
|
||||
paths:
|
||||
/agents/{agentId}:
|
||||
put:
|
||||
tags:
|
||||
- agent
|
||||
summary: Edit agent
|
||||
operationId: editAgent
|
||||
parameters:
|
||||
- in: path
|
||||
name: agentId
|
||||
schema:
|
||||
type: integer
|
||||
example: 12345
|
||||
required: true
|
||||
description: Numeric ID of the paper agent to edit
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json_media-type-level:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
example:
|
||||
code: AE1
|
||||
name: Andrew
|
||||
application/json_schema-level:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
example:
|
||||
code: AE1
|
||||
name: Andrew
|
||||
application/json_property-level:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
example: AE1
|
||||
name:
|
||||
type: string
|
||||
example: Andrew
|
||||
responses:
|
||||
'200':
|
||||
description: media type-level example
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int64
|
||||
payload:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
readOnly: true
|
||||
code:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
example:
|
||||
code: 200
|
||||
payload:
|
||||
- id: 1
|
||||
code: AE2
|
||||
name: Yono
|
||||
'201':
|
||||
description: schema-level example
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int64
|
||||
payload:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
readOnly: true
|
||||
code:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
example:
|
||||
code: 201
|
||||
payload:
|
||||
- id: 1
|
||||
code: AE2
|
||||
name: Yono
|
||||
'202':
|
||||
description: property-level example
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int64
|
||||
example: 202
|
||||
payload:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
readOnly: true
|
||||
example: 1
|
||||
code:
|
||||
type: string
|
||||
example: AE2
|
||||
name:
|
||||
type: string
|
||||
example: Yono
|
@ -0,0 +1,127 @@
|
||||
swagger: "2.0"
|
||||
info:
|
||||
description: |
|
||||
This is an API documentation of example.
|
||||
version: "0.1.0"
|
||||
title: Example
|
||||
termsOfService: 'http://www.example.com/terms/'
|
||||
contact:
|
||||
email: developer@example.com
|
||||
license:
|
||||
name: Proprietary license
|
||||
url: 'http://www.example.com/license/'
|
||||
paths:
|
||||
/one:
|
||||
put:
|
||||
parameters:
|
||||
- in: query
|
||||
name: NotValidParam
|
||||
type: integer
|
||||
example: 12345
|
||||
required: true
|
||||
description: This example **should not** have an effect
|
||||
- in: query
|
||||
name: ValidParam
|
||||
type: integer
|
||||
x-example: 12345
|
||||
description: This example **should** have an effect
|
||||
- in: body
|
||||
name: body
|
||||
description: property-level examples
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
one:
|
||||
type: string
|
||||
example: hello!
|
||||
two:
|
||||
type: object
|
||||
properties:
|
||||
uno:
|
||||
type: string
|
||||
example: wow!
|
||||
dos:
|
||||
type: string
|
||||
example: hey there!
|
||||
- in: body
|
||||
name: body2
|
||||
description: root schema-level example
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
foo:
|
||||
type: string
|
||||
bar:
|
||||
type: integer
|
||||
example:
|
||||
foo: hey
|
||||
bar: 123
|
||||
- in: body
|
||||
name: body3
|
||||
description: nested schema-level example
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
one:
|
||||
type: object
|
||||
properties:
|
||||
uno:
|
||||
type: string
|
||||
dos:
|
||||
type: string
|
||||
example:
|
||||
uno: woohoo!
|
||||
dos: amazing!
|
||||
responses:
|
||||
'201':
|
||||
description: schema-level example
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int64
|
||||
payload:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
readOnly: true
|
||||
code:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
example:
|
||||
code: 201
|
||||
payload:
|
||||
- id: 1
|
||||
code: AE2
|
||||
name: Yono
|
||||
'202':
|
||||
description: property-level example
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int64
|
||||
example: 202
|
||||
payload:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
readOnly: true
|
||||
example: 1
|
||||
code:
|
||||
type: string
|
||||
example: AE2
|
||||
name:
|
||||
type: string
|
||||
example: Yono
|
@ -0,0 +1,21 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: test
|
||||
version: 0.0.0
|
||||
paths:
|
||||
/report:
|
||||
get:
|
||||
parameters:
|
||||
- in: query
|
||||
name: rel_date
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
default: today
|
||||
enum:
|
||||
- today
|
||||
- yesterday
|
||||
- lastweek
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
@ -0,0 +1,20 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
title: test
|
||||
version: 0.0.0
|
||||
paths:
|
||||
/report:
|
||||
get:
|
||||
parameters:
|
||||
- in: query
|
||||
name: rel_date
|
||||
required: true
|
||||
type: string
|
||||
default: today
|
||||
enum:
|
||||
- today
|
||||
- yesterday
|
||||
- lastweek
|
||||
responses:
|
||||
200:
|
||||
description: OK
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,689 @@
|
||||
---
|
||||
openapi: 3.0.0
|
||||
servers:
|
||||
- url: http://localhost:3204/
|
||||
info:
|
||||
description: 'This is a sample server Petstore server. You can find out more about
|
||||
Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For
|
||||
this sample, you can use the api key `special-key` to test the authorization filters.'
|
||||
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
|
||||
tags:
|
||||
- name: pet
|
||||
description: Everything about your Pets
|
||||
externalDocs:
|
||||
description: Find out more
|
||||
url: http://swagger.io
|
||||
- name: store
|
||||
description: Access to Petstore orders
|
||||
- name: user
|
||||
description: Operations about user
|
||||
externalDocs:
|
||||
description: Find out more about our store
|
||||
url: http://swagger.io
|
||||
paths:
|
||||
"/pet":
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Add a new pet to the store
|
||||
description: ''
|
||||
operationId: addPet
|
||||
responses:
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
requestBody:
|
||||
"$ref": "#/components/requestBodies/Pet"
|
||||
put:
|
||||
tags:
|
||||
- pet
|
||||
summary: Update an existing pet
|
||||
description: ''
|
||||
operationId: updatePet
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Pet not found
|
||||
'405':
|
||||
description: Validation exception
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
requestBody:
|
||||
"$ref": "#/components/requestBodies/Pet"
|
||||
"/pet/findByStatus":
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Finds Pets by status
|
||||
description: Multiple status values can be provided with comma separated strings
|
||||
operationId: findPetsByStatus
|
||||
parameters:
|
||||
- name: status
|
||||
in: query
|
||||
description: Status values that need to be considered for filter
|
||||
required: true
|
||||
explode: true
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
default: available
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/Pet"
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/Pet"
|
||||
'400':
|
||||
description: Invalid status value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
"/pet/findByTags":
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Finds Pets by tags
|
||||
description: Muliple tags can be provided with comma separated strings. Use
|
||||
tag1, tag2, tag3 for testing.
|
||||
operationId: findPetsByTags
|
||||
parameters:
|
||||
- name: tags
|
||||
in: query
|
||||
description: Tags to filter by
|
||||
required: true
|
||||
explode: true
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/Pet"
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/Pet"
|
||||
'400':
|
||||
description: Invalid tag value
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
deprecated: true
|
||||
"/pet/{petId}":
|
||||
get:
|
||||
tags:
|
||||
- pet
|
||||
summary: Find pet by ID
|
||||
description: Returns a single pet
|
||||
operationId: getPetById
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to return
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/Pet"
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/Pet"
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Pet not found
|
||||
security:
|
||||
- api_key: []
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Updates a pet in the store with form data
|
||||
description: ''
|
||||
operationId: updatePetWithForm
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet that needs to be updated
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'405':
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
requestBody:
|
||||
content:
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
description: Updated name of the pet
|
||||
type: string
|
||||
status:
|
||||
description: Updated status of the pet
|
||||
type: string
|
||||
delete:
|
||||
tags:
|
||||
- pet
|
||||
summary: Deletes a pet
|
||||
description: ''
|
||||
operationId: deletePet
|
||||
parameters:
|
||||
- name: api_key
|
||||
in: header
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
- name: petId
|
||||
in: path
|
||||
description: Pet id to delete
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Pet not found
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
"/pet/{petId}/uploadImage":
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: uploads an image
|
||||
description: ''
|
||||
operationId: uploadFile
|
||||
parameters:
|
||||
- name: petId
|
||||
in: path
|
||||
description: ID of pet to update
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ApiResponse"
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
requestBody:
|
||||
content:
|
||||
application/octet-stream:
|
||||
schema:
|
||||
type: string
|
||||
format: binary
|
||||
"/store/inventory":
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
summary: Returns pet inventories by status
|
||||
description: Returns a map of status codes to quantities
|
||||
operationId: getInventory
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: integer
|
||||
format: int32
|
||||
security:
|
||||
- api_key: []
|
||||
"/store/order":
|
||||
post:
|
||||
tags:
|
||||
- store
|
||||
summary: Place an order for a pet
|
||||
description: ''
|
||||
operationId: placeOrder
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/Order"
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/Order"
|
||||
'400':
|
||||
description: Invalid Order
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/Order"
|
||||
description: order placed for purchasing the pet
|
||||
required: true
|
||||
"/store/order/{orderId}":
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
summary: Find purchase order by ID
|
||||
description: For valid response try integer IDs with value >= 1 and <= 10. Other
|
||||
values will generated exceptions
|
||||
operationId: getOrderById
|
||||
parameters:
|
||||
- name: orderId
|
||||
in: path
|
||||
description: ID of pet that needs to be fetched
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 1
|
||||
maximum: 10
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/Order"
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/Order"
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Order not found
|
||||
delete:
|
||||
tags:
|
||||
- store
|
||||
summary: Delete purchase order by ID
|
||||
description: For valid response try integer IDs with positive integer value.
|
||||
Negative or non-integer values will generate API errors
|
||||
operationId: deleteOrder
|
||||
parameters:
|
||||
- name: orderId
|
||||
in: path
|
||||
description: ID of the order that needs to be deleted
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
minimum: 1
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid ID supplied
|
||||
'404':
|
||||
description: Order not found
|
||||
"/user":
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Create user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: createUser
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/User"
|
||||
description: Created user object
|
||||
required: true
|
||||
"/user/createWithArray":
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Creates list of users with given input array
|
||||
description: ''
|
||||
operationId: createUsersWithArrayInput
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
requestBody:
|
||||
"$ref": "#/components/requestBodies/UserArray"
|
||||
"/user/createWithList":
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Creates list of users with given input array
|
||||
description: ''
|
||||
operationId: createUsersWithListInput
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
requestBody:
|
||||
"$ref": "#/components/requestBodies/UserArray"
|
||||
"/user/login":
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Logs user into the system
|
||||
description: ''
|
||||
operationId: loginUser
|
||||
parameters:
|
||||
- name: username
|
||||
in: query
|
||||
description: The user name for login
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- name: password
|
||||
in: query
|
||||
description: The password for login in clear text
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
headers:
|
||||
X-Rate-Limit:
|
||||
description: calls per hour allowed by the user
|
||||
schema:
|
||||
type: integer
|
||||
format: int32
|
||||
X-Expires-After:
|
||||
description: date in UTC when token expires
|
||||
schema:
|
||||
type: string
|
||||
format: date-time
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
type: string
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
'400':
|
||||
description: Invalid username/password supplied
|
||||
"/user/logout":
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Logs out current logged in user session
|
||||
description: ''
|
||||
operationId: logoutUser
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
"/user/{username}":
|
||||
get:
|
||||
tags:
|
||||
- user
|
||||
summary: Get user by user name
|
||||
description: ''
|
||||
operationId: getUserByName
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: 'The name that needs to be fetched. Use user1 for testing. '
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/User"
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/User"
|
||||
'400':
|
||||
description: Invalid username supplied
|
||||
'404':
|
||||
description: User not found
|
||||
put:
|
||||
tags:
|
||||
- user
|
||||
summary: Updated user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: updateUser
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: name that need to be updated
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid user supplied
|
||||
'404':
|
||||
description: User not found
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/User"
|
||||
description: Updated user object
|
||||
required: true
|
||||
delete:
|
||||
tags:
|
||||
- user
|
||||
summary: Delete user
|
||||
description: This can only be done by the logged in user.
|
||||
operationId: deleteUser
|
||||
parameters:
|
||||
- name: username
|
||||
in: path
|
||||
description: The name that needs to be deleted
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'400':
|
||||
description: Invalid username supplied
|
||||
'404':
|
||||
description: User not found
|
||||
externalDocs:
|
||||
description: Find out more about Swagger
|
||||
url: http://swagger.io
|
||||
components:
|
||||
schemas:
|
||||
Order:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
petId:
|
||||
type: integer
|
||||
format: int64
|
||||
quantity:
|
||||
type: integer
|
||||
format: int32
|
||||
shipDate:
|
||||
type: string
|
||||
format: date-time
|
||||
status:
|
||||
type: string
|
||||
description: Order Status
|
||||
enum:
|
||||
- placed
|
||||
- approved
|
||||
- delivered
|
||||
complete:
|
||||
type: boolean
|
||||
default: false
|
||||
xml:
|
||||
name: Order
|
||||
Category:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
xml:
|
||||
name: Category
|
||||
User:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
username:
|
||||
type: string
|
||||
firstName:
|
||||
type: string
|
||||
lastName:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
phone:
|
||||
type: string
|
||||
userStatus:
|
||||
type: integer
|
||||
format: int32
|
||||
description: User Status
|
||||
xml:
|
||||
name: User
|
||||
Tag:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
xml:
|
||||
name: Tag
|
||||
Pet:
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- photoUrls
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
category:
|
||||
"$ref": "#/components/schemas/Category"
|
||||
name:
|
||||
type: string
|
||||
example: doggie
|
||||
photoUrls:
|
||||
type: array
|
||||
xml:
|
||||
name: photoUrl
|
||||
wrapped: true
|
||||
items:
|
||||
type: string
|
||||
tags:
|
||||
type: array
|
||||
xml:
|
||||
name: tag
|
||||
wrapped: true
|
||||
items:
|
||||
"$ref": "#/components/schemas/Tag"
|
||||
status:
|
||||
type: string
|
||||
description: pet status in the store
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
xml:
|
||||
name: Pet
|
||||
ApiResponse:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int32
|
||||
type:
|
||||
type: string
|
||||
message:
|
||||
type: string
|
||||
requestBodies:
|
||||
Pet:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/Pet"
|
||||
application/xml:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/Pet"
|
||||
description: Pet object that needs to be added to the store
|
||||
required: true
|
||||
UserArray:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
"$ref": "#/components/schemas/User"
|
||||
description: List of user object
|
||||
required: true
|
||||
securitySchemes:
|
||||
petstore_auth:
|
||||
type: oauth2
|
||||
flows:
|
||||
implicit:
|
||||
authorizationUrl: http://petstore.swagger.io/oauth/dialog
|
||||
scopes:
|
||||
write:pets: modify pets in your account
|
||||
read:pets: read your pets
|
||||
api_key:
|
||||
type: apiKey
|
||||
name: api_key
|
||||
in: header
|
@ -0,0 +1,32 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
description: |
|
||||
This is a test to show how model reference from another file fails.
|
||||
This file references api2.yaml. If you load this file first in the browser it fails.
|
||||
However, if you load api2.yaml first, then load this one it will work.
|
||||
version: 1.0.0
|
||||
title: API1 Test
|
||||
paths:
|
||||
'/test-api-1':
|
||||
get:
|
||||
summary: Api 1
|
||||
responses:
|
||||
'200':
|
||||
description: 'api 2 response'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TestResponse'
|
||||
components:
|
||||
schemas:
|
||||
Api1Prop:
|
||||
type: string
|
||||
example: 'api1prop-value'
|
||||
|
||||
TestResponse:
|
||||
type: object
|
||||
properties:
|
||||
api1prop:
|
||||
$ref: '#/components/schemas/Api1Prop'
|
||||
api2prop:
|
||||
$ref: 'api2.yaml#/components/schemas/Api2Prop'
|
@ -0,0 +1,32 @@
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
description: |
|
||||
This is a test to show how model reference from another file fails.
|
||||
This file is referenced api1.yaml. If you load api1.yaml first in the browser it fails.
|
||||
However, if you load this file first, then load api1.yaml it will work.
|
||||
version: 1.0.0
|
||||
title: API2 Test
|
||||
paths:
|
||||
'/test-api-2':
|
||||
get:
|
||||
summary: Api 2
|
||||
responses:
|
||||
'200':
|
||||
description: api 2 response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TestResponse2'
|
||||
components:
|
||||
schemas:
|
||||
Api2Prop:
|
||||
type: string
|
||||
description: this is an api2prop
|
||||
example: 'api1prop-value'
|
||||
|
||||
TestResponse2:
|
||||
type: object
|
||||
description: This is a test prop
|
||||
properties:
|
||||
api2prop:
|
||||
$ref: '#/components/schemas/Api2Prop'
|
Reference in New Issue
Block a user