In this article, I will explain how to sanitize the ArrayBuffer response into the parsed JSON while debugging in Cypress.
This generally would happen when, you have custom commands for uploading file
In order to debug the error happening while development, we need to render the response of '@uploadFile' in a readable format. There are 2 ways how we can achieve that.
1) Using Cypress.Blob:
2) Using vanilla.js:
Once we have these methods we have to wrap our original command like below. In both the cases we need to pass on the cypress alias to these santizing functions and we retrieve the actual response and then convert them to Parsed JSON response before sending back to calling code.