Add test for static files

This commit is contained in:
Girish Ramakrishnan 2018-05-31 13:59:21 -07:00
parent 62182d519b
commit 9aa88ae21a
2 changed files with 17 additions and 1 deletions

View File

@ -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"
}
}

View File

@ -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' });