Skip to content

Commit

Permalink
Move to cy request
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliushaertl committed Jun 23, 2023
1 parent bae9ac4 commit b7ee6cb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Check warning on line 75 in cypress/support/commands.js

View workflow job for this annotation

GitHub Actions / eslint

Missing trailing comma
});

Check failure on line 76 in cypress/support/commands.js

View workflow job for this annotation

GitHub Actions / eslint

Extra semicolon
}).then(response => {
const fileId = Number(
response.headers['oc-fileid']?.split('oc')?.[0]
Expand Down

0 comments on commit b7ee6cb

Please sign in to comment.