mirror of
https://git.cloudron.io/cloudron/minio-app
synced 2025-09-26 15:07:24 +00:00
attempt to fix tests
This commit is contained in:
13
test/package-lock.json
generated
13
test/package-lock.json
generated
@@ -9,6 +9,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@eslint/js": "^9.28.0",
|
||||||
"chromedriver": "^136.0.3",
|
"chromedriver": "^136.0.3",
|
||||||
"expect.js": "^0.3.1",
|
"expect.js": "^0.3.1",
|
||||||
"mocha": "^11.5.0",
|
"mocha": "^11.5.0",
|
||||||
@@ -22,6 +23,18 @@
|
|||||||
"integrity": "sha512-1uLNT5NZsUVIGS4syuHwTzZ8HycMPyr6POA3FCE4GbMtc4rhoJk8aZKtNIRthJYfL+iioppi+rTfH3olMPr9nA==",
|
"integrity": "sha512-1uLNT5NZsUVIGS4syuHwTzZ8HycMPyr6POA3FCE4GbMtc4rhoJk8aZKtNIRthJYfL+iioppi+rTfH3olMPr9nA==",
|
||||||
"license": "Apache-2.0"
|
"license": "Apache-2.0"
|
||||||
},
|
},
|
||||||
|
"node_modules/@eslint/js": {
|
||||||
|
"version": "9.28.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.28.0.tgz",
|
||||||
|
"integrity": "sha512-fnqSjGWd/CoIp4EXIxWVK/sHA6DOHN4+8Ix2cX5ycOY7LG0UY8nHCU5pIp2eaE1Mc7Qd8kHspYNzYXT2ojPLzg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://eslint.org/donate"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@isaacs/cliui": {
|
"node_modules/@isaacs/cliui": {
|
||||||
"version": "8.0.2",
|
"version": "8.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@eslint/js": "^9.28.0",
|
||||||
"chromedriver": "^136.0.3",
|
"chromedriver": "^136.0.3",
|
||||||
"expect.js": "^0.3.1",
|
"expect.js": "^0.3.1",
|
||||||
"mocha": "^11.5.0",
|
"mocha": "^11.5.0",
|
||||||
|
109
test/test.js
109
test/test.js
@@ -68,49 +68,35 @@ describe('Application life cycle test', function () {
|
|||||||
expect(app).to.be.an('object');
|
expect(app).to.be.an('object');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function login(username, password, expandLoginForm=true) {
|
async function confirmLicense() {
|
||||||
|
await timers.setTimeout(5000);
|
||||||
|
console.log('confirming license');
|
||||||
|
await waitForElement(By.id('acknowledge-confirm'));
|
||||||
|
const button = await browser.findElement(By.id('acknowledge-confirm'));
|
||||||
|
await browser.executeScript('arguments[0].scrollIntoView(false)', button);
|
||||||
|
await browser.sleep(4000);
|
||||||
|
await button.click();
|
||||||
|
await browser.sleep(4000);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function login(username, password, acceptLicense=false) {
|
||||||
await browser.manage().deleteAllCookies();
|
await browser.manage().deleteAllCookies();
|
||||||
await browser.get('about:blank');
|
await browser.get('about:blank');
|
||||||
await browser.sleep(2000);
|
await browser.sleep(2000);
|
||||||
await browser.get(`https://${app.fqdn}/login`);
|
await browser.get(`https://${app.fqdn}/login`);
|
||||||
await browser.sleep(2000);
|
await browser.sleep(2000);
|
||||||
|
|
||||||
if (expandLoginForm) {
|
|
||||||
await waitForElement(By.xpath('//div[@id="alternativeMethods-select"]/div[contains(., "Other Authentication Methods")]'));
|
|
||||||
await browser.findElement(By.xpath('//div[@id="alternativeMethods-select"]/div[contains(., "Other Authentication Methods")]')).click();
|
|
||||||
await browser.sleep(2000);
|
|
||||||
await browser.findElement(By.xpath('//li[contains(., "Use Credentials")] | //div[@label="Use Credentials"]')).click();
|
|
||||||
await browser.sleep(2000);
|
|
||||||
}
|
|
||||||
await waitForElement(By.id('accessKey'));
|
await waitForElement(By.id('accessKey'));
|
||||||
await browser.findElement(By.id('accessKey')).sendKeys(username);
|
await browser.findElement(By.id('accessKey')).sendKeys(username);
|
||||||
await browser.findElement(By.id('secretKey')).sendKeys(password);
|
await browser.findElement(By.id('secretKey')).sendKeys(password);
|
||||||
await browser.findElement(By.xpath('//button[@id="do-login"]')).click();
|
await browser.findElement(By.xpath('//button[@id="do-login"]')).click();
|
||||||
await waitForElement(By.xpath('//span[contains(text(), "Buckets")]'));
|
|
||||||
|
if (acceptLicense) await confirmLicense();
|
||||||
|
|
||||||
|
await waitForElement(By.xpath('//button[contains(., "Create Bucket")]'));
|
||||||
await timers.setTimeout(5000);
|
await timers.setTimeout(5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loginOIDC(username, password, alreadyAuthenticated = true) {
|
|
||||||
browser.manage().deleteAllCookies();
|
|
||||||
await browser.get(`https://${app.fqdn}/login`);
|
|
||||||
await browser.sleep(10000);
|
|
||||||
|
|
||||||
await waitForElement(By.xpath('//button[contains(., "iam")]'));
|
|
||||||
await browser.findElement(By.xpath('//button[contains(., "iam")]')).click();
|
|
||||||
await browser.sleep(10000);
|
|
||||||
|
|
||||||
if (!alreadyAuthenticated) {
|
|
||||||
await waitForElement(By.id('inputUsername'));
|
|
||||||
await browser.findElement(By.id('inputUsername')).sendKeys(username);
|
|
||||||
await browser.findElement(By.id('inputPassword')).sendKeys(password);
|
|
||||||
await browser.findElement(By.id('loginSubmitButton')).click();
|
|
||||||
|
|
||||||
await browser.sleep(2000);
|
|
||||||
}
|
|
||||||
|
|
||||||
await waitForElement(By.xpath('//span[contains(text(), "Buckets")]'));
|
|
||||||
}
|
|
||||||
|
|
||||||
async function logout() {
|
async function logout() {
|
||||||
await browser.get(`https://${app.fqdn}/`);
|
await browser.get(`https://${app.fqdn}/`);
|
||||||
await waitForElement(By.xpath('//span[contains(text(), "Buckets")]'));
|
await waitForElement(By.xpath('//span[contains(text(), "Buckets")]'));
|
||||||
@@ -118,13 +104,13 @@ describe('Application life cycle test', function () {
|
|||||||
await browser.executeScript('arguments[0].scrollIntoView(false)', button);
|
await browser.executeScript('arguments[0].scrollIntoView(false)', button);
|
||||||
await button.click();
|
await button.click();
|
||||||
await browser.sleep(10000); // needed!
|
await browser.sleep(10000); // needed!
|
||||||
await waitForElement(By.xpath('//*[@id="accessKey"] | //button[contains(., "Cloudron")]'));
|
await waitForElement(By.xpath('//*[@id="accessKey"]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addBucket() {
|
async function addBucket() {
|
||||||
await browser.get(`https://${app.fqdn}/buckets`);
|
await browser.get(`https://${app.fqdn}/buckets`);
|
||||||
await waitForElement(By.xpath('//button[@id="create-bucket"]'));
|
await waitForElement(By.xpath('//button[contains(., "Create Bucket")]'));
|
||||||
await browser.findElement(By.xpath('//button[@id="create-bucket"]')).click();
|
await browser.findElement(By.xpath('//button[contains(., "Create Bucket")]')).click();
|
||||||
await browser.sleep(1000);
|
await browser.sleep(1000);
|
||||||
await waitForElement(By.xpath('//input[@id="bucket-name"]'));
|
await waitForElement(By.xpath('//input[@id="bucket-name"]'));
|
||||||
await browser.findElement(By.xpath('//input[@id="bucket-name"]')).sendKeys(BUCKET);
|
await browser.findElement(By.xpath('//input[@id="bucket-name"]')).sendKeys(BUCKET);
|
||||||
@@ -170,51 +156,18 @@ describe('Application life cycle test', function () {
|
|||||||
|
|
||||||
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
|
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
|
||||||
|
|
||||||
// no SSO
|
xit('install app', async function () {
|
||||||
it('install app (no SSO)', async function () {
|
|
||||||
execSync(`cloudron install --no-sso --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS);
|
|
||||||
await timers.setTimeout(10000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can get app information', getAppInfo);
|
|
||||||
|
|
||||||
it('can admin login', login.bind(null, 'minioadmin', 'minioadmin', false));
|
|
||||||
it('can add bucket', addBucket);
|
|
||||||
it('can logout', logout);
|
|
||||||
it('does redirect', checkRedirect);
|
|
||||||
it('check api', checkApi);
|
|
||||||
|
|
||||||
it('can change admin credentials', changeAdminCredentials);
|
|
||||||
it('can restart app', async function () {
|
|
||||||
execSync(`cloudron restart --app ${app.id}`, EXEC_ARGS);
|
|
||||||
await timers.setTimeout(10000);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('can admin login', login.bind(null, 'minioakey', 'minioskey', false));
|
|
||||||
it('has bucket', checkBucket);
|
|
||||||
it('can logout', logout);
|
|
||||||
it('does redirect', checkRedirect);
|
|
||||||
it('check api', checkApi);
|
|
||||||
it('uninstall app', function () { execSync('cloudron uninstall --app ' + app.id, EXEC_ARGS); });
|
|
||||||
|
|
||||||
// SSO
|
|
||||||
it('install app (SSO)', async function () {
|
|
||||||
execSync(`cloudron install --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS);
|
execSync(`cloudron install --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS);
|
||||||
await timers.setTimeout(10000);
|
await timers.setTimeout(10000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can get app information', getAppInfo);
|
it('can get app information', getAppInfo);
|
||||||
it('can get admin credentials', getAdminCredentials);
|
it('can admin login', login.bind(null, 'minioadmin', 'minioadmin', true));
|
||||||
it('can admin login', async function () { await login('minioadmin', rootPassword); });
|
|
||||||
it('can add bucket', addBucket);
|
it('can add bucket', addBucket);
|
||||||
it('can logout', logout);
|
it('can logout', logout);
|
||||||
it('does redirect', checkRedirect);
|
it('does redirect', checkRedirect);
|
||||||
it('check api', checkApi);
|
it('check api', checkApi);
|
||||||
|
|
||||||
it('can OIDC login', loginOIDC.bind(null, username, password, false));
|
|
||||||
it('has bucket', checkBucket);
|
|
||||||
it('can logout', logout);
|
|
||||||
|
|
||||||
it('can change admin credentials', changeAdminCredentials);
|
it('can change admin credentials', changeAdminCredentials);
|
||||||
|
|
||||||
it('can restart app', async function () {
|
it('can restart app', async function () {
|
||||||
@@ -228,10 +181,6 @@ describe('Application life cycle test', function () {
|
|||||||
it('does redirect', checkRedirect);
|
it('does redirect', checkRedirect);
|
||||||
it('check api', checkApi);
|
it('check api', checkApi);
|
||||||
|
|
||||||
it('can OIDC login', loginOIDC.bind(null, username, password, true));
|
|
||||||
it('has bucket', checkBucket);
|
|
||||||
it('can logout', logout);
|
|
||||||
|
|
||||||
it('backup app', function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); });
|
it('backup app', function () { execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); });
|
||||||
it('restore app', async function () {
|
it('restore app', async function () {
|
||||||
const backups = JSON.parse(execSync(`cloudron backup list --raw --app ${app.id}`));
|
const backups = JSON.parse(execSync(`cloudron backup list --raw --app ${app.id}`));
|
||||||
@@ -247,10 +196,6 @@ describe('Application life cycle test', function () {
|
|||||||
it('has bucket', checkBucket);
|
it('has bucket', checkBucket);
|
||||||
it('can logout', logout);
|
it('can logout', logout);
|
||||||
|
|
||||||
it('can OIDC login', loginOIDC.bind(null, username, password, true));
|
|
||||||
it('has bucket', checkBucket);
|
|
||||||
it('can logout', logout);
|
|
||||||
|
|
||||||
it('does redirect', checkRedirect);
|
it('does redirect', checkRedirect);
|
||||||
it('check api', checkApi);
|
it('check api', checkApi);
|
||||||
|
|
||||||
@@ -265,10 +210,6 @@ describe('Application life cycle test', function () {
|
|||||||
it('has bucket', checkBucket);
|
it('has bucket', checkBucket);
|
||||||
it('can logout', logout);
|
it('can logout', logout);
|
||||||
|
|
||||||
it('can OIDC login', loginOIDC.bind(null, username, password, true));
|
|
||||||
it('has bucket', checkBucket);
|
|
||||||
it('can logout', logout);
|
|
||||||
|
|
||||||
it('does redirect', checkRedirect);
|
it('does redirect', checkRedirect);
|
||||||
it('check api', checkApi);
|
it('check api', checkApi);
|
||||||
|
|
||||||
@@ -283,10 +224,6 @@ describe('Application life cycle test', function () {
|
|||||||
it('can add buckets', addBucket);
|
it('can add buckets', addBucket);
|
||||||
it('can logout', logout);
|
it('can logout', logout);
|
||||||
|
|
||||||
it('can OIDC login', loginOIDC.bind(null, username, password, true));
|
|
||||||
it('has bucket', checkBucket);
|
|
||||||
it('can logout', logout);
|
|
||||||
|
|
||||||
it('can update', function () { execSync(`cloudron update --app ${LOCATION}`, EXEC_ARGS); });
|
it('can update', function () { execSync(`cloudron update --app ${LOCATION}`, EXEC_ARGS); });
|
||||||
it('can configure', function () { execSync(`cloudron configure --app ${LOCATION} --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS); });
|
it('can configure', function () { execSync(`cloudron configure --app ${LOCATION} --location ${LOCATION} --secondary-domains API_SERVER_DOMAIN=${LOCATION}-api`, EXEC_ARGS); });
|
||||||
it('can get app information', getAppInfo);
|
it('can get app information', getAppInfo);
|
||||||
@@ -295,10 +232,6 @@ describe('Application life cycle test', function () {
|
|||||||
it('has bucket', checkBucket);
|
it('has bucket', checkBucket);
|
||||||
it('can logout', logout);
|
it('can logout', logout);
|
||||||
|
|
||||||
it('can OIDC login', loginOIDC.bind(null, username, password, true));
|
|
||||||
it('has bucket', checkBucket);
|
|
||||||
it('can logout', logout);
|
|
||||||
|
|
||||||
it('does redirect', checkRedirect);
|
it('does redirect', checkRedirect);
|
||||||
it('check api', checkApi);
|
it('check api', checkApi);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user