Add update tests

This commit is contained in:
Johannes Zellner 2018-03-19 12:01:48 +01:00
parent defc123e22
commit 7d731e71a6
1 changed files with 40 additions and 8 deletions

View File

@ -132,6 +132,18 @@ describe('Application life cycle test', function () {
}); });
} }
function getAppInfo() {
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 subscriptionExists(callback) {
browser.get('https://' + app.fqdn + '/p/i/?get=c_1');
visible(by.xpath('//a[text()="Cloudron.io"]'), callback);
}
xit('build app', function () { xit('build app', function () {
execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); execSync('cloudron build', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
}); });
@ -140,19 +152,14 @@ describe('Application life cycle test', function () {
execSync('cloudron install --new --wait --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); execSync('cloudron install --new --wait --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
}); });
it('can get app information', function () { 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 login', login); it('can login', login);
it('can subscribe', addSubscription); it('can subscribe', addSubscription);
it('can add users', addUser); it('can add users', addUser);
it('can enable API', enableApi); it('can enable API', enableApi);
it('can check configuration', checkApiConfiguration); it('can check configuration', checkApiConfiguration);
it('subscription exists', subscriptionExists);
it('can logout', logout); it('can logout', logout);
it('backup app', function () { it('backup app', function () {
@ -165,11 +172,12 @@ describe('Application life cycle test', function () {
it('can login', login); it('can login', login);
it('can check configuration', checkApiConfiguration); it('can check configuration', checkApiConfiguration);
it('subscription exists', subscriptionExists);
it('can logout', logout); it('can logout', logout);
it('move to different location', function () { it('move to different location', function () {
browser.manage().deleteAllCookies(); browser.manage().deleteAllCookies();
execSync('cloudron configure --wait --location ' + LOCATION + '2', { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); execSync('cloudron configure --wait --location ' + LOCATION + '2 --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
var inspect = JSON.parse(execSync('cloudron inspect')); var inspect = JSON.parse(execSync('cloudron inspect'));
app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0]; app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0];
expect(app).to.be.an('object'); expect(app).to.be.an('object');
@ -177,10 +185,34 @@ describe('Application life cycle test', function () {
it('can login', login); it('can login', login);
it('can check configuration', checkApiConfiguration); it('can check configuration', checkApiConfiguration);
it('subscription exists', subscriptionExists);
it('can logout', logout); it('can logout', logout);
it('uninstall app', function () { it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }); execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
}); });
// test update
it('can install app', function () {
execSync('cloudron install --new --wait --appstore-id org.freshrss.cloudronapp --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
it('can get app information', getAppInfo);
it('can login', login);
it('can subscribe', addSubscription);
it('can add users', addUser);
it('can update', function () {
execSync('cloudron install --wait --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
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 login', login);
it('subscription exists', subscriptionExists);
it('uninstall app', function () {
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
});
}); });