From 65fd06e4746117e77c5714c39b305771e22606c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 13 Jun 2023 21:06:39 +0200 Subject: [PATCH] test(api): Try different approach of chaining api calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- cypress/e2e/api/UsersApi.spec.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/cypress/e2e/api/UsersApi.spec.js b/cypress/e2e/api/UsersApi.spec.js index 141776f0e77..2e3d72287ea 100644 --- a/cypress/e2e/api/UsersApi.spec.js +++ b/cypress/e2e/api/UsersApi.spec.js @@ -55,6 +55,7 @@ describe('The user mention API', function() { cy.wrap(connection) .its('document.id') .should('equal', fileId) + const requestData = { method: 'POST', url: '/apps/text/api/v1/users', @@ -66,43 +67,39 @@ describe('The user mention API', function() { }, failOnStatusCode: false, } + const invalidRequestData = { ...requestData } cy.request(requestData).then(({ status }) => { expect(status).to.eq(200) - }) - const invalidRequestData = { ...requestData } - cy.wrap(() => { invalidRequestData.body = { ...requestData.body, sessionToken: 'invalid', } }) + cy.request(invalidRequestData).then(({ status }) => { expect(status).to.eq(403) - }) - - cy.wrap(() => { invalidRequestData.body = { ...requestData.body, sessionId: 0, } }) + cy.request(invalidRequestData).then(({ status }) => { expect(status).to.eq(403) - }) - cy.wrap(() => { invalidRequestData.body = { ...requestData.body, documentId: 0, } }) + cy.request(invalidRequestData).then(({ status }) => { expect(status).to.eq(403) }) - cy.wrap(connection.close()) + cy.wrap(null).then(() => connection.close()) cy.request(requestData).then(({ status, body }) => { expect(status).to.eq(403)