96 lines
3.0 KiB
JavaScript
Executable File
96 lines
3.0 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import { app, clearCache, click, cloudronCli, goto, loginOIDC, sendKeys, setupBrowser, takeScreenshot, teardownBrowser, waitFor } from '@cloudron/charlie';
|
|
|
|
/* global it, describe, before, after, afterEach */
|
|
|
|
describe('Application life cycle test', function () {
|
|
|
|
before(setupBrowser);
|
|
after(teardownBrowser);
|
|
|
|
afterEach(async function () {
|
|
await takeScreenshot(this.currentTest);
|
|
});
|
|
|
|
async function checkRegistrationClosed() {
|
|
await goto(`https://${app.fqdn}`, 'Create account');
|
|
await click('Create account');
|
|
await waitFor(/is currently not possible/);
|
|
}
|
|
|
|
async function login(addr, pass) {
|
|
await goto(`https://${app.fqdn}/auth/sign_in`, 'Log in');
|
|
await sendKeys('label=E-mail address', addr);
|
|
await sendKeys('label=Password', pass);
|
|
await click('Log in');
|
|
}
|
|
|
|
async function loginOidc() {
|
|
await goto(`https://${app.fqdn}/auth/sign_in`, 'Cloudron');
|
|
await click('Cloudron');
|
|
await loginOIDC(/Bookmarks|Successfully authenticated from Cloudron account\./);
|
|
}
|
|
|
|
async function checkTimeline() {
|
|
await goto(`https://${app.fqdn}/home`, /Your home timeline is empty/);
|
|
}
|
|
|
|
// No SSO
|
|
it('install app (no sso)', function () { cloudronCli.install({ noSso: true }); });
|
|
|
|
it('has registration closed', checkRegistrationClosed);
|
|
let testPassword;
|
|
it('create a user with CLI', function () {
|
|
const output = cloudronCli.exec('bin/tootctl accounts create test --email=test@cloudron.io').toString();
|
|
console.log(output);
|
|
testPassword = output.slice(output.indexOf('New password: ') + 'New password: '.length).trim();
|
|
console.log(testPassword);
|
|
});
|
|
|
|
it('can login (no sso)', async function () {
|
|
await login('test@cloudron.io', testPassword);
|
|
});
|
|
|
|
it('shows confirmation page', async function () {
|
|
await waitFor('Check your inbox');
|
|
});
|
|
|
|
it('uninstall app (no sso)', cloudronCli.uninstall);
|
|
|
|
// SSO
|
|
it('install app (sso)', cloudronCli.install);
|
|
|
|
it('registration is disabled', checkRegistrationClosed);
|
|
it('can OIDC login', loginOidc);
|
|
it('can see timeline', checkTimeline);
|
|
it('can logout', clearCache);
|
|
|
|
it('backup app', cloudronCli.createBackup);
|
|
it('restore app', cloudronCli.restoreFromLatestBackup);
|
|
|
|
it('can OIDC login', loginOidc);
|
|
it('can see timeline', checkTimeline);
|
|
|
|
it('can restart app', cloudronCli.restart);
|
|
it('can see timeline', checkTimeline);
|
|
|
|
it('move to different location', cloudronCli.changeLocation);
|
|
|
|
it('can OIDC login', loginOidc);
|
|
it('can see timeline', checkTimeline);
|
|
|
|
it('uninstall app', cloudronCli.uninstall);
|
|
|
|
// test update
|
|
it('can install app for update', cloudronCli.appstoreInstall);
|
|
it('can OIDC login', loginOidc);
|
|
it('can logout', clearCache);
|
|
|
|
it('can update', cloudronCli.update);
|
|
|
|
it('can OIDC login', loginOidc);
|
|
|
|
it('uninstall app', cloudronCli.uninstall);
|
|
});
|