Skip to content

Commit

Permalink
Use cypress select file
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Jun 24, 2023
1 parent cf96c47 commit c9f2c46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions cypress/e2e/attachments.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/

import { initUserAndFiles, randHash, randUser } from '../utils/index.js'
import 'cypress-file-upload'

const user = randUser()
const recipient = randUser()
Expand All @@ -41,7 +40,12 @@ function attachFile(name, requestAlias = null) {
}
return cy.getEditor()
.find('input[type="file"][data-text-el="attachment-file-input"]')
.attachFile(name)
.selectFile([
{
contents: 'cypress/fixtures/' + name,
fileName: name,
},
], { force: true })
}

/**
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ Cypress.Commands.add('uploadFile', (fileName, mimeType, target) => {
headers: {
requesttoken,
'Content-Type': mimeType,
}
});
},
})
}).then(response => {
const fileId = Number(
response.headers['oc-fileid']?.split('oc')?.[0]
Expand Down

0 comments on commit c9f2c46

Please sign in to comment.