From f1b0fc4097df015cde96e23d35644dee38cd89c7 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Tue, 6 Apr 2021 11:24:39 +0200 Subject: [PATCH] Fixup tests --- test/test.js | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/test/test.js b/test/test.js index 47ce46b..d35e89a 100644 --- a/test/test.js +++ b/test/test.js @@ -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 () { - execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS); - done(); - }); + it('move to different location', async function () { + await browser.get('about:blank'); + execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS); }); 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 () { - execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); - done(); - }); + it('uninstall app', async function () { + await browser.get('about:blank'); + execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); }); // 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 () { - execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); - done(); - }); + it('uninstall app', async function () { + await browser.get('about:blank'); + execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); }); });