diff --git a/test/test.js b/test/test.js index e7fbd0e..eeb0732 100644 --- a/test/test.js +++ b/test/test.js @@ -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 () { 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' }); }); - 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('can get app information', getAppInfo); it('can login', login); it('can subscribe', addSubscription); it('can add users', addUser); it('can enable API', enableApi); it('can check configuration', checkApiConfiguration); + it('subscription exists', subscriptionExists); it('can logout', logout); it('backup app', function () { @@ -165,11 +172,12 @@ describe('Application life cycle test', function () { it('can login', login); it('can check configuration', checkApiConfiguration); + it('subscription exists', subscriptionExists); it('can logout', logout); it('move to different location', function () { 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')); app = inspect.apps.filter(function (a) { return a.location === LOCATION + '2'; })[0]; expect(app).to.be.an('object'); @@ -177,10 +185,34 @@ describe('Application life cycle test', function () { it('can login', login); it('can check configuration', checkApiConfiguration); + it('subscription exists', subscriptionExists); it('can logout', logout); it('uninstall app', function () { 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' }); + }); });