Przeglądaj źródła

test: logout before uninstall

otherwise, the browser gives warnings:

     Uncaught UnexpectedAlertOpenError: unexpected alert open: {Alert text : Your session has expired. You can log in again from this page or go to the login page.}
  (Session info: chrome=59.0.3071.115)
  (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 4.4.0-71-generic x86_64)
Girish Ramakrishnan 7 lat temu
rodzic
commit
8886ad807a
1 zmienionych plików z 13 dodań i 1 usunięć
  1. 13 1
      test/test.js

+ 13 - 1
test/test.js

@@ -72,6 +72,15 @@ describe('Application life cycle test', function () {
         });
     }
 
+    function logout(done) {
+        browser.manage().deleteAllCookies().then(function () {
+            browser.executeScript('localStorage.clear();');
+            browser.executeScript('sessionStorage.clear();');
+
+            done();
+        });
+    }
+
     function checkHtaccess(done) {
         var out = execSync('cloudron exec -- cat /app/data/htaccess');
         expect(out.toString('utf8').indexOf('RewriteEngine On')).to.not.be(-1); // wp generates this with permalinks in hard mode
@@ -264,6 +273,7 @@ describe('Application life cycle test', function () {
     it('has correct htaccess', checkHtaccess);
     it('can access permalink', checkPermalink);
     it('can login', login.bind(null, username, password));
+    it('can logout', logout);
 
     it('uninstall app', function () {
         execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
@@ -279,7 +289,7 @@ describe('Application life cycle test', function () {
 
         login(email, password, function () {
             execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
-            done();
+            logout(done);
         });
     });
 
@@ -302,6 +312,8 @@ describe('Application life cycle test', function () {
         browser.wait(until.elementLocated(by.xpath('//div[@class="wp-menu-name" and contains(text(), "Plugins")]')), TIMEOUT).then(function () { done(); });
     });
 
+    it('can logout', logout);
+
     it('uninstall app (no sso)', function () {
         execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
     });