mirror of
https://git.cloudron.io/cloudron/peertube-app.git
synced 2024-11-28 12:31:14 +00:00
Fix tests
This commit is contained in:
parent
607755fee6
commit
dd3a0c7890
1 changed files with 28 additions and 53 deletions
71
test/test.js
71
test/test.js
|
@ -1,11 +1,10 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
/* jslint node:true */
|
/* jshint esversion: 8 */
|
||||||
/* global it:false */
|
/* global describe */
|
||||||
/* global xit:false */
|
/* global before */
|
||||||
/* global describe:false */
|
/* global after */
|
||||||
/* global before:false */
|
/* global it */
|
||||||
/* global after:false */
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -26,8 +25,9 @@ if (!process.env.USERNAME || !process.env.PASSWORD || !process.env.EMAIL) {
|
||||||
describe('Application life cycle test', function () {
|
describe('Application life cycle test', function () {
|
||||||
this.timeout(0);
|
this.timeout(0);
|
||||||
|
|
||||||
var LOCATION = 'test';
|
const LOCATION = 'test';
|
||||||
var TEST_TIMEOUT = parseInt(process.env.TEST_TIMEOUT, 10) || 30000;
|
const TEST_TIMEOUT = parseInt(process.env.TEST_TIMEOUT, 10) || 30000;
|
||||||
|
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
||||||
|
|
||||||
var browser;
|
var browser;
|
||||||
var app;
|
var app;
|
||||||
|
@ -45,7 +45,7 @@ describe('Application life cycle test', function () {
|
||||||
|
|
||||||
function getAppInfo() {
|
function getAppInfo() {
|
||||||
var inspect = JSON.parse(execSync('cloudron inspect'));
|
var inspect = JSON.parse(execSync('cloudron inspect'));
|
||||||
app = inspect.apps.filter(function (a) { return a.location === LOCATION || a.location === LOCATION + '2'; })[0];
|
app = inspect.apps.filter(function (a) { return a.location.indexOf(LOCATION) === 0; })[0];
|
||||||
expect(app).to.be.an('object');
|
expect(app).to.be.an('object');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,11 +59,7 @@ describe('Application life cycle test', function () {
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
return browser.findElement(By.xpath('//input[@value="Login"]')).click();
|
return browser.findElement(By.xpath('//input[@value="Login"]')).click();
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
if (app.manifest.version === '2.4.0') {
|
|
||||||
return browser.wait(until.elementLocated(By.xpath('//a[contains(@href, "/my-library")]')), TEST_TIMEOUT);
|
return browser.wait(until.elementLocated(By.xpath('//a[contains(@href, "/my-library")]')), TEST_TIMEOUT);
|
||||||
} else {
|
|
||||||
return browser.wait(until.elementLocated(By.xpath('//div[contains(text(), "MY LIBRARY")]')), TEST_TIMEOUT);
|
|
||||||
}
|
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -149,12 +145,10 @@ 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', function (done) {
|
it('install app', function (done) {
|
||||||
execSync('cloudron install --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
execSync('cloudron install --location ' + LOCATION, EXEC_ARGS);
|
||||||
setTimeout(done, 20000); // takes a bit to create root user in background
|
setTimeout(done, 20000); // takes a bit to create root user in background
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -169,16 +163,14 @@ describe('Application life cycle test', function () {
|
||||||
it('can close account setup dialog', closeAccountSetupDialog);
|
it('can close account setup dialog', closeAccountSetupDialog);
|
||||||
it('logout', logout);
|
it('logout', logout);
|
||||||
|
|
||||||
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 () {
|
it('restore app', function () {
|
||||||
const backups = JSON.parse(execSync('cloudron backup list --raw'));
|
const backups = JSON.parse(execSync('cloudron backup list --raw'));
|
||||||
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
||||||
execSync('cloudron install --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
execSync('cloudron install --location ' + LOCATION, EXEC_ARGS);
|
||||||
getAppInfo();
|
getAppInfo();
|
||||||
execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, EXEC_ARGS);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can root login', login.bind(null, 'root', 'changeme'));
|
it('can root login', login.bind(null, 'root', 'changeme'));
|
||||||
|
@ -199,10 +191,7 @@ describe('Application life cycle test', function () {
|
||||||
it('logout', logout);
|
it('logout', logout);
|
||||||
|
|
||||||
// this is not supported for federation
|
// this is not supported for federation
|
||||||
it('move to different location', function (done) {
|
it('move to different location', function () { execSync('cloudron configure --location ' + LOCATION + '2 --app ' + app.id, EXEC_ARGS); });
|
||||||
execSync('cloudron configure --location ' + LOCATION + '2 --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can get app information', getAppInfo);
|
it('can get app information', getAppInfo);
|
||||||
it('can root login', login.bind(null, 'root', 'changeme'));
|
it('can root login', login.bind(null, 'root', 'changeme'));
|
||||||
|
@ -212,35 +201,25 @@ describe('Application life cycle test', function () {
|
||||||
it('can login', login.bind(null, username, password));
|
it('can login', login.bind(null, username, password));
|
||||||
it('logout', logout);
|
it('logout', logout);
|
||||||
|
|
||||||
it('uninstall app', function () {
|
it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); });
|
||||||
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
||||||
});
|
|
||||||
|
|
||||||
// No SSO
|
// No SSO
|
||||||
it('install app (no sso)', function (done) {
|
it('install app (no sso)', function (done) {
|
||||||
execSync('cloudron install --no-sso --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
execSync('cloudron install --no-sso --location ' + LOCATION, EXEC_ARGS);
|
||||||
setTimeout(done, 20000); // takes a bit to create root user in background
|
setTimeout(done, 20000); // takes a bit to create root user in background
|
||||||
});
|
});
|
||||||
|
|
||||||
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 (no sso)', login.bind(null, 'root', 'changeme'));
|
it('can login (no sso)', login.bind(null, 'root', 'changeme'));
|
||||||
it('can complete setup', completeSetup);
|
it('can complete setup', completeSetup);
|
||||||
it('can logout', logout);
|
it('can logout', logout);
|
||||||
|
|
||||||
it('uninstall app (no sso)', function () {
|
it('uninstall app (no sso)', function () { execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); });
|
||||||
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
||||||
});
|
|
||||||
|
|
||||||
// test update
|
// test update
|
||||||
it('can install app', function (done) {
|
it('can install app', function (done) {
|
||||||
execSync('cloudron install --appstore-id org.joinpeertube.cloudronapp --location ' + LOCATION, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
execSync('cloudron install --appstore-id org.joinpeertube.cloudronapp --location ' + LOCATION, EXEC_ARGS);
|
||||||
setTimeout(done, 20000); // takes a bit to create root user in background
|
setTimeout(done, 20000); // takes a bit to create root user in background
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -250,9 +229,7 @@ describe('Application life cycle test', function () {
|
||||||
it('can upload video', uploadVideo);
|
it('can upload video', uploadVideo);
|
||||||
it('video exists', videoExists);
|
it('video exists', videoExists);
|
||||||
|
|
||||||
it('can update', function () {
|
it('can update', function () { execSync('cloudron update --app ' + app.id, EXEC_ARGS); });
|
||||||
execSync('cloudron update --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
||||||
});
|
|
||||||
it('can root login', login.bind(null, 'root', 'changeme'));
|
it('can root login', login.bind(null, 'root', 'changeme'));
|
||||||
it('video exists', videoExists);
|
it('video exists', videoExists);
|
||||||
it('logout', logout);
|
it('logout', logout);
|
||||||
|
@ -260,7 +237,5 @@ describe('Application life cycle test', function () {
|
||||||
it('can login', login.bind(null, username, password));
|
it('can login', login.bind(null, username, password));
|
||||||
it('logout', logout);
|
it('logout', logout);
|
||||||
|
|
||||||
it('uninstall app', function () {
|
it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); });
|
||||||
execSync('cloudron uninstall --app ' + app.id, { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' });
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue