Girish Ramakrishnan 8 rokov pred
rodič
commit
e793beb0e8
1 zmenil súbory, kde vykonal 31 pridanie a 38 odobranie
  1. 31 38
      test/test.js

+ 31 - 38
test/test.js

@@ -70,6 +70,24 @@ describe('Application life cycle test', function () {
         done();
     }
 
+    function checkPermalink(done) {
+        browser.get('https://' + app.fqdn + '/hello-cloudron');
+        browser.findElement(by.xpath('//*[text()="Hello Cloudron!"]')).then(function () { done(); });
+    }
+
+    function checkMedia(done) {
+        superagent.get(mediaLink).end(function (error, result) {
+            expect(error).to.be(null);
+            expect(result.statusCode).to.be(200);
+            done();
+        });
+    }
+
+    function checkPost(done) {
+        browser.get('https://' + app.fqdn);
+        browser.findElement(by.xpath('//*[text()="Hello Cloudron!"]')).then(function () { done(); });
+    }
+
     xit('build app', function () {
         execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
     });
@@ -160,24 +178,17 @@ describe('Application life cycle test', function () {
     });
 
     it('has correct htaccess', checkHtaccess);
+    it('can access permalink', checkPermalink);
 
     it('can restart app', function (done) {
         execSync('cloudron restart');
         done();
     });
 
-    it('can see updated post', function (done) {
-        browser.get('https://' + app.fqdn);
-        browser.findElement(by.xpath('//*[text()="Hello Cloudron!"]')).then(function () { done(); });
-    });
-
-    it('can see media', function (done) {
-        superagent.get(mediaLink).end(function (error, result) {
-            expect(error).to.be(null);
-            expect(result.statusCode).to.be(200);
-            done();
-        });
-    });
+    it('can see updated post', checkPost);
+    it('can see media', checkMedia);
+    it('has correct htaccess', checkHtaccess);
+    it('can access permalink', checkPermalink);
 
     it('backup app', function () {
         execSync('cloudron backup create --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
@@ -187,19 +198,10 @@ describe('Application life cycle test', function () {
         execSync('cloudron restore --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
     });
 
-    it('can see updated post', function (done) {
-        browser.get('https://' + app.fqdn);
-        browser.findElement(by.xpath('//*[text()="Hello Cloudron!"]')).then(function () { done(); });
-    });
-
-    it('can see media', function (done) {
-        superagent.get(mediaLink).end(function (error, result) {
-            expect(error).to.be(null);
-            expect(result.statusCode).to.be(200);
-            done();
-        });
-    });
-
+    it('can see updated post', checkPost);
+    it('can see media', checkMedia);
+    it('has correct htaccess', checkHtaccess);
+    it('can access permalink', checkPermalink);
     it('can login', login);
 
     it('move to different location', function () {
@@ -211,19 +213,10 @@ describe('Application life cycle test', function () {
         mediaLink = mediaLink.replace(LOCATION, LOCATION + '2');
     });
 
-    it('can see updated post', function (done) {
-        browser.get('https://' + app.fqdn);
-        browser.findElement(by.xpath('//*[text()="Hello Cloudron!"]')).then(function () { done(); });
-    });
-
-    it('can see media', function (done) {
-        superagent.get(mediaLink).end(function (error, result) {
-            expect(error).to.be(null);
-            expect(result.statusCode).to.be(200);
-            done();
-        });
-    });
-
+    it('can see updated post', checkPost);
+    it('can see media', checkMedia);
+    it('has correct htaccess', checkHtaccess);
+    it('can access permalink', checkPermalink);
     it('can login', login);
 
     it('uninstall app', function () {