Browse Source

Fixup the tests

Girish Ramakrishnan 8 years ago
parent
commit
b95d960b05
1 changed files with 24 additions and 11 deletions
  1. 24 11
      test/test.js

+ 24 - 11
test/test.js

@@ -58,26 +58,34 @@ describe('Application life cycle test', function () {
     }
     }
 
 
     function checkMailPlugin(done) {
     function checkMailPlugin(done) {
-        browser.get('https://' + app.fqdn + '/admin/emailers/local');
-        browser.wait(until.elementLocated(by.id('host')), TEST_TIMEOUT).then(function () {
-            browser.findElement(by.id('host')).getAttribute('value').then(function (val) {
-                if (val !== 'mail') return done(new Error('Incorrect mail server value: ' + val));
-                done();
-            });
+        browser.get('https://' + app.fqdn + '/admin/emailers/local').then(function () {
+            return browser.wait(until.elementLocated(by.id('host')), TEST_TIMEOUT);
+        }).then(function () {
+            return browser.sleep(5000);
+        }).then(function () {
+            return browser.findElement(by.id('host')).getAttribute('value');
+        }).then(function (val) {
+            if (val !== 'mail') return done(new Error('Incorrect mail server value: ' + val));
+            done();
         });
         });
     }
     }
 
 
     function restartForum(done) {
     function restartForum(done) {
         browser.get('https://' + app.fqdn + '/admin').then(function () {
         browser.get('https://' + app.fqdn + '/admin').then(function () {
+            return browser.sleep(3000);
+        }).then(function () {
             return browser.findElement(by.xpath('//button[text()="Restart"]')).click();
             return browser.findElement(by.xpath('//button[text()="Restart"]')).click();
         }).then(function () {
         }).then(function () {
             return browser.sleep(3000);
             return browser.sleep(3000);
         }).then(function () {
         }).then(function () {
             return browser.findElement(by.xpath('//button[text()="Confirm"]')).click();
             return browser.findElement(by.xpath('//button[text()="Confirm"]')).click();
         }).then(function () {
         }).then(function () {
-            return browser.sleep(30000); // wait 30secs for reload
+            console.log('Waiting for forum to restart');
+            return browser.sleep(40000); // wait 30secs for reload
         }).then(function () {
         }).then(function () {
             return browser.get('https://' + app.fqdn + '/admin');
             return browser.get('https://' + app.fqdn + '/admin');
+        }).then(function () {
+            return browser.sleep(3000);
         }).then(function () {
         }).then(function () {
             return browser.findElement(by.xpath('//h1[text()="Dashboard"]'))
             return browser.findElement(by.xpath('//h1[text()="Dashboard"]'))
         }).then(function () { done(); });
         }).then(function () { done(); });
@@ -119,8 +127,12 @@ describe('Application life cycle test', function () {
                 return browser.findElement(by.xpath('//input[@type="file"]')).sendKeys(path.resolve(__dirname, '../logo.png'));
                 return browser.findElement(by.xpath('//input[@type="file"]')).sendKeys(path.resolve(__dirname, '../logo.png'));
             }).then(function () {
             }).then(function () {
                 browser.sleep(3000);
                 browser.sleep(3000);
-            }).then(function () {
+            }).then(function () { // upload it
                 return browser.findElement(by.id('fileUploadSubmitBtn')).click();
                 return browser.findElement(by.id('fileUploadSubmitBtn')).click();
+            }).then(function () {
+                browser.sleep(3000);
+            }).then(function () {
+                return browser.findElement(by.xpath('//button[text()="Crop and upload"]')).click();
             }).then(function () {
             }).then(function () {
                 browser.sleep(3000).then(function () { done(); });
                 browser.sleep(3000).then(function () { done(); });
             });
             });
@@ -129,9 +141,10 @@ describe('Application life cycle test', function () {
 
 
     function checkImage(done) {
     function checkImage(done) {
         browser.get('https://' + app.fqdn + '/user/admin');
         browser.get('https://' + app.fqdn + '/user/admin');
-        browser.wait(until.elementLocated(by.xpath('//img[@src="/uploads/profile/1-profileimg.png"]')), TEST_TIMEOUT);
-        var img = browser.findElement(by.xpath('//img[@src="/uploads/profile/1-profileimg.png"]'));
-        browser.executeScript('return arguments[0].complete && arguments[0].naturalWidth', img).then(function (imageWidth) {
+        browser.wait(until.elementLocated(by.xpath('//img[@src="/assets/uploads/profile/1-profileavatar.png"]')), TEST_TIMEOUT).then(function () {
+            var img = browser.findElement(by.xpath('//img[@src="/assets/uploads/profile/1-profileavatar.png"]'));
+            return browser.executeScript('return arguments[0].complete && arguments[0].naturalWidth', img);
+        }).then(function (imageWidth) {
             done(imageWidth === 128 ? null : new Error('failed to load image'));
             done(imageWidth === 128 ? null : new Error('failed to load image'));
         });
         });
     }
     }