Browse Source

refactored code/tests around download tests

Danny Coates 6 years ago
parent
commit
6cc374865e

+ 1 - 1
app/ui/archiveTile.js

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

+ 2 - 2
app/ui/expiryOptions.js

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

+ 6 - 6
test/integration/download-tests.js

@@ -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,10 +51,10 @@ 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) ===
-        expectedExpiresAfterText
+    browser.waitForExist(`#archive-${downloadPage.fileId}`);
+    assert.equal(
+      browser.getText(`#archive-${downloadPage.fileId} > div`).substring(0, 24),
+      expectedExpiresAfterText
     );
   });
 });

+ 1 - 0
test/integration/pages/desktop/download_page.js

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

+ 1 - 2
test/integration/pages/desktop/home_page.js

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