Fixup tests

This commit is contained in:
Girish Ramakrishnan 2024-02-20 13:26:29 +01:00
parent 74bc0cbbd2
commit 623b291e62
1 changed files with 8 additions and 10 deletions

View File

@ -57,14 +57,15 @@ describe('Application life cycle test', function () {
expect(app).to.be.an('object');
}
async function login(username, password) {
async function login(username, password, expandLoginForm=true) {
await browser.manage().deleteAllCookies();
await browser.get('about:blank');
await browser.sleep(2000);
await browser.get(`https://${app.fqdn}/login`);
await browser.sleep(2000);
if (await browser.findElements(By.id('accessKey')).then(found => !found.length) && await browser.findElements(By.id('alternativeMethods-select')).then(found => !!found.length)) {
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();
@ -165,7 +166,7 @@ describe('Application life cycle test', function () {
it('can get app information', getAppInfo);
it('can admin login', login.bind(null, 'minioadmin', 'minioadmin'));
it('can admin login', login.bind(null, 'minioadmin', 'minioadmin', false));
it('can add bucket', addBucket);
it('can logout', logout);
it('does redirect', checkRedirect);
@ -177,7 +178,7 @@ describe('Application life cycle test', function () {
await timers.setTimeout(10000);
});
it('can admin login', login.bind(null, 'minioakey', 'minioskey'));
it('can admin login', login.bind(null, 'minioakey', 'minioskey', false));
it('has bucket', checkBucket);
it('can logout', logout);
it('does redirect', checkRedirect);
@ -265,29 +266,26 @@ describe('Application life cycle test', function () {
it('can install app for update', function () { execSync('cloudron install --appstore-id io.minio.cloudronapp --location ' + LOCATION, EXEC_ARGS); });
it('can get app information', getAppInfo);
it('can login', login.bind(null, 'minioadmin', 'minioadmin'));
it('can get admin credentials', getAdminCredentials);
it('can admin login', async function () { await login('minioadmin', rootPassword); });
it('can add buckets', addBucket);
it('can logout', logout);
/* should be added on the next release
it('can OIDC login', loginOIDC.bind(null, username, password));
it('has bucket', checkBucket);
it('can logout', logout);
*/
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 get app information', getAppInfo);
it('can admin login', login.bind(null, 'minioadmin', 'minioadmin'));
it('can admin login', async function () { await login('minioadmin', rootPassword); });
it('has bucket', checkBucket);
it('can logout', logout);
/* should be added on the next release
it('can OIDC login', loginOIDC.bind(null, username, password));
it('has bucket', checkBucket);
it('can logout', logout);
*/
it('does redirect', checkRedirect);
it('check api', checkApi);