Cypress fixes

This commit is contained in:
Jamie Curnow
2020-08-06 12:47:24 +10:00
parent 9ce4c3fe2f
commit bf2f13443f
9 changed files with 721 additions and 566 deletions

View File

@ -13,15 +13,16 @@
* Check the swagger schema:
*
* @param {string} method API Method in swagger doc, "get", "put", "post", "delete"
* @param {number} statusCode API status code in swagger doc
* @param {string} path Swagger doc endpoint path, exactly as defined in swagger doc
* @param {*} data The API response data to check against the swagger schema
*/
Cypress.Commands.add('validateSwaggerSchema', (method, path, data) => {
Cypress.Commands.add('validateSwaggerSchema', (method, statusCode, path, data) => {
cy.task('validateSwaggerSchema', {
file: Cypress.env('swaggerBase'),
endpoint: path,
method: method,
statusCode: 200,
statusCode: statusCode,
responseSchema: data,
verbose: true
}).should('equal', null);
@ -32,10 +33,10 @@ Cypress.Commands.add('getToken', () => {
cy.task('backendApiPost', {
path: '/api/tokens',
data: {
identity: "admin@example.com",
secret: "changeme"
identity: 'admin@example.com',
secret: 'changeme'
}
}).then(res => {
cy.wrap(res.result.token);
cy.wrap(res.token);
});
});