cypress-file-upload icon indicating copy to clipboard operation
cypress-file-upload copied to clipboard

MimeType option question

Open JonathanDaflon opened this issue 3 years ago • 1 comments

Hi, I'm currently testing an application that can be configured to accept or deny some mimeTypes based on the customer settings. So I'm using this lib to upload files, and it has worked great, but I stumbled on this scenario where I want to set a different mimeType for an extension (example: 'file.pdf' with mimeType 'video/x-ms-wmv') to see if everything works fine.

Current Behavior: Setting a mimeType option doesn't alter the mimeType of the file (even if cypress says it does).

Sem título

Desired Behavior: Setting a mimeType option should change the file mimeType.

Question: Is this behavior intended? The mimeType option just describes the file type or it should change the type?

Steps to reproduce: obs: I'm using cucumber. The website visited tests the file to get its mimeType.

Given('test', () => {
    cy.visit('https://www.htmlstrip.com/mime-file-type-checker');
    cy.get('input#file')
    .attachFile({
        filePath: 'your_file.pdf',
        fileName: `some_name.mp4`,
        mimeType: 'video/x-ms-wmv',
        encoding: 'base64'
    })

    cy.get('button')
        .contains('Find File')
        .click()
})

JonathanDaflon avatar Jun 24 '21 19:06 JonathanDaflon

I have a simillar problem here, which makes my upload fail. The "Content-type" in the multipart/form-data for the file is not set and is just "null", not respecting the mimeType setting.

aldipower avatar Oct 10 '21 20:10 aldipower