Fixup tests

This commit is contained in:
Johannes Zellner 2021-04-06 11:24:39 +02:00
parent cb832e1c5d
commit f1b0fc4097
1 changed files with 28 additions and 20 deletions

View File

@ -1,12 +1,13 @@
#!/usr/bin/env node
'use strict';
/* jshint esversion: 8 */
/* global describe */
/* global before */
/* global after */
/* global it */
'use strict';
require('chromedriver');
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://' + app.fqdn);
});
}).then(function () {
return browser.sleep(5000);
}).then(function () {
return browser.get('https://' + app.fqdn);
}).then(function () {
return waitForElement(By.xpath('//span[text()="Actions"]'));
}).then(function () {
@ -95,6 +100,10 @@ describe('Application life cycle test', function () {
function checkFolder(callback) {
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);
}).then(function () {
callback();
@ -141,19 +150,19 @@ describe('Application life cycle test', function () {
it('can add folder', addFolder);
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('can load page', loadPage);
it('can check folder', checkFolder);
it('move to different location', function (done) {
// ensure we don't hit NXDOMAIN in the mean time
browser.get('about:blank').then(function () {
it('move to different location', async function () {
await browser.get('about:blank');
execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS);
done();
});
});
it('can get app information', getAppInfo);
@ -163,11 +172,9 @@ describe('Application life cycle test', function () {
it('can check folder', checkFolder);
it('can remove folder', removeFolder);
it('uninstall app', function (done) {
browser.get('about:blank').then(function () {
it('uninstall app', async function () {
await browser.get('about:blank');
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
done();
});
});
// test update
@ -176,14 +183,15 @@ describe('Application life cycle test', function () {
it('wait', wait);
it('can load page', loadPage);
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('can check folder', checkFolder);
it('uninstall app', function (done) {
browser.get('about:blank').then(function () {
it('uninstall app', async function () {
await browser.get('about:blank');
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
done();
});
});
});