I followed this answer and it looks almost the thing I need.
The problem there is that he already knows the filename and I am doing e2e test for downloading a file, but