Best way to test file download

What’s the best way to test file downloading with Vaadin Testbench?

We have two file downloads that we would like to test. In both cases the user clicks on a button and the file is downloaded in a popup browser window (using _blank). The files are generated on the fly in both cases.

  1. Copied using SFTP locally
  2. PDF or XLS created locally

I’ve tried using Selenium and Vaadin Testbench. I can trigger the download in both cases.

In the first case (SFTP), the PDF is displayed in the browser (Firefox). And I can switch windows and detect the something is displayed and it’s likely working. However this is browser specific behaviour and not a reliable test.

In the second case, a save/open option is displayed and I can’t interact so I don’t have any way of testing that the download works.

I have looked into other options, i.e. checking if the link works (
http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/
), but Vaadin hides the request so I’m not sure how to recreate it.

Thanks,

Eric