From 9aa88ae21a7e345737bf5deeb5c4190da2bb5cc6 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Thu, 31 May 2018 13:59:21 -0700 Subject: [PATCH] Add test for static files --- test/package.json | 2 +- test/test.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/test/package.json b/test/package.json index 160bd33..0d092cb 100644 --- a/test/package.json +++ b/test/package.json @@ -17,6 +17,6 @@ "rimraf": "^2.5.3", "selenium-server-standalone-jar": "^2.53.1", "selenium-webdriver": "^2.53.3", - "superagent": "^1.4.0" + "superagent": "^1.8.5" } } diff --git a/test/test.js b/test/test.js index 8ea97f6..1e30ae5 100644 --- a/test/test.js +++ b/test/test.js @@ -7,6 +7,7 @@ require('chromedriver'); var execSync = require('child_process').execSync, expect = require('expect.js'), path = require('path'), + superagent = require('superagent'), webdriver = require('selenium-webdriver'); var by = webdriver.By, @@ -146,6 +147,17 @@ describe('Application life cycle test', function () { visible(by.xpath('//a[text()="Cloudron.io"]'), callback); } + function getStaticExtensionFile(callback) { + superagent.get(`https://${app.fqdn}/p/ext.php?f=xExtension-StickyFeeds/static/script.js&t=js`) + .buffer(true) + .end(function (err, res) { + expect(err).to.be(null); + expect(res.status).to.be(200); + expect(res.text).to.contain('sticky_feeds'); // relies on the buffer flag above + callback(); + }); + } + xit('build app', function () { execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); }); @@ -162,6 +174,7 @@ describe('Application life cycle test', function () { it('can enable API', enableApi); it('can check configuration', checkApiConfiguration); it('subscription exists', subscriptionExists); + it('can get static extension file', getStaticExtensionFile); it('can logout', logout); it('backup app', function () { @@ -175,6 +188,7 @@ describe('Application life cycle test', function () { it('can login', login); it('can check configuration', checkApiConfiguration); it('subscription exists', subscriptionExists); + it('can get static extension file', getStaticExtensionFile); it('can logout', logout); it('move to different location', function () { @@ -188,6 +202,7 @@ describe('Application life cycle test', function () { it('can login', login); it('can check configuration', checkApiConfiguration); it('subscription exists', subscriptionExists); + it('can get static extension file', getStaticExtensionFile); it('can logout', logout); it('uninstall app', function () { @@ -213,6 +228,7 @@ describe('Application life cycle test', function () { it('can login', login); it('subscription exists', subscriptionExists); + it('can get static extension file', getStaticExtensionFile); it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });