From b7ee6cb9f9cf34ec7c1824a2835aca5fbdffa986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 23 Jun 2023 20:50:39 +0200 Subject: [PATCH] Move to cy request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- cypress/support/commands.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 0c4f46fdfd8..303fada5532 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -62,17 +62,18 @@ Cypress.Commands.add('uploadFile', (fileName, mimeType, target) => { } cy.request('/csrftoken') .then(({ body }) => { - cy.wait(1000) return cy.wrap(body.token) }) .then(async (requesttoken) => { - const response = await axios.put(`${url}/remote.php/webdav/${fileName}`, file, { + return cy.request({ + url: `${url}/remote.php/webdav/${fileName}`, + method: 'put', + body: file, headers: { requesttoken, 'Content-Type': mimeType, - }, - }) - return cy.wrap(response) + } + }); }).then(response => { const fileId = Number( response.headers['oc-fileid']?.split('oc')?.[0]