Fix tests
This commit is contained in:
parent
83578811b0
commit
4e734b3323
44
test/test.js
44
test/test.js
|
@ -14,21 +14,21 @@ const execSync = require('child_process').execSync,
|
|||
expect = require('expect.js'),
|
||||
superagent = require('superagent'),
|
||||
path = require('path'),
|
||||
timers = require('timers/promises'),
|
||||
{ Builder, By, Key, until } = require('selenium-webdriver'),
|
||||
{ Options } = require('selenium-webdriver/chrome');
|
||||
|
||||
describe('Application life cycle test', function () {
|
||||
this.timeout(0);
|
||||
|
||||
var LOCATION = 'test';
|
||||
var TEST_TIMEOUT = 30000;
|
||||
var FOLDER = 'xmf'; // keep this small. long folder names fail in automation, not sure why
|
||||
var SYNC_PORT = 22001;
|
||||
var EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
||||
const LOCATION = 'test';
|
||||
const TEST_TIMEOUT = 30000;
|
||||
const FOLDER = 'xmf'; // keep this small. long folder names fail in automation, not sure why
|
||||
const SYNC_PORT = 22001;
|
||||
const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
|
||||
|
||||
var browser;
|
||||
var app;
|
||||
var username = 'admin', password = 'changeme';
|
||||
let browser, app;
|
||||
const username = 'admin', password = 'changeme';
|
||||
|
||||
before(function () {
|
||||
browser = new Builder().forBrowser('chrome').setChromeOptions(new Options().windowSize({ width: 1280, height: 1024 })).build();
|
||||
|
@ -39,7 +39,7 @@ describe('Application life cycle test', function () {
|
|||
});
|
||||
|
||||
function getAppInfo() {
|
||||
var inspect = JSON.parse(execSync('cloudron inspect'));
|
||||
const inspect = JSON.parse(execSync('cloudron inspect'));
|
||||
app = inspect.apps.filter(function (a) { return a.location.indexOf(LOCATION) === 0; })[0];
|
||||
expect(app).to.be.an('object');
|
||||
}
|
||||
|
@ -136,34 +136,36 @@ describe('Application life cycle test', function () {
|
|||
|
||||
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
|
||||
|
||||
it('install app', function () { execSync('cloudron install --port-bindings SYNC_PORT=' + SYNC_PORT + ' --location ' + LOCATION, EXEC_ARGS); });
|
||||
it('install app', async function () {
|
||||
execSync('cloudron install --port-bindings SYNC_PORT=' + SYNC_PORT + ' --location ' + LOCATION, EXEC_ARGS);
|
||||
await timers.setTimeout(30000);
|
||||
});
|
||||
it('can get app information', getAppInfo);
|
||||
|
||||
it('wait', wait);
|
||||
|
||||
it('fails with invalid password', invalidPassword);
|
||||
it('can load page', loadPage);
|
||||
it('can add folder', addFolder);
|
||||
|
||||
it('backup app', function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); });
|
||||
it('backup app', async function () {
|
||||
execSync('cloudron backup create --app ' + app.id, EXEC_ARGS);
|
||||
await timers.setTimeout(30000);
|
||||
});
|
||||
it('restore app', async function () {
|
||||
await browser.get('about:blank');
|
||||
execSync('cloudron restore --app ' + app.id, EXEC_ARGS);
|
||||
await timers.setTimeout(30000);
|
||||
});
|
||||
|
||||
it('wait', wait);
|
||||
|
||||
it('can load page', loadPage);
|
||||
it('can check folder', checkFolder);
|
||||
|
||||
it('move to different location', async function () {
|
||||
await browser.get('about:blank');
|
||||
execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS);
|
||||
await timers.setTimeout(30000);
|
||||
});
|
||||
it('can get app information', getAppInfo);
|
||||
|
||||
it('wait', wait);
|
||||
|
||||
it('can load page', loadPage);
|
||||
it('can check folder', checkFolder);
|
||||
it('can remove folder', removeFolder);
|
||||
|
@ -174,16 +176,18 @@ describe('Application life cycle test', function () {
|
|||
});
|
||||
|
||||
// test update
|
||||
it('can install app', function () { execSync('cloudron install --port-bindings SYNC_PORT=' + SYNC_PORT + ' --appstore-id net.syncthing.cloudronapp2 --location ' + LOCATION, EXEC_ARGS); });
|
||||
it('can install app', async function () {
|
||||
execSync('cloudron install --port-bindings SYNC_PORT=' + SYNC_PORT + ' --appstore-id net.syncthing.cloudronapp2 --location ' + LOCATION, EXEC_ARGS);
|
||||
await timers.setTimeout(30000);
|
||||
});
|
||||
it('can get app information', getAppInfo);
|
||||
it('wait', wait);
|
||||
it('can load page', loadPage);
|
||||
it('can add folder', addFolder);
|
||||
it('can update', async function () {
|
||||
await browser.get('about:blank');
|
||||
execSync('cloudron update --app ' + LOCATION, EXEC_ARGS);
|
||||
await timers.setTimeout(30000);
|
||||
});
|
||||
it('wait', wait);
|
||||
it('can check folder', checkFolder);
|
||||
|
||||
it('uninstall app', async function () {
|
||||
|
|
Loading…
Reference in New Issue