So I tried to use cypress-autorecord in one of the project I am working on and faced an issue with XHR responses which content-types are different from application/json. If the XHR response data is oversized (isFileOversized) then it is being written to fixtures/.json and on the next run of tests when they are trying to get data from those mock fixtures the JSON validation error is being thrown.
My solution:
IF content-type == 'application/json'
THEN
IF isFileOversized
THEN
writeDataToFixture('<fixture-name>.json')
ELSE
writeDataToMock('<test-name>.spec.json')
ELSE
writeDataToFixture('<fixture-name>.<fixture-extantion>')
Currently it handles only text/html and application/json content types. For all other types it adds '.odt' extension.
So I tried to use cypress-autorecord in one of the project I am working on and faced an issue with XHR responses which content-types are different from application/json. If the XHR response data is oversized (.json and on the next run of tests when they are trying to get data from those mock fixtures the JSON validation error is being thrown.
isFileOversized
) then it is being written to fixtures/My solution:
Currently it handles only text/html and application/json content types. For all other types it adds '.odt' extension.