Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
packages/driver/cypress/integration/util/breaking_change_warnings_spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
describe('blob-util 2.x', () => { | ||
it('arrayBufferToBlob', () => { | ||
cy.on('fail', (err) => { | ||
expect(err.message).to.include('Cypress 5+ uses `blob-util` 2.x') | ||
}) | ||
|
||
Cypress.Blob.arrayBufferToBlob('1234').then((blob) => { | ||
// it should fail. | ||
}) | ||
}) | ||
|
||
it('base64StringToBlob', () => { | ||
cy.on('fail', (err) => { | ||
expect(err.message).to.include('Cypress 5+ uses `blob-util` 2.x') | ||
}) | ||
|
||
Cypress.Blob.base64StringToBlob('1234').then((blob) => { | ||
// it should fail. | ||
}) | ||
}) | ||
|
||
it('binaryStringToBlob', () => { | ||
cy.on('fail', (err) => { | ||
expect(err.message).to.include('Cypress 5+ uses `blob-util` 2.x') | ||
}) | ||
|
||
Cypress.Blob.binaryStringToBlob('0100101').then((blob) => { | ||
// it should fail. | ||
}) | ||
}) | ||
|
||
it('dataURLToBlob', () => { | ||
cy.on('fail', (err) => { | ||
expect(err.message).to.include('Cypress 5+ uses `blob-util` 2.x') | ||
}) | ||
|
||
Cypress.Blob.dataURLToBlob('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==').then((blob) => { | ||
// it should fail. | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import $errUtil from '../cypress/error_utils' | ||
|
||
export function wrapBlobUtil (blobUtil) { | ||
const breakingChanges = [ | ||
'arrayBufferToBlob', | ||
'base64StringToBlob', | ||
'binaryStringToBlob', | ||
'dataURLToBlob', | ||
] | ||
|
||
const obj = {} | ||
|
||
Object.keys(blobUtil).forEach((key) => { | ||
if (breakingChanges.includes(key)) { | ||
obj[key] = function (...args) { | ||
const val = blobUtil[key](...args) | ||
|
||
val.then = function () { | ||
$errUtil.throwErrByPath('breaking_change.blob_util2') | ||
} | ||
|
||
return val | ||
} | ||
} else { | ||
obj[key] = blobUtil[key] | ||
} | ||
}) | ||
|
||
return obj | ||
} |