From 2a5c04fdd7e565d1c51032250b7fbc4ed7db8ae8 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 27 Oct 2023 15:48:46 +0200 Subject: [PATCH] Fixup tests --- test/test.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/test/test.js b/test/test.js index 45a8782..29f741e 100644 --- a/test/test.js +++ b/test/test.js @@ -29,7 +29,7 @@ describe('Application life cycle test', function () { this.timeout(0); const LOCATION = 'test'; - const TEST_TIMEOUT = 10000; + const TEST_TIMEOUT = parseInt(process.env.TIMEOUT, 10) || 10000; const EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' }; const USERNAME = process.env.USERNAME; @@ -129,6 +129,7 @@ describe('Application life cycle test', function () { await waitForElement(By.id('api_enabled')); await browser.findElement(By.id('api_enabled')).click(); await browser.findElement(By.xpath('//button[text()="Submit"]')).click(); + await browser.sleep(5000); } async function checkApiConfiguration() { @@ -142,20 +143,17 @@ describe('Application life cycle test', function () { return waitForElement(By.xpath('//span[text()="Cloudron"]')); } - function getStaticExtensionFile(callback) { - superagent.get(`${baseUrl()}/ext.php?f=xExtension-StickyFeeds/static/script.js&t=js`) + async function getStaticExtensionFile() { + const response = await superagent.get(`${baseUrl()}/ext.php?f=xExtension-StickyFeeds/static/script.js&t=js`) .buffer(true) - .end(function (err, res) { - expect(err).to.be(null); - expect(res.status).to.be(200); - expect(res.text).to.contain('sticky_feeds'); // relies on the buffer flag above - callback(); - }); + .ok(() => true); + expect(response.statusCode).to.be(200); + expect(response.text).to.contain('sticky_feeds'); // relies on the buffer flag above } xit('build app', function () { execSync('cloudron build', EXEC_ARGS); }); // No SSO - it('install app', function () { execSync('cloudron install --no-sso --location ' + LOCATION, EXEC_ARGS); }); + it('install app (no sso)', function () { execSync('cloudron install --no-sso --location ' + LOCATION, EXEC_ARGS); }); it('can get app information', getAppInfo); @@ -170,7 +168,7 @@ describe('Application life cycle test', function () { it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); }); // SSO - it('install app', function () { execSync('cloudron install --location ' + LOCATION, EXEC_ARGS); }); + it('install app (sso)', function () { execSync('cloudron install --location ' + LOCATION, EXEC_ARGS); }); it('can get app information', getAppInfo);