[Integration-Test] Add test for number of downloads, fixes #810

This commit is contained in:
Dhyey Thakore 2019-01-09 19:32:11 +05:30
parent 1bb1e8123f
commit e9a9ead762
4 changed files with 31 additions and 3 deletions

View File

@ -42,7 +42,8 @@ module.exports = function(state, emit) {
}
state.downloadCount = value;
emit('render');
}
},
'expire-after-dl-count-dropdown'
),
dlCountSelect
);
@ -68,7 +69,8 @@ module.exports = function(state, emit) {
}
state.timeLimit = value;
emit('render');
}
},
'expire-after-time-dropdown'
),
timeSelect
);

View File

@ -1,10 +1,11 @@
const html = require('choo/html');
module.exports = function(selected, options, translate, changed) {
module.exports = function(selected, options, translate, changed, htmlId) {
let x = selected;
return html`
<select
id="${htmlId}"
class="appearance-none cursor-pointer border rounded-sm bg-blue-lightest hover:border-blue focus:border-blue px-2 py-1 my-2 h-8"
onchange="${choose}"
>

View File

@ -34,4 +34,27 @@ describe('Firefox Send', function() {
assert.ok(fs.existsSync(path.join(downloadDir, file)));
});
});
it('should update the download count on home page after 1 download', function() {
const expectedExpiresAfterText = 'Expires after 1 download';
browser.chooseFile(
homePage.uploadInput,
`${testFilesPath}/${testFiles[0]}`
);
browser.waitForExist(homePage.uploadButton);
browser.waitForExist(homePage.downloadCountDropdown);
browser.selectByIndex(homePage.downloadCountDropdown, 1);
browser.click(homePage.uploadButton);
browser.waitForExist(homePage.shareUrl);
const downloadPage = new DownloadPage(browser.getValue(homePage.shareUrl));
downloadPage.open();
downloadPage.download();
browser.waitForExist(downloadPage.downloadComplete);
browser.back();
browser.waitForExist(homePage.expiresAfterText);
assert.ok(
browser.getText(homePage.expiresAfterText).substring(0, 24) ===
expectedExpiresAfterText
);
});
});

View File

@ -9,6 +9,8 @@ class HomePage extends Page {
this.uploadButton = '#upload-btn';
this.progress = 'progress';
this.shareUrl = '#share-url';
this.downloadCountDropdown = '#expire-after-dl-count-dropdown';
this.expiresAfterText = '.text-xs.text-grey-dark.w-full.mt-2.mb-2';
}
waitForPageToLoad() {