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