I am trying to upload a file without an input element with cypress-file-upload library, using .attachFile()
, and I haven't be able so far. I don't get any error it just doesn't upload the file. I have tried it in other part of my app with input element and it is working fine. Is there any other way of doing it? Or am I doing something wrong?
cy.get('.bp3-card .post-header-image').contains('Reply').click()
cy.get('.editor').find('[title="Attach File"]').click()
cy.contains('Upload Attachment').should('contain', 'Upload Attachment')
cy.get('.bp3-dialog-body > button').click()
.selectFile(
['cypress/fixtures/sipder.png'],{action: 'drag-drop', encoding: 'utf-8'}
)
cy.wait(3000)
const file_path = "sipder.png"
cy.get('.bp3-dialog > .bp3-dialog-body').find('button').attachFile(file_path);
cy.wait(3000)
Here is HTML. Basically, cypress allows type but here is a button, I'm trying to upload its upload file but it does not display the upload file's functionality in UI. You can see in the image below
Button Click