From 0012dec277f3ff82959847b97bce56aba4da1287 Mon Sep 17 00:00:00 2001 From: marigalicer Date: Wed, 13 Mar 2019 16:03:44 -0400 Subject: [PATCH] [Integration-Test] Add test to ensure that file size stays consistent fixes #1130 --- test/integration/download-tests.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/integration/download-tests.js b/test/integration/download-tests.js index b1d8aab9..f31c4b18 100644 --- a/test/integration/download-tests.js +++ b/test/integration/download-tests.js @@ -56,4 +56,29 @@ describe('Firefox Send', function() { 'Expires after 1 download' ); }); + + it('should ensure that the downloaded file size matches the uploaded file size', function() { + browser.chooseFile( + homePage.uploadInput, + `${testFilesPath}/${testFiles[0]}` + ); + // get the file size for upload + const uploadSize = fs.statSync(`${testFilesPath}/${testFiles[0]}`).size; + + browser.waitForExist(homePage.uploadButton); + browser.click(homePage.uploadButton); + + browser.waitForExist(homePage.shareUrl); + const downloadPage = new DownloadPage(browser.getValue(homePage.shareUrl)); + downloadPage.open(); + downloadPage.download(); + browser.waitForExist(downloadPage.downloadComplete); + + // get the file size for download + const downloadFile = path.join(downloadDir, `${testFiles[0]}`); + const downloadSize = fs.statSync(downloadFile).size; + + // check if upload and download file sizes are equal + assert.equal(uploadSize, downloadSize); + }); });