add delays everywhere

doing things fast in the ui breaks now
This commit is contained in:
Girish Ramakrishnan 2022-06-06 21:25:15 -07:00
parent 4b3b4b9d4d
commit 542b8a4412
3 changed files with 32 additions and 5 deletions

17
test/package-lock.json generated
View File

@ -10,6 +10,7 @@
"license": "ISC",
"dependencies": {
"chromedriver": "^101.0.0",
"delay": "^5.0.0",
"expect.js": "^0.3.1",
"mocha": "^10.0.0",
"selenium-webdriver": "^4.1.2",
@ -461,6 +462,17 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/delay": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz",
"integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
@ -2178,6 +2190,11 @@
"slash": "^3.0.0"
}
},
"delay": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz",
"integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw=="
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",

View File

@ -10,6 +10,7 @@
"license": "ISC",
"dependencies": {
"chromedriver": "^101.0.0",
"delay": "^5.0.0",
"expect.js": "^0.3.1",
"mocha": "^10.0.0",
"selenium-webdriver": "^4.1.2",

View File

@ -11,7 +11,8 @@
require('chromedriver');
const execSync = require('child_process').execSync,
const delay = require('delay'),
execSync = require('child_process').execSync,
expect = require('expect.js'),
fs = require('fs'),
path = require('path'),
@ -55,6 +56,7 @@ describe('Application life cycle test', function () {
await browser.findElement(By.id('secretKey')).sendKeys(secretKey);
await browser.findElement(By.xpath('//button[contains(text(), "Login")]')).click();
await waitForElement(By.xpath('//span[contains(text(), "Buckets")]'));
await delay(5000);
}
async function logout() {
@ -72,6 +74,7 @@ describe('Application life cycle test', function () {
await browser.findElement(By.xpath('//input[@id="bucket-name"]')).sendKeys(BUCKET);
await browser.findElement(By.xpath('//button[text()="Create Bucket"]')).click();
await waitForElement(By.xpath(`//a[contains(text(), "${BUCKET}")]`));
await delay(5000);
}
async function checkBucket() {
@ -92,7 +95,10 @@ describe('Application life cycle test', function () {
}
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
it('install app', function () { execSync(`cloudron install --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS); });
it('install app', async function () {
execSync(`cloudron install --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS);
await delay(10000);
});
it('can get app information', getAppInfo);
@ -102,7 +108,7 @@ describe('Application life cycle test', function () {
it('does redirect', checkRedirect);
it('check api', checkApi);
it('can change credentials', function () {
it('can change credentials', async function () {
let data = fs.readFileSync(path.join(__dirname, '../env.sh'), 'utf8');
data = data
.replace(/MINIO_ROOT_USER=.*/, 'MINIO_ROOT_USER=minioakey')
@ -110,6 +116,7 @@ describe('Application life cycle test', function () {
fs.writeFileSync('/tmp/env.sh', data);
execSync(`cloudron push --app ${app.id} /tmp/env.sh /app/data/env.sh`, EXEC_ARGS);
execSync(`cloudron restart --app ${app.id}`, EXEC_ARGS);
await delay(10000);
});
it('can restart app', function () { execSync(`cloudron restart --app ${app.id}`, EXEC_ARGS); });
@ -121,12 +128,13 @@ describe('Application life cycle test', function () {
it('check api', checkApi);
it('backup app', function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); });
it('restore app', function () {
it('restore app', async function () {
const backups = JSON.parse(execSync(`cloudron backup list --raw --app ${app.id}`));
execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS);
execSync('cloudron install --location ' + LOCATION, EXEC_ARGS);
getAppInfo();
execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, EXEC_ARGS);
await delay(10000);
});
it('can login', login.bind(null, 'minioakey', 'minioskey'));
@ -135,9 +143,10 @@ describe('Application life cycle test', function () {
it('does redirect', checkRedirect);
it('check api', checkApi);
it('move to different location', function () {
it('move to different location', async function () {
browser.manage().deleteAllCookies();
execSync('cloudron configure --location ' + LOCATION + '2', EXEC_ARGS);
await delay(10000);
});
it('can get app information', getAppInfo);