Fixup tests
This commit is contained in:
parent
def7b55560
commit
46177b5ad6
89
test/test.js
89
test/test.js
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
/* global describe */
|
||||||
|
/* global before */
|
||||||
|
/* global after */
|
||||||
|
/* global it */
|
||||||
|
|
||||||
require('chromedriver');
|
require('chromedriver');
|
||||||
|
|
||||||
var execSync = require('child_process').execSync,
|
var execSync = require('child_process').execSync,
|
||||||
|
@ -15,15 +20,6 @@ var by = require('selenium-webdriver').By,
|
||||||
Key = require('selenium-webdriver').Key,
|
Key = require('selenium-webdriver').Key,
|
||||||
Builder = require('selenium-webdriver').Builder;
|
Builder = require('selenium-webdriver').Builder;
|
||||||
|
|
||||||
var accessKey = 'admin',
|
|
||||||
secretKey = 'secretkey';
|
|
||||||
|
|
||||||
var bucket_prefix = 'bucket',
|
|
||||||
bucket_id = 0,
|
|
||||||
bucket;
|
|
||||||
|
|
||||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
||||||
|
|
||||||
describe('Application life cycle test', function () {
|
describe('Application life cycle test', function () {
|
||||||
this.timeout(0);
|
this.timeout(0);
|
||||||
|
|
||||||
|
@ -49,10 +45,14 @@ describe('Application life cycle test', function () {
|
||||||
var TEST_TIMEOUT = 30000;
|
var TEST_TIMEOUT = 30000;
|
||||||
var FOLDER = 'xmf'; // keep this small. long folder names fail in automation, not sure why
|
var FOLDER = 'xmf'; // keep this small. long folder names fail in automation, not sure why
|
||||||
var SYNC_PORT = 22001;
|
var SYNC_PORT = 22001;
|
||||||
|
var EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
||||||
|
|
||||||
var app;
|
var app;
|
||||||
|
|
||||||
function installApp() {
|
function getAppInfo() {
|
||||||
execSync('cloudron install --port-bindings SYNC_PORT=' + SYNC_PORT + ' --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
var inspect = JSON.parse(execSync('cloudron inspect'));
|
||||||
|
app = inspect.apps.filter(function (a) { return a.location === LOCATION || a.location === LOCATION + '2'; })[0];
|
||||||
|
expect(app).to.be.an('object');
|
||||||
}
|
}
|
||||||
|
|
||||||
function pageLoaded() {
|
function pageLoaded() {
|
||||||
|
@ -75,6 +75,8 @@ describe('Application life cycle test', function () {
|
||||||
|
|
||||||
function loadPage(callback) {
|
function loadPage(callback) {
|
||||||
browser.manage().deleteAllCookies().then(function () {
|
browser.manage().deleteAllCookies().then(function () {
|
||||||
|
return browser.sleep(10000);
|
||||||
|
}).then(function() {
|
||||||
return browser.get('https://' + username + ':' + encodeURIComponent(password) + '@' + app.fqdn).then(function () {
|
return browser.get('https://' + username + ':' + encodeURIComponent(password) + '@' + app.fqdn).then(function () {
|
||||||
return browser.get('https://' + app.fqdn);
|
return browser.get('https://' + app.fqdn);
|
||||||
});
|
});
|
||||||
|
@ -139,65 +141,54 @@ describe('Application life cycle test', function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
xit('build app', function () {
|
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
|
||||||
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('install app', installApp);
|
it('install app', function () { execSync('cloudron install --port-bindings SYNC_PORT=' + SYNC_PORT + ' --location ' + LOCATION, EXEC_ARGS); });
|
||||||
|
it('can get app information', getAppInfo);
|
||||||
it('can get app information', function () {
|
|
||||||
var inspect = JSON.parse(execSync('cloudron inspect'));
|
|
||||||
|
|
||||||
app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
|
|
||||||
|
|
||||||
expect(app).to.be.an('object');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('fails with invalid password', invalidPassword);
|
it('fails with invalid password', invalidPassword);
|
||||||
it('can load page', loadPage);
|
it('can load page', loadPage);
|
||||||
it('can add folder', addFolder);
|
it('can add folder', addFolder);
|
||||||
|
|
||||||
it('backup app', function () {
|
it('backup app', function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); });
|
||||||
execSync('cloudron backup create --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
it('restore app', function () { execSync('cloudron restore --app ' + app.id, EXEC_ARGS); });
|
||||||
});
|
|
||||||
|
|
||||||
it('restore app', function () {
|
|
||||||
execSync('cloudron restore --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can load page', loadPage);
|
it('can load page', loadPage);
|
||||||
it('can check folder', checkFolder);
|
it('can check folder', checkFolder);
|
||||||
|
|
||||||
it('move to different location', function () {
|
it('move to different location', function (done) {
|
||||||
browser.manage().deleteAllCookies();
|
// ensure we don't hit NXDOMAIN in the mean time
|
||||||
execSync('cloudron configure --location ' + LOCATION + '2', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
browser.get('about:blank').then(function () {
|
||||||
var inspect = JSON.parse(execSync('cloudron inspect'));
|
execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS);
|
||||||
app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0];
|
done();
|
||||||
expect(app).to.be.an('object');
|
});
|
||||||
});
|
});
|
||||||
|
it('can get app information', getAppInfo);
|
||||||
|
|
||||||
it('can load page', loadPage);
|
it('can load page', loadPage);
|
||||||
it('can check folder', checkFolder);
|
it('can check folder', checkFolder);
|
||||||
it('can remove folder', removeFolder);
|
it('can remove folder', removeFolder);
|
||||||
|
|
||||||
it('uninstall app', function () {
|
it('uninstall app', function (done) {
|
||||||
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
browser.get('about:blank').then(function () {
|
||||||
|
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// test update
|
// test update
|
||||||
it('can install app', function () {
|
it('can install app', function () { execSync('cloudron install --port-bindings SYNC_PORT=' + SYNC_PORT + ' --appstore-id net.syncthing.cloudronapp2 --location ' + LOCATION, EXEC_ARGS); });
|
||||||
execSync('cloudron install --appstore-id net.syncthing.cloudronapp2 --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
it('can get app information', getAppInfo);
|
||||||
var inspect = JSON.parse(execSync('cloudron inspect'));
|
|
||||||
app = inspect.apps.filter(function (a) { return a.location === LOCATION; })[0];
|
|
||||||
expect(app).to.be.an('object');
|
|
||||||
});
|
|
||||||
it('can load page', loadPage);
|
it('can load page', loadPage);
|
||||||
it('can add folder', addFolder);
|
it('can add folder', addFolder);
|
||||||
it('can update', function () {
|
it('can update', function () { execSync('cloudron update --app ' + LOCATION, EXEC_ARGS); });
|
||||||
execSync('cloudron update --app ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
it('wait for app to startup fully', function (done) { setTimeout(done, 10000); });
|
||||||
});
|
|
||||||
it('can check folder', checkFolder);
|
it('can check folder', checkFolder);
|
||||||
it('uninstall app', function () {
|
|
||||||
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
it('uninstall app', function (done) {
|
||||||
|
browser.get('about:blank').then(function () {
|
||||||
|
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue