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) { 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')}"/>

View File

@ -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
); );

View File

@ -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,10 +51,10 @@ 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
); );
}); });
}); });

View File

@ -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';
} }

View File

@ -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() {