refactored code/tests around download tests
This commit is contained in:
parent
6fdb5f4f9f
commit
6cc374865e
|
@ -142,7 +142,7 @@ function archiveDetails(translate, archive) {
|
||||||
module.exports = function(state, emit, archive) {
|
module.exports = function(state, emit, archive) {
|
||||||
return html`
|
return html`
|
||||||
<article
|
<article
|
||||||
id="${archive.id}"
|
id="archive-${archive.id}"
|
||||||
class="flex flex-col items-start border border-grey-light bg-white p-4 w-full">
|
class="flex flex-col items-start border border-grey-light bg-white p-4 w-full">
|
||||||
<p class="w-full">
|
<p class="w-full">
|
||||||
<img class="float-left mr-3" src="${assets.get('blue_file.svg')}"/>
|
<img class="float-left mr-3" src="${assets.get('blue_file.svg')}"/>
|
||||||
|
|
|
@ -43,7 +43,7 @@ module.exports = function(state, emit) {
|
||||||
state.downloadCount = value;
|
state.downloadCount = value;
|
||||||
emit('render');
|
emit('render');
|
||||||
},
|
},
|
||||||
'expire-after-dl-count-dropdown'
|
'expire-after-dl-count-select'
|
||||||
),
|
),
|
||||||
dlCountSelect
|
dlCountSelect
|
||||||
);
|
);
|
||||||
|
@ -70,7 +70,7 @@ module.exports = function(state, emit) {
|
||||||
state.timeLimit = value;
|
state.timeLimit = value;
|
||||||
emit('render');
|
emit('render');
|
||||||
},
|
},
|
||||||
'expire-after-time-dropdown'
|
'expire-after-time-select'
|
||||||
),
|
),
|
||||||
timeSelect
|
timeSelect
|
||||||
);
|
);
|
||||||
|
|
|
@ -42,8 +42,8 @@ describe('Firefox Send', function() {
|
||||||
`${testFilesPath}/${testFiles[0]}`
|
`${testFilesPath}/${testFiles[0]}`
|
||||||
);
|
);
|
||||||
browser.waitForExist(homePage.uploadButton);
|
browser.waitForExist(homePage.uploadButton);
|
||||||
browser.waitForExist(homePage.downloadCountDropdown);
|
browser.waitForExist(homePage.downloadCountSelect);
|
||||||
browser.selectByIndex(homePage.downloadCountDropdown, 1);
|
browser.selectByIndex(homePage.downloadCountSelect, 1);
|
||||||
browser.click(homePage.uploadButton);
|
browser.click(homePage.uploadButton);
|
||||||
browser.waitForExist(homePage.shareUrl);
|
browser.waitForExist(homePage.shareUrl);
|
||||||
const downloadPage = new DownloadPage(browser.getValue(homePage.shareUrl));
|
const downloadPage = new DownloadPage(browser.getValue(homePage.shareUrl));
|
||||||
|
@ -51,9 +51,9 @@ describe('Firefox Send', function() {
|
||||||
downloadPage.download();
|
downloadPage.download();
|
||||||
browser.waitForExist(downloadPage.downloadComplete);
|
browser.waitForExist(downloadPage.downloadComplete);
|
||||||
browser.back();
|
browser.back();
|
||||||
browser.waitForExist(homePage.expiresAfterText);
|
browser.waitForExist(`#archive-${downloadPage.fileId}`);
|
||||||
assert.ok(
|
assert.equal(
|
||||||
browser.getText(homePage.expiresAfterText).substring(0, 24) ===
|
browser.getText(`#archive-${downloadPage.fileId} > div`).substring(0, 24),
|
||||||
expectedExpiresAfterText
|
expectedExpiresAfterText
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,6 +4,7 @@ const Page = require('./page');
|
||||||
class DownloadPage extends Page {
|
class DownloadPage extends Page {
|
||||||
constructor(path) {
|
constructor(path) {
|
||||||
super(path);
|
super(path);
|
||||||
|
this.fileId = /download\/(\w+)\/#/.exec(path)[1];
|
||||||
this.downloadButton = '#download-btn';
|
this.downloadButton = '#download-btn';
|
||||||
this.downloadComplete = '#download-complete';
|
this.downloadComplete = '#download-complete';
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,7 @@ class HomePage extends Page {
|
||||||
this.uploadButton = '#upload-btn';
|
this.uploadButton = '#upload-btn';
|
||||||
this.progress = 'progress';
|
this.progress = 'progress';
|
||||||
this.shareUrl = '#share-url';
|
this.shareUrl = '#share-url';
|
||||||
this.downloadCountDropdown = '#expire-after-dl-count-dropdown';
|
this.downloadCountSelect = '#expire-after-dl-count-select';
|
||||||
this.expiresAfterText = '.text-xs.text-grey-dark.w-full.mt-2.mb-2';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForPageToLoad() {
|
waitForPageToLoad() {
|
||||||
|
|
Loading…
Reference in New Issue