Fixup tests

This commit is contained in:
Girish Ramakrishnan 2023-10-27 15:48:46 +02:00
parent 278637ef3a
commit 2a5c04fdd7
1 changed files with 9 additions and 11 deletions

View File

@ -29,7 +29,7 @@ describe('Application life cycle test', function () {
this.timeout(0); this.timeout(0);
const LOCATION = 'test'; 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 EXEC_ARGS = { cwd: path.resolve(__dirname, '..'), stdio: 'inherit' };
const USERNAME = process.env.USERNAME; const USERNAME = process.env.USERNAME;
@ -129,6 +129,7 @@ describe('Application life cycle test', function () {
await waitForElement(By.id('api_enabled')); await waitForElement(By.id('api_enabled'));
await browser.findElement(By.id('api_enabled')).click(); await browser.findElement(By.id('api_enabled')).click();
await browser.findElement(By.xpath('//button[text()="Submit"]')).click(); await browser.findElement(By.xpath('//button[text()="Submit"]')).click();
await browser.sleep(5000);
} }
async function checkApiConfiguration() { async function checkApiConfiguration() {
@ -142,20 +143,17 @@ describe('Application life cycle test', function () {
return waitForElement(By.xpath('//span[text()="Cloudron"]')); return waitForElement(By.xpath('//span[text()="Cloudron"]'));
} }
function getStaticExtensionFile(callback) { async function getStaticExtensionFile() {
superagent.get(`${baseUrl()}/ext.php?f=xExtension-StickyFeeds/static/script.js&t=js`) const response = await superagent.get(`${baseUrl()}/ext.php?f=xExtension-StickyFeeds/static/script.js&t=js`)
.buffer(true) .buffer(true)
.end(function (err, res) { .ok(() => true);
expect(err).to.be(null); expect(response.statusCode).to.be(200);
expect(res.status).to.be(200); expect(response.text).to.contain('sticky_feeds'); // relies on the buffer flag above
expect(res.text).to.contain('sticky_feeds'); // relies on the buffer flag above
callback();
});
} }
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); }); xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
// No SSO // 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); 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); }); it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); });
// SSO // 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); it('can get app information', getAppInfo);