Anybody have idea how to test file download using cucumber?
For Chrome you can set the capability providing chrome options. Refer below code
String downloadFilepath = "path to specify download location e.g. C:\\Downloads";
Map chromePrefs = new HashMap();
chromePrefs.put("profile.default_content_settings.popups", 0);
chromePrefs.put("download.default_directory", downloadFilepath);
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", chromePrefs);
DesiredCapabilities cap = DesiredCapabilities.chrome();
cap.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(cap);
then you can use exists() method of java.io.File to make sure if file exists.
File file = new file(downloadFilepath+filename);
assert file.exists() : "File not downloaded";