I am trying to confirm the file downloaded from an api. After reviewing the recommendation from How to test download api using karate, my scenario was written like below:
Scenario: GET /project - Export project listing
Given params { someparam: 'paramvalue' }
When method GET
Then status 200
And match header Content-Disposition == 'attachment;filename="someFile.xlsx"'
And match header Content-Type == 'application/vnd.ms-excel'
And match response == read('data/exported.xlsx')
The first 2 matches pass. However, the last match (comparing the actual file) fails with a binary printout of both files and "reason: not equal".
The file "exported.xlsx" in the comparison was the output of the exact same request done via Postman, so they should match.
Is read() able to handle excel and csv files? Any help would be appreciated.