Cypress-file-upload: [Bug] [cypress-file-upload error]: "encoding" is not valid.

Created on 16 Jul 2019  路  4Comments  路  Source: abramenal/cypress-file-upload

Current behavior:

Running: cm/system/license.ts...                                   (34 of 54) 
  Estimated: 31 seconds


  System => License
    1) "before each" hook for "should display correctly"


  0 passing (57s)
  1 failing

  1) System => License "before each" hook for "should display correctly":
     [cypress-file-upload error]: "encoding" is not valid.
Please look into docs to find supported "encoding" values

Because this error occurred during a 'before each' hook we are skipping the remaining tests in the current suite: 'System => License'

Code that used to work

Cypress.Commands.add('uploadLicense', { prevSubject: true }, (subject, mode: AnalyticsMode, name: string, validUntil: Date, evaluation: boolean) => {
  if (!subject) {
    throw new Error('uploadLicense must be chained off your upload target!');
  }

  return cy.exec(
    `./node_modules/.bin/ts-node -T cypress/scripts/generate-license.ts "${mode}" "${name}" "${validUntil.toISOString()}" "${evaluation}"`,
    { env: Cypress.env() }
  ).then((result) => {
    cy.wrap(result, { log: false }).its('code').should('equal', 0);
    return cy.wrap(subject).upload(
      [{
        fileContent: btoa(result.stdout),
        fileName: 'license.lic',
        mimeType: 'text/plain',
        encoding: 'utf-8'
      }],
      {
        force: true,
        subjectType: 'drag-n-drop'
      });
  });
});

That targets an ng2-upload target in Angular.

Desired behavior:

To accept utf-8 again

Steps to reproduce: (app code and test code)

Versions

Cypress 3.4.0
Cypress File Upload 3.3.1

bug

Most helpful comment

Now it's fixed in v3.3.2

All 4 comments

Hi @philjones88
Thanks for submitting the issue! You're right, new version introduced more agressive validation and it seems I've missed some values from original Cypress' list.

@all-contributors add @philjones88 for bug

@abramenal

I've put up a pull request to add @philjones88! :tada:

Now it's fixed in v3.3.2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JaydenNavarro-at picture JaydenNavarro-at  路  5Comments

warpech picture warpech  路  4Comments

joehansen picture joehansen  路  3Comments

skjnldsv picture skjnldsv  路  5Comments

yonigibbs picture yonigibbs  路  5Comments