赛普拉斯上传文件出现错误无法在“窗口”上执行“ atob”

时间:2020-05-28 09:49:55

标签: cypress

    cy.fixture('invitati100.xls').as('logo')
        cy.get('[name="fileLista"]').then(function($input) {
          // convert the logo base64 string to a blob
          return Cypress.Blob.base64StringToBlob(this.logo, 'application/vnd.ms-excel')
            .then((blob) => {
              // pass the blob to the fileupload jQuery plugin
              // used in your application's code
              // which initiates a programmatic upload
              $input.fileupload('add', { files: blob })
            })
    })

给出错误:

cypress_runner. : 159529 InvalidCharacterError: Failed to execute 'atob' on 'Window': The string to be decoded contains characters outside of the Latin1 range.
at http://platform/__cypress/runner/cypress_runner.js:1531:44
From previous event:
at Context.thenFn (http://platform/__cypress/runner/cypress_runner.js:69293:23)

我们正在使用dojo作为框架。 为什么会出现此错误?

谢谢!

1 个答案:

答案 0 :(得分:0)

只需使用此插件:

https://www.npmjs.com/package/cypress-file-upload

这非常容易并且有效!