I want to save a XML file from the server to local for later check. Because TestCafe do not allow out of box the download of files I did some research and found:
import fs from 'fs';
const downloadLocation = './downloads/saved.xml'; //downloadlocation on macOS
const fileDLUrlBase = 'https://example.com/downloads/xml/mytest'; //dynamic generated xml
fixture('download test fixture');
test('download test', async t => {
await t.navigateTo(fileDLUrlBase);
await t.wait(30000);
// Wait 30 seconds
await t.expect(fs.fileExistsSync(downloadLocation));
});
I have read many comments and posts here on stack overflow but I am really confused. ALL, really ALL solution, marked s solution, do not work here.
As sample: Testcafe example to assert file download
I clone this fixture but TestCafe will crash. But this question is marked as solved. In my eyes, NO solution about download a file is working and this confuse me.
Can anybody help me out?
Aucun commentaire:
Enregistrer un commentaire