Fixup tests
This commit is contained in:
parent
cb832e1c5d
commit
f1b0fc4097
42
test/test.js
42
test/test.js
|
@ -1,12 +1,13 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
'use strict';
|
/* jshint esversion: 8 */
|
||||||
|
|
||||||
/* global describe */
|
/* global describe */
|
||||||
/* global before */
|
/* global before */
|
||||||
/* global after */
|
/* global after */
|
||||||
/* global it */
|
/* global it */
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
require('chromedriver');
|
require('chromedriver');
|
||||||
|
|
||||||
var execSync = require('child_process').execSync,
|
var execSync = require('child_process').execSync,
|
||||||
|
@ -64,6 +65,10 @@ describe('Application life cycle test', function () {
|
||||||
return browser.get('https://' + username + ':' + encodeURIComponent(password) + '@' + app.fqdn).then(function () {
|
return browser.get('https://' + username + ':' + encodeURIComponent(password) + '@' + app.fqdn).then(function () {
|
||||||
return browser.get('https://' + app.fqdn);
|
return browser.get('https://' + app.fqdn);
|
||||||
});
|
});
|
||||||
|
}).then(function () {
|
||||||
|
return browser.sleep(5000);
|
||||||
|
}).then(function () {
|
||||||
|
return browser.get('https://' + app.fqdn);
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
return waitForElement(By.xpath('//span[text()="Actions"]'));
|
return waitForElement(By.xpath('//span[text()="Actions"]'));
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
@ -95,6 +100,10 @@ describe('Application life cycle test', function () {
|
||||||
|
|
||||||
function checkFolder(callback) {
|
function checkFolder(callback) {
|
||||||
browser.get('https://' + app.fqdn).then(function () {
|
browser.get('https://' + app.fqdn).then(function () {
|
||||||
|
return browser.sleep(5000);
|
||||||
|
}).then(function () {
|
||||||
|
return browser.get('https://' + app.fqdn);
|
||||||
|
}).then(function () {
|
||||||
return browser.wait(until.elementLocated(By.xpath(`//span[text()="${FOLDER}"]`)), TEST_TIMEOUT);
|
return browser.wait(until.elementLocated(By.xpath(`//span[text()="${FOLDER}"]`)), TEST_TIMEOUT);
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
callback();
|
callback();
|
||||||
|
@ -141,19 +150,19 @@ describe('Application life cycle test', function () {
|
||||||
it('can add folder', addFolder);
|
it('can add folder', addFolder);
|
||||||
|
|
||||||
it('backup app', function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); });
|
it('backup app', function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); });
|
||||||
it('restore app', function () { execSync('cloudron restore --app ' + app.id, EXEC_ARGS); });
|
it('restore app', async function () {
|
||||||
|
await browser.get('about:blank');
|
||||||
|
execSync('cloudron restore --app ' + app.id, EXEC_ARGS);
|
||||||
|
});
|
||||||
|
|
||||||
it('wait', wait);
|
it('wait', wait);
|
||||||
|
|
||||||
it('can load page', loadPage);
|
it('can load page', loadPage);
|
||||||
it('can check folder', checkFolder);
|
it('can check folder', checkFolder);
|
||||||
|
|
||||||
it('move to different location', function (done) {
|
it('move to different location', async function () {
|
||||||
// ensure we don't hit NXDOMAIN in the mean time
|
await browser.get('about:blank');
|
||||||
browser.get('about:blank').then(function () {
|
|
||||||
execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS);
|
execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS);
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
it('can get app information', getAppInfo);
|
it('can get app information', getAppInfo);
|
||||||
|
|
||||||
|
@ -163,11 +172,9 @@ describe('Application life cycle test', function () {
|
||||||
it('can check folder', checkFolder);
|
it('can check folder', checkFolder);
|
||||||
it('can remove folder', removeFolder);
|
it('can remove folder', removeFolder);
|
||||||
|
|
||||||
it('uninstall app', function (done) {
|
it('uninstall app', async function () {
|
||||||
browser.get('about:blank').then(function () {
|
await browser.get('about:blank');
|
||||||
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// test update
|
// test update
|
||||||
|
@ -176,14 +183,15 @@ describe('Application life cycle test', function () {
|
||||||
it('wait', wait);
|
it('wait', wait);
|
||||||
it('can load page', loadPage);
|
it('can load page', loadPage);
|
||||||
it('can add folder', addFolder);
|
it('can add folder', addFolder);
|
||||||
it('can update', function () { execSync('cloudron update --app ' + LOCATION, EXEC_ARGS); });
|
it('can update', async function () {
|
||||||
|
await browser.get('about:blank');
|
||||||
|
execSync('cloudron update --app ' + LOCATION, EXEC_ARGS);
|
||||||
|
});
|
||||||
it('wait', wait);
|
it('wait', wait);
|
||||||
it('can check folder', checkFolder);
|
it('can check folder', checkFolder);
|
||||||
|
|
||||||
it('uninstall app', function (done) {
|
it('uninstall app', async function () {
|
||||||
browser.get('about:blank').then(function () {
|
await browser.get('about:blank');
|
||||||
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue