Browse Source

tests semi-complete

Ubuntu 1 year ago
parent
commit
0f0b91929e
1 changed files with 45 additions and 45 deletions
  1. 45 45
      test/test.js

+ 45 - 45
test/test.js

@@ -125,9 +125,13 @@ describe('Application life cycle test', function () {
         }).then(function () {
             return browser.findElement(by.id('inputPassword')).submit();
         }).then(function () {
-            return browser.wait(function () {
-                return browser.findElement(by.xpath('//*[contains(text(), "' + username + '")]')).isDisplayed();
-            }, TEST_WAIT_TIME);
+
+
+            return visible(by.xpath('//*[contains(text(), "' + username + '")]'));
+
+            // return browser.wait(function () {
+            //     return browser.findElement(by.xpath('//*[contains(text(), "' + username + '")]')).isDisplayed();
+            // }, TEST_WAIT_TIME);
         }).then(function () {
             done();
         });
@@ -159,19 +163,10 @@ describe('Application life cycle test', function () {
     */
     function newQuery(done) {
         browser.get('https://' + app.fqdn + '/queries/new').then(function () {
-            return visible(by.xpath('/html/body/section/div/div/div[1]/div[1]/h3/edit-in-place'));
-        }).then(function () {
-            return browser.wait(function() {
-                browser.findElement(by.xpath('/html/body/section/div/div/div[1]/div[1]/h3/edit-in-place')).click();
-                return browser.findElement(by.xpath('/html/body/section/div/div/div[1]/div[1]/h3/edit-in-place')).clear();
-            }, TEST_WAIT_TIME);
+            return visible(by.partialLinkText('Save'));
         }).then(function () {
             return browser.wait(function() {
-                return browser.switchTo().activeElement().sendKeys("Test Query"); // Set Query Name
-            }, TEST_WAIT_TIME);
-        }).then(function () {
-            return browser.wait(function() {
-                browser.findElement(by.xpath('/html/body/section/div/div/div[2]/div/div[1]/div/div/button[3]')).click(); // Save
+                browser.findElement(by.partialLinkText('Save')).click(); // Save
                 return browser.findElement(by.xpath("//*[contains(text(),'Query Saved.')]")).isDisplayed();
             }, TEST_WAIT_TIME);
         }).then(function () {
@@ -186,9 +181,10 @@ describe('Application life cycle test', function () {
     
     function isLoggedIn(done) {
         browser.get('https://' + app.fqdn).then(function () {
-            return browser.wait(function () {
-                return browser.findElement(by.xpath('//*[contains(text(), "' + username + '")]')).isDisplayed();
-            }, TEST_WAIT_TIME);
+            return visible(by.xpath('//*[contains(text(), "' + username + '")]'));
+            // return browser.wait(function () {
+            //     return browser.findElement(by.xpath('//*[contains(text(), "' + username + '")]')).isDisplayed();
+            // }, TEST_WAIT_TIME);
         }).then(function () {
             done();
         });
@@ -196,7 +192,7 @@ describe('Application life cycle test', function () {
     
     function viewExistingQuery(done) {
         browser.get('https://' + app.fqdn + '/queries?page=1').then(function () {
-            return browser.findElement(by.xpath('//*[contains(text(), "Test Query")]'));
+            return browser.findElement(by.xpath('//*[contains(text(), "New Query")]'));
         }).then(function () {
             done();
         });
@@ -204,7 +200,8 @@ describe('Application life cycle test', function () {
     
     function viewExistingDataSource(done) {
         browser.get('https://' + app.fqdn + '/data_sources').then(function () {
-            return browser.findElement(by.xpath('//*[contains(text(), "testDataSource")]'));
+            return visible(by.xpath("//*[contains(text(),'testDataSource')]"));
+            //return browser.findElement(by.xpath("//*[contains(text(),'testDataSource')]"));
         }).then(function () {
             done();
         });
@@ -239,7 +236,7 @@ describe('Application life cycle test', function () {
         });
     });
     
-    it('cloudron: install app', function () {
+    xit('cloudron: install app', function () {
         execSync('cloudron install --new --wait --location ' + TEST_APP_LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
     });
 
@@ -258,18 +255,20 @@ describe('Application life cycle test', function () {
         });
     });
     
-    it('redash: can setup', createNewAccount);
+    xit('redash: can setup', createNewAccount);
     it('redash: can login', login);
     
     it('redash: check if logged in', isLoggedIn);
     
     it('redash: can create data source', newDataSource);
-    it('redash: can create new query', newQuery);
+    xit('redash: can create new query', newQuery);
     
-    it('cloudron: can restart app', function (done) {
+    xit('cloudron: can restart app', function (done) {
         execSync('cloudron restart --wait');
         done();
     });
+
+    xit('redash: can login', login);
     
     it('redash: check if logged in', isLoggedIn);
     
@@ -284,10 +283,12 @@ describe('Application life cycle test', function () {
         execSync('cloudron restore --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
     });
     
+    it('redash: can login', login);
+
     it('redash: check if logged in', isLoggedIn);
     
     it('redash: can see existing data source', viewExistingDataSource);
-    it('redash: can see existing query', viewExistingQuery);
+    xit('redash: can see existing query', viewExistingQuery);
 
     it('cloudron: move to different location', function () {
         browser.manage().deleteAllCookies();
@@ -302,38 +303,37 @@ describe('Application life cycle test', function () {
     it('redash: check if logged in', isLoggedIn);
     
     it('redash: can see existing data source', viewExistingDataSource);
-    it('redash: can see existing query', viewExistingQuery);
+    xit('redash: can see existing query', viewExistingQuery);
     
     it('cloudron: uninstall app', function () {
         execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
     });
 
-    it('cloudron: can install app from store', function () {
-        execSync('cloudron install --new --wait --appstore-id io.redash --location ' + TEST_APP_LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
-        var inspect = JSON.parse(execSync('cloudron inspect'));
-        app = inspect.apps.filter(function (a) { return a.location === TEST_APP_LOCATION; })[0];
-        expect(app).to.be.an('object');
-    });
+    // it('cloudron: can install app from store', function () {
+    //     execSync('cloudron install --new --wait --appstore-id io.redash@1.1.1 --location ' + TEST_APP_LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
+    //     var inspect = JSON.parse(execSync('cloudron inspect'));
+    //     app = inspect.apps.filter(function (a) { return a.location === TEST_APP_LOCATION; })[0];
+    //     expect(app).to.be.an('object');
+    // });
     
-    it('redash: can setup', createNewAccount);
-    it('redash: can login', login);
+    // it('redash: can setup', createNewAccount);
     
-    it('redash: check if logged in', isLoggedIn);
+    // it('redash: check if logged in', isLoggedIn);
     
-    it('redash: can create data source', newDataSource);
-    it('redash: can create neq query', newQuery);
+    // it('redash: can create data source', newDataSource);
+    // xit('redash: can create new query', newQuery);
     
-    it('cloudron: can update', function () {
-        execSync('cloudron install --wait --app ' + TEST_APP_LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
-    });
+    // it('cloudron: can update', function () {
+    //     execSync('cloudron install --wait --app ' + TEST_APP_LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
+    // });
     
-    it('redash: check if logged in', isLoggedIn);
+    // it('redash: check if logged in', isLoggedIn);
     
-    it('redash: can see existing data source', viewExistingDataSource);
-    it('redash: can see existing query', viewExistingQuery);
+    // it('redash: can see existing data source', viewExistingDataSource);
+    // it('redash: can see existing query', viewExistingQuery);
     
-    it('cloudron: uninstall app', function () {
-        execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
-    });
+    // it('cloudron: uninstall app', function () {
+    //     execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
+    // });
     
 });