I seen this occasionally on random tests, though I'm not sure how this could happen. Maybe the individual requests are not properly waited for so it is a timing issue?
Happens on PUT/MKCOL, after CSRF token should already have been obtained.
|
// Init user |
|
cy.createUser(user) |
|
cy.login(user) |
|
|
|
// Upload test files |
|
;(files || []).forEach(file => { |
|
cy.uploadFile(file, 'text/markdown') |
|
}) |
|
return cy.fixture(fileName, 'base64') |
|
.then(Cypress.Blob.base64StringToBlob) |
|
.then(blob => { |
|
const file = new File([blob], fileName, { type: mimeType }) |
|
if (typeof target !== 'undefined') { |
|
fileName = target |
|
} |
|
return cy.request('/csrftoken') |
|
.then(({ body }) => body.token) |
|
.then(requesttoken => { |
|
return axios.put(`${url}/remote.php/webdav/${fileName}`, file, { |
|
headers: { |
|
requesttoken, |
|
'Content-Type': mimeType, |
|
}, |
|
}).then(response => { |
|
const fileId = Number( |
|
response.headers['oc-fileid']?.split('oc')?.[0] |
|
) |
|
cy.log(`Uploaded ${fileName}`, |
|
response.status, |
|
{ fileId } |
|
) |
|
return fileId |
|
}) |
|
}) |
|
}) |
|
const rootPath = `${Cypress.env('baseUrl')}/remote.php/dav/files/${encodeURIComponent(auth.user)}` |
|
const dirPath = target.split('/').map(encodeURIComponent).join('/') |
|
|
|
return cy.request('/csrftoken') |
|
.then(({ body }) => body.token) |
|
.then(requesttoken => { |
|
return axios.request(`${rootPath}/${dirPath}`, { |
|
method: 'MKCOL', |
|
auth, |
|
headers: { |
|
requesttoken, |
|
}, |
|
}) |
|
}) |
I seen this occasionally on random tests, though I'm not sure how this could happen. Maybe the individual requests are not properly waited for so it is a timing issue?
Happens on PUT/MKCOL, after CSRF token should already have been obtained.
text/cypress/utils/index.js
Lines 43 to 50 in f86939b
text/cypress/support/commands.js
Lines 56 to 82 in e9f54d0
text/cypress/support/commands.js
Lines 209 to 222 in e9f54d0