Explorar o código

add adminLogin test (untested)

Girish Ramakrishnan %!s(int64=7) %!d(string=hai) anos
pai
achega
f9446a6dcd
Modificáronse 1 ficheiros con 22 adicións e 0 borrados
  1. 22 0
      test/test.js

+ 22 - 0
test/test.js

@@ -77,6 +77,24 @@ describe('Application life cycle test SSO', function () {
         });
     }
 
+    function adminLogin(callback) {
+        browser.get('https://' + app.fqdn + '/admin').then(function () {
+            return browser.findElement(by.name('username')).sendKeys('admin');
+        }).then(function () {
+            return browser.findElement(by.name('password')).sendKeys('123123');
+        }).then(function () {
+            return browser.findElement(by.className('login-form')).submit();
+        }).then(function () {
+            return waitForElement(by.xpath('//h1[text()="Site administration"]'));
+        }).then(function () {
+            return browser.findElement(by.xpath('//a[text()="Log out"]')).click();
+        }).then(function () {
+            return browser.sleep(2000);
+        }).then(function () {
+            callback();
+        });
+    }
+
     function userStoryExists(callback) {
         browser.get('https://' + app.fqdn + '/project/' + process.env.USERNAME + '-' + PROJECT_NAME + '/us/1').then(function () {
             return waitForElement(by.xpath('//span[text()="' + USER_STORY_SUBJECT + '"]'));
@@ -165,6 +183,7 @@ describe('Application life cycle test SSO', function () {
     });
 
     it('can get app information', getAppInfo);
+    it('can admin login', adminLogin);
     it('can login', login);
     it('can dismiss tutorial', dismissTutorial);
     it('can create project', createProject);
@@ -187,6 +206,7 @@ describe('Application life cycle test SSO', function () {
 
     it('can get app information', getAppInfo);
 
+    it('can admin login', adminLogin);
     // origin change requires new login
     it('can login', login);
     it('user story is still present', userStoryExists);
@@ -202,6 +222,7 @@ describe('Application life cycle test SSO', function () {
         execSync('cloudron install --new --wait --appstore-id ' + app.manifest.id + ' --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
     });
 
+    it('can admin login', adminLogin);
     it('can get app information', getAppInfo);
     it('can login', login);
     it('can dismiss tutorial', dismissTutorial);
@@ -211,6 +232,7 @@ describe('Application life cycle test SSO', function () {
     it('can update', function () {
         execSync('cloudron install --wait --app ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
     });
+    it('can admin login', adminLogin);
     it('user story exists', userStoryExists);
     it('uninstall app', function () {
         execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });