fix
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
const editor = {
|
||||
create: () => {
|
||||
return {
|
||||
// methods
|
||||
setValue: () => {},
|
||||
setTheme: () => {},
|
||||
setModelLanguage: () => {},
|
||||
getModel: () => {},
|
||||
layout: () => {},
|
||||
dispose: () => {},
|
||||
focus: () => {},
|
||||
onDidChangeModelContent: () => {},
|
||||
updateOptions: () => {},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
// const languages = {
|
||||
// register: (language) => {},
|
||||
// setMonarchTokensProvider: (name, tokens) => {},
|
||||
// registerCompletionItemProvider: (name, provider) => {}
|
||||
// };
|
||||
|
||||
const monaco = { editor };
|
||||
|
||||
module.exports = monaco;
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
}
|
||||
@@ -0,0 +1,802 @@
|
||||
openapi: 3.0.2
|
||||
info:
|
||||
title: CI Example - Swagger Petstore - OpenAPI 3.0
|
||||
description: "This is a sample Pet Store Server based on the OpenAPI 3.0 specification.\
|
||||
\ You can find out more about\nSwagger at [http://swagger.io](http://swagger.io).\
|
||||
\ In the third iteration of the pet store, we've switched to the design first\
|
||||
\ approach!\nYou can now help us improve the API whether it's by making changes\
|
||||
\ to the definition itself or to the code.\nThat way, with time, we can improve\
|
||||
\ the API in general, and expose some of the new features in OAS3.\n\nSome useful\
|
||||
\ links:\n- [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)\n\
|
||||
- [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)"
|
||||
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
|
||||
version: 1.0.6
|
||||
externalDocs:
|
||||
description: Find out more about Swagger
|
||||
url: http://swagger.io
|
||||
servers:
|
||||
- url: /api/v3
|
||||
tags:
|
||||
- name: pet
|
||||
description: Everything about your Pets
|
||||
externalDocs:
|
||||
description: Find out more
|
||||
url: http://swagger.io
|
||||
- name: store
|
||||
description: Operations about user
|
||||
- name: user
|
||||
description: Access to Petstore orders
|
||||
externalDocs:
|
||||
description: Find out more about our store
|
||||
url: http://swagger.io
|
||||
paths:
|
||||
/pet:
|
||||
put:
|
||||
tags:
|
||||
- pet
|
||||
summary: Update an existing pet
|
||||
description: Update an existing pet by Id
|
||||
operationId: updatePet
|
||||
requestBody:
|
||||
description: Update an existent pet in the store
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
required: true
|
||||
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
|
||||
"405":
|
||||
description: Validation exception
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
post:
|
||||
tags:
|
||||
- pet
|
||||
summary: Add a new pet to the store
|
||||
description: Add a new pet to the store
|
||||
operationId: addPet
|
||||
requestBody:
|
||||
description: Create a new pet in the store
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
required: true
|
||||
responses:
|
||||
"200":
|
||||
description: Successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
"405":
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
/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: false
|
||||
explode: true
|
||||
schema:
|
||||
type: string
|
||||
default: available
|
||||
enum:
|
||||
- available
|
||||
- pending
|
||||
- sold
|
||||
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: "Multiple 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: false
|
||||
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
|
||||
/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: []
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
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
|
||||
- name: name
|
||||
in: query
|
||||
description: Name of pet that needs to be updated
|
||||
schema:
|
||||
type: string
|
||||
- name: status
|
||||
in: query
|
||||
description: Status of pet that needs to be updated
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"405":
|
||||
description: Invalid input
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
delete:
|
||||
tags:
|
||||
- pet
|
||||
summary: Deletes a pet
|
||||
description: ""
|
||||
operationId: deletePet
|
||||
parameters:
|
||||
- name: api_key
|
||||
in: header
|
||||
description: ""
|
||||
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 pet value
|
||||
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
|
||||
- name: additionalMetadata
|
||||
in: query
|
||||
description: Additional Metadata
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
content:
|
||||
application/octet-stream:
|
||||
schema:
|
||||
type: string
|
||||
format: binary
|
||||
responses:
|
||||
"200":
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponse'
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
/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: Place a new order in the store
|
||||
operationId: placeOrder
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
responses:
|
||||
"200":
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Order'
|
||||
"405":
|
||||
description: Invalid input
|
||||
/store/order/{orderId}:
|
||||
get:
|
||||
tags:
|
||||
- store
|
||||
summary: Find purchase order by ID
|
||||
description: For valid response try integer IDs with value <= 5 or > 10. Other
|
||||
values will generated exceptions
|
||||
operationId: getOrderById
|
||||
parameters:
|
||||
- name: orderId
|
||||
in: path
|
||||
description: ID of order that needs to be fetched
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
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 value < 1000. Anything
|
||||
above 1000 or nonintegers 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
|
||||
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
|
||||
requestBody:
|
||||
description: Created user object
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
/user/createWithList:
|
||||
post:
|
||||
tags:
|
||||
- user
|
||||
summary: Creates list of users with given input array
|
||||
description: Creates list of users with given input array
|
||||
operationId: createUsersWithListInput
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/User'
|
||||
responses:
|
||||
"200":
|
||||
description: Successful operation
|
||||
content:
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
default:
|
||||
description: successful operation
|
||||
/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: false
|
||||
schema:
|
||||
type: string
|
||||
- name: password
|
||||
in: query
|
||||
description: The password for login in clear text
|
||||
required: false
|
||||
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
|
||||
parameters: []
|
||||
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: Update 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 deleted
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
description: Update an existent user in the store
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
responses:
|
||||
default:
|
||||
description: successful operation
|
||||
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
|
||||
components:
|
||||
schemas:
|
||||
Order:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
example: 10
|
||||
petId:
|
||||
type: integer
|
||||
format: int64
|
||||
example: 198772
|
||||
quantity:
|
||||
type: integer
|
||||
format: int32
|
||||
example: 7
|
||||
shipDate:
|
||||
type: string
|
||||
format: date-time
|
||||
status:
|
||||
type: string
|
||||
description: Order Status
|
||||
example: approved
|
||||
enum:
|
||||
- placed
|
||||
- approved
|
||||
- delivered
|
||||
complete:
|
||||
type: boolean
|
||||
xml:
|
||||
name: order
|
||||
Customer:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
example: 100000
|
||||
username:
|
||||
type: string
|
||||
example: fehguy
|
||||
address:
|
||||
type: array
|
||||
xml:
|
||||
name: addresses
|
||||
wrapped: true
|
||||
items:
|
||||
$ref: '#/components/schemas/Address'
|
||||
xml:
|
||||
name: customer
|
||||
Address:
|
||||
type: object
|
||||
properties:
|
||||
street:
|
||||
type: string
|
||||
example: 437 Lytton
|
||||
city:
|
||||
type: string
|
||||
example: Palo Alto
|
||||
state:
|
||||
type: string
|
||||
example: CA
|
||||
zip:
|
||||
type: string
|
||||
example: "94301"
|
||||
xml:
|
||||
name: address
|
||||
Category:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
example: 1
|
||||
name:
|
||||
type: string
|
||||
example: Dogs
|
||||
xml:
|
||||
name: category
|
||||
User:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
example: 10
|
||||
username:
|
||||
type: string
|
||||
example: theUser
|
||||
firstName:
|
||||
type: string
|
||||
example: John
|
||||
lastName:
|
||||
type: string
|
||||
example: James
|
||||
email:
|
||||
type: string
|
||||
example: john@email.com
|
||||
password:
|
||||
type: string
|
||||
example: "12345"
|
||||
phone:
|
||||
type: string
|
||||
example: "12345"
|
||||
userStatus:
|
||||
type: integer
|
||||
description: User Status
|
||||
format: int32
|
||||
example: 1
|
||||
xml:
|
||||
name: user
|
||||
Tag:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
name:
|
||||
type: string
|
||||
xml:
|
||||
name: tag
|
||||
Pet:
|
||||
required:
|
||||
- name
|
||||
- photoUrls
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
example: 10
|
||||
name:
|
||||
type: string
|
||||
example: doggie
|
||||
category:
|
||||
$ref: '#/components/schemas/Category'
|
||||
photoUrls:
|
||||
type: array
|
||||
xml:
|
||||
wrapped: true
|
||||
items:
|
||||
type: string
|
||||
xml:
|
||||
name: photoUrl
|
||||
tags:
|
||||
type: array
|
||||
xml:
|
||||
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
|
||||
xml:
|
||||
name: '##default'
|
||||
requestBodies:
|
||||
Pet:
|
||||
description: Pet object that needs to be added to the store
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
application/xml:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Pet'
|
||||
UserArray:
|
||||
description: List of user object
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/User'
|
||||
securitySchemes:
|
||||
petstore_auth:
|
||||
type: oauth2
|
||||
flows:
|
||||
implicit:
|
||||
authorizationUrl: https://petstore3.swagger.io/oauth/authorize
|
||||
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 @@
|
||||
1
|
||||
@@ -0,0 +1 @@
|
||||
2
|
||||
@@ -0,0 +1,188 @@
|
||||
asyncapi: '2.5.0'
|
||||
info:
|
||||
title: Streetlights Kafka API
|
||||
version: '1.0.0'
|
||||
description: |
|
||||
The Smartylighting Streetlights API allows you to remotely manage the city lights.
|
||||
|
||||
### Check out its awesome features:
|
||||
|
||||
* Turn a specific streetlight on/off 🌃
|
||||
* Dim a specific streetlight 😎
|
||||
* Receive real-time information about environmental lighting conditions 📈
|
||||
license:
|
||||
name: Apache 2.0
|
||||
url: https://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
servers:
|
||||
scram-connections:
|
||||
url: test.mykafkacluster.org:18092
|
||||
protocol: kafka-secure
|
||||
description: Test broker secured with scramSha256
|
||||
security:
|
||||
- saslScram: []
|
||||
tags:
|
||||
- name: "env:test-scram"
|
||||
description: "This environment is meant for running internal tests through scramSha256"
|
||||
- name: "kind:remote"
|
||||
description: "This server is a remote server. Not exposed by the application"
|
||||
- name: "visibility:private"
|
||||
description: "This resource is private and only available to certain users"
|
||||
mtls-connections:
|
||||
url: test.mykafkacluster.org:28092
|
||||
protocol: kafka-secure
|
||||
description: Test broker secured with X509
|
||||
security:
|
||||
- certs: []
|
||||
tags:
|
||||
- name: "env:test-mtls"
|
||||
description: "This environment is meant for running internal tests through mtls"
|
||||
- name: "kind:remote"
|
||||
description: "This server is a remote server. Not exposed by the application"
|
||||
- name: "visibility:private"
|
||||
description: "This resource is private and only available to certain users"
|
||||
|
||||
defaultContentType: application/json
|
||||
|
||||
channels:
|
||||
smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured:
|
||||
description: The topic on which measured values may be produced and consumed.
|
||||
parameters:
|
||||
streetlightId:
|
||||
$ref: '#/components/parameters/streetlightId'
|
||||
publish:
|
||||
summary: Inform about environmental lighting conditions of a particular streetlight.
|
||||
operationId: receiveLightMeasurement
|
||||
traits:
|
||||
- $ref: '#/components/operationTraits/kafka'
|
||||
message:
|
||||
$ref: '#/components/messages/lightMeasured'
|
||||
|
||||
smartylighting.streetlights.1.0.action.{streetlightId}.turn.on:
|
||||
parameters:
|
||||
streetlightId:
|
||||
$ref: '#/components/parameters/streetlightId'
|
||||
subscribe:
|
||||
operationId: turnOn
|
||||
traits:
|
||||
- $ref: '#/components/operationTraits/kafka'
|
||||
message:
|
||||
$ref: '#/components/messages/turnOnOff'
|
||||
|
||||
smartylighting.streetlights.1.0.action.{streetlightId}.turn.off:
|
||||
parameters:
|
||||
streetlightId:
|
||||
$ref: '#/components/parameters/streetlightId'
|
||||
subscribe:
|
||||
operationId: turnOff
|
||||
traits:
|
||||
- $ref: '#/components/operationTraits/kafka'
|
||||
message:
|
||||
$ref: '#/components/messages/turnOnOff'
|
||||
|
||||
smartylighting.streetlights.1.0.action.{streetlightId}.dim:
|
||||
parameters:
|
||||
streetlightId:
|
||||
$ref: '#/components/parameters/streetlightId'
|
||||
subscribe:
|
||||
operationId: dimLight
|
||||
traits:
|
||||
- $ref: '#/components/operationTraits/kafka'
|
||||
message:
|
||||
$ref: '#/components/messages/dimLight'
|
||||
|
||||
components:
|
||||
messages:
|
||||
lightMeasured:
|
||||
name: lightMeasured
|
||||
title: Light measured
|
||||
summary: Inform about environmental lighting conditions of a particular streetlight.
|
||||
contentType: application/json
|
||||
traits:
|
||||
- $ref: '#/components/messageTraits/commonHeaders'
|
||||
payload:
|
||||
$ref: "#/components/schemas/lightMeasuredPayload"
|
||||
turnOnOff:
|
||||
name: turnOnOff
|
||||
title: Turn on/off
|
||||
summary: Command a particular streetlight to turn the lights on or off.
|
||||
traits:
|
||||
- $ref: '#/components/messageTraits/commonHeaders'
|
||||
payload:
|
||||
$ref: "#/components/schemas/turnOnOffPayload"
|
||||
dimLight:
|
||||
name: dimLight
|
||||
title: Dim light
|
||||
summary: Command a particular streetlight to dim the lights.
|
||||
traits:
|
||||
- $ref: '#/components/messageTraits/commonHeaders'
|
||||
payload:
|
||||
$ref: "#/components/schemas/dimLightPayload"
|
||||
|
||||
schemas:
|
||||
lightMeasuredPayload:
|
||||
type: object
|
||||
properties:
|
||||
lumens:
|
||||
type: integer
|
||||
minimum: 0
|
||||
description: Light intensity measured in lumens.
|
||||
sentAt:
|
||||
$ref: "#/components/schemas/sentAt"
|
||||
turnOnOffPayload:
|
||||
type: object
|
||||
properties:
|
||||
command:
|
||||
type: string
|
||||
enum:
|
||||
- on
|
||||
- off
|
||||
description: Whether to turn on or off the light.
|
||||
sentAt:
|
||||
$ref: "#/components/schemas/sentAt"
|
||||
dimLightPayload:
|
||||
type: object
|
||||
properties:
|
||||
percentage:
|
||||
type: integer
|
||||
description: Percentage to which the light should be dimmed to.
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
sentAt:
|
||||
$ref: "#/components/schemas/sentAt"
|
||||
sentAt:
|
||||
type: string
|
||||
format: date-time
|
||||
description: Date and time when the message was sent.
|
||||
|
||||
securitySchemes:
|
||||
saslScram:
|
||||
type: scramSha256
|
||||
description: Provide your username and password for SASL/SCRAM authentication
|
||||
certs:
|
||||
type: X509
|
||||
description: Download the certificate files from service provider
|
||||
|
||||
parameters:
|
||||
streetlightId:
|
||||
description: The ID of the streetlight.
|
||||
schema:
|
||||
type: string
|
||||
|
||||
messageTraits:
|
||||
commonHeaders:
|
||||
headers:
|
||||
type: object
|
||||
properties:
|
||||
my-app-header:
|
||||
type: integer
|
||||
minimum: 0
|
||||
maximum: 100
|
||||
|
||||
operationTraits:
|
||||
kafka:
|
||||
bindings:
|
||||
kafka:
|
||||
clientId:
|
||||
type: string
|
||||
enum: ['my-app-id']
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"rules": {
|
||||
"testing-library/await-async-utils": 0,
|
||||
"testing-library/await-async-query": 0,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
describe('App', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitBlankPage();
|
||||
cy.visit('/');
|
||||
cy.waitForSplashScreen();
|
||||
});
|
||||
|
||||
it('should render the app', () => {
|
||||
// dev: picking a random element that should display, in this case the 'File' menu dropdown
|
||||
// eslint-disable-next-line testing-library/prefer-screen-queries
|
||||
cy.findByText('File').should('exist');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
describe('Dialogs: Confirm', () => {
|
||||
/**
|
||||
* TopBar uses the `ConfirmDialog` and `AlertDialog` components
|
||||
* from the `Dialogs` plugin, but both are available for use by
|
||||
* other plugins and components.
|
||||
* The AlertDialog component is generally reserved for unxpected
|
||||
* end user error messages, and hopefully not seen in normal use,
|
||||
* so we do not currently test it here.
|
||||
* Ref: plugin.dropzone.spec.js contains an E2E assertion for AlertDialog
|
||||
* */
|
||||
beforeEach(() => {
|
||||
cy.visitBlankPage();
|
||||
cy.prepareAsyncAPI();
|
||||
cy.prepareOasGenerator();
|
||||
cy.waitForSplashScreen();
|
||||
});
|
||||
it('should close the Confirm Dialog via `x` button', () => {
|
||||
cy.contains('File').click(); // File Menu
|
||||
cy.contains('Import URL')
|
||||
.trigger('mousemove')
|
||||
.click()
|
||||
.get('#input-import-url')
|
||||
.should('be.visible')
|
||||
.get('.close')
|
||||
.click()
|
||||
.get('#input-import-url')
|
||||
.should('not.exist');
|
||||
});
|
||||
it('should close the Confirm Dialog via `Cancel` button', () => {
|
||||
cy.contains('File').click(); // File Menu
|
||||
cy.contains('Import URL')
|
||||
.trigger('mousemove')
|
||||
.click()
|
||||
.get('#input-import-url')
|
||||
.should('be.visible')
|
||||
.get('.btn-secondary')
|
||||
.click()
|
||||
.get('#input-import-url')
|
||||
.should('not.exist');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,46 @@
|
||||
describe('Dropzone in Layout', () => {
|
||||
describe('file uploads with dropzone', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitBlankPage();
|
||||
cy.prepareAsyncAPI();
|
||||
cy.prepareOasGenerator();
|
||||
cy.waitForSplashScreen();
|
||||
});
|
||||
|
||||
describe('when more than one file of an expected type is dropped', () => {
|
||||
it('should inform the user that their file(s) were rejected', () => {
|
||||
cy.get('[data-cy="dropzone"]')
|
||||
.attachFile(['petstore-oas3.yaml', 'petstore-oas3.yaml'], { subjectType: 'input' })
|
||||
.then(() => {
|
||||
cy.get('.modal-title')
|
||||
.should('contains.text', 'Uh oh, an error has occurred')
|
||||
.get('.modal-body > div')
|
||||
.should('contains.text', 'Sorry, there was an error processing your file')
|
||||
// assert on AlertDialog interaction via `x` button'
|
||||
.get('.close')
|
||||
.click()
|
||||
.get('.modal-title')
|
||||
.should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when one file of an expected type is dropped', () => {
|
||||
it('should update the EditorPane and the EditorPreviewPane', () => {
|
||||
/**
|
||||
* subjectType: 'drag-n-drop' doesn't work correctly as it generates
|
||||
* `dragleave` and then `dragenter` events (in that order), which manifests in always
|
||||
* seeing the dropzone overlay. The goal of this test is to see when the
|
||||
* file is uploaded that the editor content and rendered UI changes and
|
||||
* this goal is satisfied.
|
||||
*/
|
||||
|
||||
cy.get('[data-cy="dropzone"]').attachFile('petstore-oas3.yaml', {
|
||||
subjectType: 'input',
|
||||
});
|
||||
// This assertion assumes change from non-OAS3 to OAS3, where a "badge" will exist for OAS3
|
||||
cy.get('.version-stamp > .version').should('have.text', 'OAS3');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,62 @@
|
||||
describe('Monaco Editor with Parser', () => {
|
||||
const selectAllKeys = ['darwin'].includes(Cypress.platform) ? '{cmd}a' : '{ctrl}a';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.visitBlankPage();
|
||||
cy.window().then((contentWindow) => {
|
||||
// console.log already globally stubbed in cy support/commands
|
||||
cy.spy(contentWindow.console, 'error').as('consoleError');
|
||||
});
|
||||
cy.prepareAsyncAPI();
|
||||
cy.prepareOasGenerator();
|
||||
cy.waitForSplashScreen();
|
||||
});
|
||||
|
||||
it('should not throw console.error when parsing empty string', () => {
|
||||
cy.get('.monaco-editor textarea:first', { timeout: 10000 })
|
||||
.should('be.visible')
|
||||
.click({ force: true })
|
||||
.focused()
|
||||
.type(selectAllKeys)
|
||||
.clear();
|
||||
|
||||
cy.waitForContentPropagation();
|
||||
|
||||
cy.get('@consoleError').should('not.be.called');
|
||||
cy.get('.monaco-editor .view-lines').should('contains.text', '');
|
||||
});
|
||||
|
||||
it('should not throw console.error when parsing unsupported definition', () => {
|
||||
cy.get('.monaco-editor textarea:first', { timeout: 10000 })
|
||||
.should('be.visible')
|
||||
.click({ force: true })
|
||||
.focused()
|
||||
.type(selectAllKeys)
|
||||
.type('randomapi: 1.0.0\n');
|
||||
|
||||
cy.waitForContentPropagation();
|
||||
|
||||
cy.get('@consoleError').should('not.be.called');
|
||||
cy.get('.monaco-editor .view-lines').should('contains.text', 'randomapi');
|
||||
});
|
||||
|
||||
it('should toggle between light and dark themes', () => {
|
||||
// default dark
|
||||
cy.get(':nth-child(2) > .swagger-editor__editor-pane-bar-control > .octicon-sun').should(
|
||||
'be.visible'
|
||||
);
|
||||
cy.get('.swagger-editor__editor-monaco > .vs-dark ').should('exist');
|
||||
// toggle to light
|
||||
cy.get(':nth-child(2) > .swagger-editor__editor-pane-bar-control').click();
|
||||
cy.get(':nth-child(2) > .swagger-editor__editor-pane-bar-control > .octicon-moon').should(
|
||||
'be.visible'
|
||||
);
|
||||
cy.get('.swagger-editor__editor-monaco > .vs ').should('exist');
|
||||
// toggle back to dark
|
||||
cy.get(':nth-child(2) > .swagger-editor__editor-pane-bar-control').click();
|
||||
cy.get(':nth-child(2) > .swagger-editor__editor-pane-bar-control > .octicon-sun').should(
|
||||
'be.visible'
|
||||
);
|
||||
cy.get('.swagger-editor__editor-monaco > .vs-dark ').should('exist');
|
||||
});
|
||||
});
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
describe('EditorPersistencePlugin', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitBlankPage();
|
||||
cy.prepareOasGenerator();
|
||||
});
|
||||
|
||||
it('should load definition with provided url prop', () => {
|
||||
cy.prepareAsyncAPI();
|
||||
cy.waitForSplashScreen();
|
||||
|
||||
cy.get('.monaco-editor .view-lines')
|
||||
.should('contains.text', 'asyncapi')
|
||||
.should('contains.text', '2.5.0');
|
||||
});
|
||||
|
||||
it.skip('should reload while keeping text change from 2.5.0 to 2.4.0', () => {
|
||||
cy.prepareAsyncAPI();
|
||||
cy.waitForSplashScreen();
|
||||
|
||||
const moveToPosition = `{rightArrow}{rightArrow}{rightArrow}{rightArrow}{rightArrow}{rightArrow}{rightArrow}{rightArrow}{rightArrow}{rightArrow}{rightArrow}{rightArrow}{rightArrow}`;
|
||||
|
||||
cy.get('.monaco-editor textarea:first', { timeout: 10000 })
|
||||
.should('be.visible')
|
||||
.click({ force: true })
|
||||
.focused()
|
||||
.type(`${moveToPosition}{shift+rightArrow}4`);
|
||||
|
||||
cy.get('.monaco-editor .view-lines')
|
||||
.should('contains.text', '2.4.0')
|
||||
.should('not.contains.text', '2.5.0');
|
||||
|
||||
cy.waitForContentPropagation();
|
||||
cy.reload();
|
||||
|
||||
cy.waitForSplashScreen();
|
||||
cy.get('.monaco-editor .view-lines')
|
||||
.should('contains.text', '2.4.0')
|
||||
.should('not.contains.text', '2.5.0');
|
||||
});
|
||||
});
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
describe('Editor Preview Pane: AsyncAPI 2.x', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitBlankPage();
|
||||
cy.prepareAsyncAPI();
|
||||
cy.prepareOasGenerator();
|
||||
cy.waitForSplashScreen();
|
||||
});
|
||||
|
||||
it('displays API Design Systems', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('API Design Systems').trigger('mousemove').click();
|
||||
|
||||
cy.get('.title').contains('SmartBear API Guidelines').should('be.visible');
|
||||
cy.get('.version-stamp > .version').should('be.visible').contains('ADS').should('be.visible');
|
||||
});
|
||||
|
||||
it('hidden if not API Design Systems', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.0 Petstore').trigger('mousemove').click();
|
||||
|
||||
cy.get('.title').contains('SmartBear API Guidelines').should('not.exist');
|
||||
cy.get('.version-stamp > .version').find('ADS').should('not.exist');
|
||||
});
|
||||
});
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
describe('Editor Preview Pane: AsyncAPI 2.x', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitBlankPage();
|
||||
cy.prepareAsyncAPI();
|
||||
cy.prepareOasGenerator();
|
||||
cy.waitForSplashScreen();
|
||||
});
|
||||
|
||||
it('displays AsyncAPI 2.x.x', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('AsyncAPI 2.5 Streetlights').trigger('mousemove').click();
|
||||
|
||||
cy.get('#check-out-its-awesome-features').should('be.visible');
|
||||
cy.get('#servers').should('be.visible');
|
||||
});
|
||||
|
||||
it('hidden if not AsyncAPI 2.x.x', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.0 Petstore').trigger('mousemove').click();
|
||||
|
||||
cy.get('#check-out-its-awesome-features').should('not.exist');
|
||||
cy.get('#servers').should('not.exist');
|
||||
});
|
||||
});
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
describe('Editor Preview Pane: OpenAPI 2.0, 3.0.x, 3.1.x', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitBlankPage();
|
||||
cy.prepareAsyncAPI();
|
||||
cy.prepareOasGenerator();
|
||||
cy.waitForSplashScreen();
|
||||
});
|
||||
|
||||
it('displays OpenAPI 2.0', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 2.0 Petstore').trigger('mousemove').click();
|
||||
|
||||
// `.title` and `.version-stamp` are SwaggerUI specific css classes, that should only appear in the preview pane
|
||||
cy.get('.title').contains('Swagger Petstore 2.0').should('be.visible');
|
||||
cy.get('.version-stamp > .version').should('not.exist');
|
||||
});
|
||||
|
||||
it('displays OpenAPI 3.0', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.0 Petstore').trigger('mousemove').click();
|
||||
|
||||
// `.title` and `.version-stamp` are SwaggerUI specific css classes, that should only appear in the preview pane
|
||||
cy.get('.title').contains('Swagger Petstore - OpenAPI 3.0').should('be.visible');
|
||||
cy.get('.version-stamp > .version').should('be.visible').contains('OAS3').should('be.visible');
|
||||
});
|
||||
|
||||
it('displays OpenAPI 3.1 fallback', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.1 Petstore').trigger('mousemove').click();
|
||||
|
||||
// `.version-pragma__message` is a SwaggerEditor specific css class, that should only appear in the preview pane
|
||||
cy.get('.version-pragma__message h3')
|
||||
.contains('Unable to render editor content')
|
||||
.should('be.visible');
|
||||
cy.get('.version-pragma__message > div')
|
||||
.contains('SwaggerUI does not currently support rendering of OpenAPI 3.1 definitions')
|
||||
.should('be.visible');
|
||||
});
|
||||
|
||||
it('should be hidden if not OpenAPI', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('AsyncAPI 2.5 Petstore').trigger('mousemove').click();
|
||||
|
||||
// `.title` is a SwaggerUI specific css class
|
||||
cy.get('.title').should('not.exist');
|
||||
cy.get('Swagger Petstore').should('not.exist');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
describe('read only', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitBlankPage();
|
||||
cy.prepareAsyncAPI();
|
||||
cy.prepareOasGenerator();
|
||||
cy.waitForSplashScreen();
|
||||
});
|
||||
it('should toggle between allow-write and read-only', () => {
|
||||
// default allow-write
|
||||
cy.get(':nth-child(1) > .swagger-editor__editor-pane-bar-control > .octicon-unlock').should(
|
||||
'be.visible'
|
||||
);
|
||||
cy.get('.monaco-editor textarea:first', { timeout: 10000 })
|
||||
.should('be.visible')
|
||||
.should('not.have.attr', 'readonly');
|
||||
// toggle to read-only
|
||||
cy.get(':nth-child(1) > .swagger-editor__editor-pane-bar-control').click();
|
||||
cy.get(':nth-child(1) > .swagger-editor__editor-pane-bar-control > .octicon-lock').should(
|
||||
'be.visible'
|
||||
);
|
||||
cy.get('.monaco-editor textarea:first', { timeout: 10000 })
|
||||
.should('be.visible')
|
||||
.should('have.attr', 'readonly');
|
||||
// toggle back to allow-write
|
||||
cy.get(':nth-child(1) > .swagger-editor__editor-pane-bar-control').click();
|
||||
cy.get(':nth-child(1) > .swagger-editor__editor-pane-bar-control > .octicon-unlock').should(
|
||||
'be.visible'
|
||||
);
|
||||
cy.get('.monaco-editor textarea:first', { timeout: 10000 })
|
||||
.should('be.visible')
|
||||
.should('not.have.attr', 'readonly');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,370 @@
|
||||
describe('Topbar', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitBlankPage();
|
||||
cy.prepareAsyncAPI();
|
||||
cy.prepareOasGenerator();
|
||||
cy.waitForSplashScreen();
|
||||
});
|
||||
|
||||
describe('File Dropdown Menu', () => {
|
||||
it('should load file from URL', () => {
|
||||
cy.contains('File').click(); // File Menu
|
||||
cy.contains('Import URL')
|
||||
.trigger('mousemove')
|
||||
.click()
|
||||
.get('#input-import-url')
|
||||
.type(
|
||||
'https://raw.githubusercontent.com/asyncapi/spec/v2.5.0/examples/streetlights-kafka.yml'
|
||||
)
|
||||
.get('.btn-primary')
|
||||
.click();
|
||||
cy.get('.view-lines > :nth-child(1)')
|
||||
.should('not.have.text', '|') // applies to both OpenAPI and AsyncAPI cases if yaml improperly loaded
|
||||
.should('contains.text', 'asyncapi');
|
||||
});
|
||||
|
||||
it('should render "Import File" menu item', () => {
|
||||
cy.contains('File').click(); // File Menu
|
||||
cy.contains('Import File').should('exist');
|
||||
});
|
||||
|
||||
it('should "Import File" and display rendered changes', () => {
|
||||
/**
|
||||
* Cypress does not handle native events like opening a File Dialog.
|
||||
* The goal of this test is to see when the file is uploaded that the
|
||||
* editor content and rendered UI changes.
|
||||
* In this test, it is not required for Cypress to "interact" with the
|
||||
* "File" Menu or the "Import File" menu item. If "interact" occurs
|
||||
* with "Import File", test runner will output console warning:
|
||||
* "File chooser dialog can only be shown with a user activation."
|
||||
*/
|
||||
cy.get('input[type=file]').attachFile('petstore-oas3.yaml', {
|
||||
subjectType: 'input',
|
||||
});
|
||||
cy.wait(['@externalGeneratorServersOas3reqList', '@externalGeneratorClientsOas3reqList']);
|
||||
// This assertion assumes change from non-OAS3 to OAS3, where a "badge" will exist for OAS3
|
||||
cy.get('.version-stamp > .version').should('have.text', 'OAS3');
|
||||
});
|
||||
|
||||
describe('Load Example nested menu', () => {
|
||||
it('should load OpenAPI 3.1 Petstore example as YAML', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.1 Petstore').trigger('mousemove').click();
|
||||
|
||||
cy.get('.view-lines > :nth-child(1)')
|
||||
.should('contains.text', '3.1.0')
|
||||
.should('not.have.text', '{')
|
||||
.should('not.have.text', '"');
|
||||
});
|
||||
|
||||
it('should load OpenAPI 3.0 Petstore example as YAML', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.0 Petstore').trigger('mousemove').click();
|
||||
|
||||
cy.get('.view-lines > :nth-child(1)')
|
||||
.should('contains.text', '3.0.3')
|
||||
.should('not.have.text', '{')
|
||||
.should('not.have.text', '"');
|
||||
});
|
||||
|
||||
it('should load OpenAPI 2.0 Petstore example as YAML', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 2.0 Petstore').trigger('mousemove').click();
|
||||
|
||||
cy.get('.view-lines > :nth-child(1)')
|
||||
.should('contains.text', 'swagger')
|
||||
.should('not.have.text', '{')
|
||||
.should('not.have.text', '"');
|
||||
});
|
||||
|
||||
it('should load AsyncAPI 2.5 Petstore example as YAML', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('AsyncAPI 2.5 Petstore').trigger('mousemove').click();
|
||||
|
||||
cy.get('.view-lines > :nth-child(3)')
|
||||
.should('contains.text', 'Petstore')
|
||||
.should('not.have.text', '{')
|
||||
.should('not.have.text', '"');
|
||||
});
|
||||
|
||||
it('should load AsyncAPI 2.5 Streetlights example as YAML', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('AsyncAPI 2.5 Streetlights').trigger('mousemove').click();
|
||||
|
||||
cy.get('.view-lines > :nth-child(3)')
|
||||
.should('contains.text', 'Streetlights')
|
||||
.should('not.have.text', '{')
|
||||
.should('not.have.text', '"');
|
||||
});
|
||||
|
||||
it('should load API Design Systems example as YAML', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('API Design Systems').trigger('mousemove').click();
|
||||
|
||||
cy.get('.view-lines > :nth-child(1)')
|
||||
.should('contains.text', '2021-05-07')
|
||||
.should('not.have.text', '{')
|
||||
.should('not.have.text', '"');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when content is JSON', () => {
|
||||
/**
|
||||
* vs. Edit Menu, operation also will initiate a file download without additional user input
|
||||
* Final production version might not contain
|
||||
* a fixture that we intend to load and display as JSON.
|
||||
* So here we assume that we can load a fixture as YAML,
|
||||
* then convert to JSON.
|
||||
* Then assert expected File Menu item is displayed,
|
||||
* However, no additional assertion for click event or download event
|
||||
* unless we want to check for file existence and/or file contents
|
||||
*/
|
||||
it('should render clickable text: "Save (as JSON)', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.0 Petstore').trigger('mousemove').click();
|
||||
cy.contains('Edit').click();
|
||||
cy.contains('Convert to JSON').trigger('mousemove').click();
|
||||
cy.contains('File').click();
|
||||
cy.contains('Save (as JSON)').should('exist');
|
||||
});
|
||||
|
||||
it('should render clickable text: "Convert and Save as YAML', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.0 Petstore').trigger('mousemove').click();
|
||||
cy.contains('Edit').click();
|
||||
cy.contains('Convert to JSON').trigger('mousemove').click();
|
||||
cy.contains('File').click();
|
||||
cy.contains('Convert and Save as YAML').should('exist');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when content is YAML', () => {
|
||||
/**
|
||||
* vs. Edit Menu, operation also will initiate a file download without additional user input
|
||||
* Here we assume that we can load a fixture as YAML.
|
||||
* Then assert expected File Menu item is displayed,
|
||||
* However, no additional assertion for click event or download event
|
||||
* unless we want to check for file existence and/or file contents
|
||||
*/
|
||||
it('should render clickable text: "Save (as YAML)', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.1 Petstore').trigger('mousemove').click();
|
||||
cy.contains('File').click();
|
||||
cy.contains('Save (as YAML)').should('exist');
|
||||
});
|
||||
|
||||
it('should render clickable text: "Convert and Save as JSON', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.0 Petstore').trigger('mousemove').click();
|
||||
cy.contains('File').click();
|
||||
cy.contains('Convert and Save as JSON').should('exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Edit Dropdown Menu', () => {
|
||||
it('should clear editor', () => {
|
||||
cy.contains('Edit').click();
|
||||
cy.contains('Clear').trigger('mousemove').click();
|
||||
cy.get('.view-lines > :nth-child(1)').should('to.have.text', '');
|
||||
});
|
||||
|
||||
describe('given editor content is in YAML format', () => {
|
||||
it('displays "Convert To JSON" menu item', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.1 Petstore').trigger('mousemove').click();
|
||||
cy.contains('Edit').click();
|
||||
|
||||
cy.contains('Convert to JSON').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
describe('given editor content is in JSON format', () => {
|
||||
it('displays "Convert To YAML" menu item', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.1 Petstore').trigger('mousemove').click();
|
||||
cy.contains('Edit').click();
|
||||
cy.contains('Convert to JSON').trigger('mousemove').click();
|
||||
cy.contains('Edit').click();
|
||||
|
||||
cy.contains('Convert to YAML').should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
describe('"Convert to OpenAPI 3.0.x" menu item', () => {
|
||||
it('displays "Convert to OpenAPI 3.0.x" after loading OpenAPI 2.0 fixture', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 2.0 Petstore').trigger('mousemove').click();
|
||||
cy.contains('Edit').click();
|
||||
|
||||
cy.contains('Convert to OpenAPI 3.0.x').should('be.visible');
|
||||
});
|
||||
|
||||
it('should not display "Convert to OpenAPI 3.0.x" after loading OpenAPI 3.0 fixture', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.0 Petstore').trigger('mousemove').click();
|
||||
cy.contains('Edit').click();
|
||||
|
||||
cy.get('Convert to OpenAPI 3.0.x').should('not.exist');
|
||||
});
|
||||
|
||||
it('should not display "Convert to OpenAPI 3.0.x" after loading AsyncAPI 2.5 fixture', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('AsyncAPI 2.5 Petstore').trigger('mousemove').click();
|
||||
cy.contains('Edit').click();
|
||||
|
||||
cy.get('Convert to OpenAPI 3.0.x').should('not.exist');
|
||||
});
|
||||
|
||||
it('should call external http service to "Convert to OpenAPI 3.0.x" after loading OpenAPI 2.0 fixture', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 2.0 Petstore').trigger('mousemove').click();
|
||||
cy.contains('Edit').click();
|
||||
cy.contains('Convert to OpenAPI 3.0.x')
|
||||
.should('be.visible')
|
||||
.trigger('mousemove')
|
||||
.click()
|
||||
.wait('@externalConverterToOas3');
|
||||
// This assertion assumes change from non-OAS3 to OAS3, where a "badge" will exist for OAS3
|
||||
cy.get('.version-stamp > .version').should('have.text', 'OAS3');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Generator Dropdown Menu(s)', () => {
|
||||
/**
|
||||
* By default, any "Generate Server" or "Generate Client" list
|
||||
* is retrieved via an http service
|
||||
* Clicking on a specific menu item from one of these lists
|
||||
* will auto-download a generated file via an http service
|
||||
* without further user action required
|
||||
*/
|
||||
beforeEach(() => {
|
||||
cy.clearDownloadsFolder();
|
||||
});
|
||||
after(() => {
|
||||
cy.clearDownloadsFolder();
|
||||
});
|
||||
|
||||
const downloadsFolder = Cypress.config('downloadsFolder'); // use default setting
|
||||
|
||||
it('should render "Generate Server" and "Generate Client" dropdown menus when OpenAPI 2.0', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 2.0 Petstore').trigger('mousemove').click();
|
||||
|
||||
cy.contains('Generate Server').should('be.visible');
|
||||
cy.contains('Generate Client').should('be.visible');
|
||||
});
|
||||
|
||||
it('should render "Generate Server" and "Generate Client" dropdown menus when OpenAPI 3.0', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.0 Petstore').trigger('mousemove').click();
|
||||
|
||||
cy.contains('Generate Server').should('be.visible');
|
||||
cy.contains('Generate Client').should('be.visible');
|
||||
});
|
||||
|
||||
it('should NOT render "Generate Server" and "Generate Client" dropdown menus when OpenAPI 3.1', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.1 Petstore').trigger('mousemove').click();
|
||||
|
||||
cy.get('Generate Server').should('not.exist');
|
||||
cy.get('Generate Client').should('not.exist');
|
||||
});
|
||||
|
||||
it('should NOT render "Generate Server" and "Generate Client" dropdown menus when AsyncAPI 2.5', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('AsyncAPI 2.5 Petstore').trigger('mousemove').click();
|
||||
|
||||
cy.get('Generate Server').should('not.exist');
|
||||
cy.get('Generate Client').should('not.exist');
|
||||
});
|
||||
|
||||
it('should download a generated OpenAPI 3.0 Server file', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.0 Petstore').trigger('mousemove').click();
|
||||
cy.contains('Generate Server').should('be.visible').click();
|
||||
cy.contains('blue') // mocked response value
|
||||
.should('be.visible')
|
||||
.trigger('mousemove')
|
||||
.click()
|
||||
.wait('@externalGeneratorOas3Download')
|
||||
.readFile(`${downloadsFolder}/blue-server-generated.zip`)
|
||||
.should('exist');
|
||||
});
|
||||
|
||||
it('should download a generated OpenAPI 3.0 Client file', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 3.0 Petstore').trigger('mousemove').click();
|
||||
cy.contains('Generate Client').should('be.visible').click();
|
||||
cy.contains('apple') // mocked response value
|
||||
.should('be.visible')
|
||||
.trigger('mousemove')
|
||||
.click()
|
||||
.wait('@externalGeneratorOas3Download')
|
||||
.readFile(`${downloadsFolder}/apple-client-generated.zip`)
|
||||
.should('exist');
|
||||
});
|
||||
|
||||
it('should download a generated OpenAPI 2.0 Server file', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 2.0 Petstore').trigger('mousemove').click();
|
||||
cy.contains('Generate Server').should('be.visible').click();
|
||||
cy.contains('blue') // mocked response value
|
||||
.should('be.visible')
|
||||
.trigger('mousemove')
|
||||
.click()
|
||||
.wait('@externalGeneratorServersOAS2reqDownloadUrl')
|
||||
.wait('@externalGeneratorOas2Download')
|
||||
.readFile(`${downloadsFolder}/blue-server-generated.zip`)
|
||||
.should('exist');
|
||||
});
|
||||
|
||||
it('should download a generated OpenAPI 2.0 Client file', () => {
|
||||
cy.contains('File').click();
|
||||
cy.contains('Load Example').trigger('mouseover');
|
||||
cy.contains('OpenAPI 2.0 Petstore').trigger('mousemove').click();
|
||||
cy.contains('Generate Client').should('be.visible').click();
|
||||
cy.contains('apple') // mocked response value
|
||||
.should('be.visible')
|
||||
.trigger('mousemove')
|
||||
.click()
|
||||
.wait('@externalGeneratorClientsOAS2reqDownloadUrl')
|
||||
.wait('@externalGeneratorOas2Download')
|
||||
.readFile(`${downloadsFolder}/apple-client-generated.zip`)
|
||||
.should('exist');
|
||||
});
|
||||
});
|
||||
|
||||
describe('About Drop Menu', () => {
|
||||
it('should have expect menu items', () => {
|
||||
cy.contains('About').click(); // About Menu
|
||||
cy.contains('About Swagger Editor').should('exist');
|
||||
cy.contains('View Docs').should('exist');
|
||||
cy.contains('View on GitHub').should('exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,60 @@
|
||||
describe('Monaco Editor with Validation Pane', () => {
|
||||
beforeEach(() => {
|
||||
cy.visitBlankPage();
|
||||
cy.prepareAsyncAPI();
|
||||
cy.prepareOasGenerator();
|
||||
cy.waitForSplashScreen();
|
||||
|
||||
// move down to line 2, column 3
|
||||
const moveToPosition = `{downArrow}{rightArrow}{rightArrow}`;
|
||||
// introduce a typo error
|
||||
cy.get('.monaco-editor textarea:first', { timeout: 10000 })
|
||||
.should('be.visible')
|
||||
.click({ force: true })
|
||||
.focused()
|
||||
.type(`${moveToPosition}Q`);
|
||||
cy.waitForContentPropagation();
|
||||
});
|
||||
|
||||
/**
|
||||
* note: future UX may make the table header <thead> always visible,
|
||||
* or existing but collapsed
|
||||
* expect table body <tbody> to always not exist if there are no errors
|
||||
* make appropriate changes if/when needed
|
||||
*/
|
||||
it('should display visible Validation Pane table header and table body when error exists', () => {
|
||||
cy.get('.swagger-editor__validation-table')
|
||||
.should('exist')
|
||||
.get('.swagger-editor__validation-table > thead')
|
||||
.should('be.visible')
|
||||
.get('.swagger-editor__validation-table > tbody')
|
||||
.should('be.visible');
|
||||
// some additional assertions just to make sure
|
||||
cy.get('.swagger-editor__validation-table > thead > tr > :nth-child(1)')
|
||||
.contains('line', { matchCase: false })
|
||||
.should('be.visible');
|
||||
cy.get('.swagger-editor__validation-table > thead > tr > :nth-child(2)')
|
||||
.contains('description', { matchCase: false })
|
||||
.should('be.visible');
|
||||
// reflects line number from moveToPosition for validation error
|
||||
cy.get('.swagger-editor__validation-table > tbody > :nth-child(1) > :nth-child(1) > div')
|
||||
.contains('2')
|
||||
.should('be.visible');
|
||||
// validation error message is parser specific
|
||||
cy.get('.swagger-editor__validation-table > tbody > :nth-child(1) > :nth-child(2) > div')
|
||||
.contains('should NOT have')
|
||||
.should('be.visible');
|
||||
});
|
||||
|
||||
it('should not display Validation Pane after error is cleared', () => {
|
||||
// fix the typo error
|
||||
cy.get('.monaco-editor textarea:first', { timeout: 10000 })
|
||||
.should('be.visible')
|
||||
.click({ force: true })
|
||||
.focused()
|
||||
.type(`{backspace}`);
|
||||
// re-assert
|
||||
cy.get('.swagger-editor__validation-table > thead').should('not.exist');
|
||||
cy.get('.swagger-editor__validation-table > tbody').should('not.exist');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable no-unused-vars */
|
||||
// ***********************************************************
|
||||
// This example plugins/index.js can be used to load plugins
|
||||
//
|
||||
// You can change the location of this file or turn off loading
|
||||
// the plugins file with the 'pluginsFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/plugins-guide
|
||||
// ***********************************************************
|
||||
|
||||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
|
||||
const setupNodeEvents = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
|
||||
// log (with colors) to internal Cypress process, including headless mode
|
||||
on(`task`, {
|
||||
error(message) {
|
||||
console.error('\x1b[31m', 'ERROR:', message, '\x1b[0m');
|
||||
return null;
|
||||
},
|
||||
warn(message) {
|
||||
// default: disabling warnings to reduce ci pollution
|
||||
// console.warn('\x1b[33m', 'WARNING:', message, '\x1b[0m');
|
||||
return null;
|
||||
},
|
||||
uncaught(message) {
|
||||
console.error('\x1b[31m', 'ERROR: Uncaught Exception', message, '\x1b[0m');
|
||||
return null;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export default setupNodeEvents;
|
||||
@@ -0,0 +1,150 @@
|
||||
// ***********************************************
|
||||
// This example commands.js shows you how to
|
||||
// create various custom commands and overwrite
|
||||
// existing commands.
|
||||
//
|
||||
// For more comprehensive examples of custom
|
||||
// commands please read more here:
|
||||
// https://on.cypress.io/custom-commands
|
||||
// ***********************************************
|
||||
//
|
||||
//
|
||||
// -- This is a parent command --
|
||||
// Cypress.Commands.add("login", (email, password) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a child command --
|
||||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a dual command --
|
||||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
||||
|
||||
import '@testing-library/cypress/add-commands.js';
|
||||
import 'cypress-file-upload';
|
||||
|
||||
/**
|
||||
* This is related to `react-resize-detector` library usage.
|
||||
* For more information why this is here follow this link:
|
||||
* https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded
|
||||
*/
|
||||
Cypress.on(
|
||||
'uncaught:exception',
|
||||
(err) => !err.message.includes('ResizeObserver loop limit exceeded')
|
||||
);
|
||||
|
||||
Cypress.on('window:before:load', (win) => {
|
||||
cy.stub(win.console, 'error', (msg) => {
|
||||
cy.now('task', 'error', msg);
|
||||
});
|
||||
|
||||
cy.stub(win.console, 'warn', (msg) => {
|
||||
cy.now('task', 'warn', msg);
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.on('uncaught:exception', (err) => {
|
||||
cy.now('task', 'uncaught', err);
|
||||
return true; // true = fail the test
|
||||
});
|
||||
|
||||
Cypress.Commands.add('prepareAsyncAPI', () => {
|
||||
cy.intercept(
|
||||
'GET',
|
||||
'https://raw.githubusercontent.com/asyncapi/spec/v2.5.0/examples/streetlights-kafka.yml',
|
||||
{
|
||||
fixture: 'streetlights-kafka.yml',
|
||||
}
|
||||
).as('streetlightsKafka');
|
||||
|
||||
cy.visit('/');
|
||||
cy.wait('@streetlightsKafka');
|
||||
});
|
||||
|
||||
Cypress.Commands.add('prepareOpenAPI30x', () => {
|
||||
cy.intercept('GET', 'https://petstore3.swagger.io/api/v3/openapi.json', {
|
||||
fixture: 'petstore-oas3.yaml',
|
||||
}).as('externalPetstore');
|
||||
|
||||
cy.visit('/');
|
||||
cy.wait(['@externalPetstore']);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('prepareOasGenerator', () => {
|
||||
const staticResponse = {
|
||||
servers: ['blue', 'brown'],
|
||||
clients: ['apple', 'avocado'],
|
||||
};
|
||||
const staticFixture = {
|
||||
fixture: 'rejected.file.1', // picking a minimal file, doesn't matter what it is
|
||||
};
|
||||
const staticOas2resDownloadUrl = {
|
||||
link: 'https://generator.swagger.io/api/gen/download/mocked-hash',
|
||||
};
|
||||
|
||||
cy.intercept('GET', 'https://generator3.swagger.io/api/servers', staticResponse.servers).as(
|
||||
'externalGeneratorServersOas3reqList'
|
||||
);
|
||||
cy.intercept('GET', 'https://generator3.swagger.io/api/clients', staticResponse.clients).as(
|
||||
'externalGeneratorClientsOas3reqList'
|
||||
);
|
||||
// OAS3 server and client generators uses same URI
|
||||
cy.intercept('POST', 'https://generator3.swagger.io/api/generate', staticFixture).as(
|
||||
'externalGeneratorOas3Download'
|
||||
);
|
||||
|
||||
cy.intercept('GET', 'https://generator.swagger.io/api/gen/servers', staticResponse.servers).as(
|
||||
'externalGeneratorServersOAS2reqList'
|
||||
);
|
||||
cy.intercept('GET', 'https://generator.swagger.io/api/gen/clients', staticResponse.clients).as(
|
||||
'externalGeneratorClientsOAS2reqList'
|
||||
);
|
||||
cy.intercept(
|
||||
'POST',
|
||||
'https://generator.swagger.io/api/gen/servers/*',
|
||||
staticOas2resDownloadUrl
|
||||
).as('externalGeneratorServersOAS2reqDownloadUrl');
|
||||
cy.intercept(
|
||||
'POST',
|
||||
'https://generator.swagger.io/api/gen/clients/*',
|
||||
staticOas2resDownloadUrl
|
||||
).as('externalGeneratorClientsOAS2reqDownloadUrl');
|
||||
// OAS2 server and client generators uses same base URI, but all requests have an appended hash
|
||||
cy.intercept(
|
||||
'GET',
|
||||
'https://generator.swagger.io/api/gen/download/mocked-hash',
|
||||
staticFixture
|
||||
).as('externalGeneratorOas2Download');
|
||||
|
||||
// always return same OAS3 fixture. not testing the actual http service to convert
|
||||
cy.intercept('POST', 'https://converter.swagger.io/api/convert', {
|
||||
fixture: 'petstore-oas3.yaml',
|
||||
}).as('externalConverterToOas3');
|
||||
});
|
||||
|
||||
Cypress.Commands.add('clearDownloadsFolder', () => {
|
||||
cy.exec('rm cypress/downloads/*', { log: true, failOnNonZeroExit: false });
|
||||
});
|
||||
|
||||
Cypress.Commands.add('waitForSplashScreen', () => {
|
||||
cy.get('.swagger-editor__splash-screen', { timeout: 10000 }).should('not.be.visible');
|
||||
});
|
||||
|
||||
Cypress.Commands.add('waitForContentPropagation', () => {
|
||||
/**
|
||||
* Content is propagated to application after 500ms debouncing.
|
||||
*/
|
||||
// eslint-disable-next-line testing-library/await-async-utils,cypress/no-unnecessary-waiting
|
||||
cy.wait(600);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('visitBlankPage', () => {
|
||||
cy.window().then((win) => {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
win.location.href = 'about:blank';
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands.js';
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
@@ -0,0 +1,11 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
// https://medium.com/hired-engineering/setting-up-monaco-with-jest-e1e4c963ac
|
||||
import 'jest-canvas-mock';
|
||||
|
||||
document.queryCommandSupported = () => false;
|
||||
Reference in New Issue
Block a user