meta: introduce Cypress end-to-end testing (via #4827)

* `test/e2e` -> `test/e2e-selenium`

* add Cypress

* ESLint fixes

* MOAR cypress

* `integration` -> `tests`

* wire Cypress up to a hot e2e server

* linter fixes

* don't run in CI
This commit is contained in:
kyle
2018-08-23 15:10:00 -07:00
committed by GitHub
parent b2c4c4e7e7
commit 1b2fbda646
64 changed files with 4499 additions and 3842 deletions

View File

@@ -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 functionnal 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'

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,5 @@
---
swagger: '2.0'
paths:
"/v1/book":
"$ref": "./book.yaml"

View File

@@ -0,0 +1,9 @@
swagger: '2.0'
info:
version: 0.0.0
title: test
paths: {}
definitions:
ModelName:
title: TitleName

View File

@@ -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

View File

@@ -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}

View File

@@ -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