Browse Source

Switch from console.log strings to progressbar test in DragDrop

Artur Paikin 9 years ago
parent
commit
cee0b16668
1 changed files with 13 additions and 3 deletions
  1. 13 3
      test/acceptance/dragdrop.spec.js

+ 13 - 3
test/acceptance/dragdrop.spec.js

@@ -20,10 +20,20 @@ test('dragdrop: make sure DragDrop accepts and uploads 1 file via input', functi
   // Get console elements’s value, then check if it has “Download” there somewhere,
   // if it does, then test passes
   function isUploaded () {
-    return driver.findElement(By.id('console-log'))
-      .getAttribute('value')
+    // return driver.findElement(By.id('console-log'))
+    //   .getAttribute('value')
+    //   .then(function (value) {
+    //     var isFileUploaded = value.indexOf('Download image.jpg') !== -1
+    //     return isFileUploaded
+    //   })
+
+    // .getText() only work on visible elements, so we use .getAttribute('textContent'), go figure
+    // http://stackoverflow.com/questions/21994261/gettext-not-working-on-a-select-from-dropdown
+    return driver.findElement(By.css('.UppyDragDrop-One-Progress .UppyProgressBar-percentage'))
+      .getAttribute('textContent')
       .then(function (value) {
-        var isFileUploaded = value.indexOf('Download image.jpg') !== -1
+        var progress = parseInt(value)
+        var isFileUploaded = progress === 100
         return isFileUploaded
       })
   }