refactored code/tests around download tests

This commit is contained in:
Danny Coates 2019-01-09 17:25:43 -08:00
parent 6fdb5f4f9f
commit 6cc374865e
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
5 changed files with 11 additions and 11 deletions

View File

@ -142,7 +142,7 @@ function archiveDetails(translate, archive) {
module.exports = function(state, emit, archive) {
return html`
<article
id="${archive.id}"
id="archive-${archive.id}"
class="flex flex-col items-start border border-grey-light bg-white p-4 w-full">
<p class="w-full">
<img class="float-left mr-3" src="${assets.get('blue_file.svg')}"/>

View File

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

View File

@ -42,8 +42,8 @@ describe('Firefox Send', function() {
`${testFilesPath}/${testFiles[0]}`
);
browser.waitForExist(homePage.uploadButton);
browser.waitForExist(homePage.downloadCountDropdown);
browser.selectByIndex(homePage.downloadCountDropdown, 1);
browser.waitForExist(homePage.downloadCountSelect);
browser.selectByIndex(homePage.downloadCountSelect, 1);
browser.click(homePage.uploadButton);
browser.waitForExist(homePage.shareUrl);
const downloadPage = new DownloadPage(browser.getValue(homePage.shareUrl));
@ -51,9 +51,9 @@ describe('Firefox Send', function() {
downloadPage.download();
browser.waitForExist(downloadPage.downloadComplete);
browser.back();
browser.waitForExist(homePage.expiresAfterText);
assert.ok(
browser.getText(homePage.expiresAfterText).substring(0, 24) ===
browser.waitForExist(`#archive-${downloadPage.fileId}`);
assert.equal(
browser.getText(`#archive-${downloadPage.fileId} > div`).substring(0, 24),
expectedExpiresAfterText
);
});

View File

@ -4,6 +4,7 @@ const Page = require('./page');
class DownloadPage extends Page {
constructor(path) {
super(path);
this.fileId = /download\/(\w+)\/#/.exec(path)[1];
this.downloadButton = '#download-btn';
this.downloadComplete = '#download-complete';
}

View File

@ -9,8 +9,7 @@ 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';
this.downloadCountSelect = '#expire-after-dl-count-select';
}
waitForPageToLoad() {