Fixup tests

This commit is contained in:
Johannes Zellner 2024-05-10 14:48:19 +02:00
parent b39c9a97fc
commit dd9acc3618

View file

@ -56,18 +56,29 @@ describe('Application life cycle test', function () {
expect(app).to.be.an('object'); expect(app).to.be.an('object');
} }
async function login() { async function login(session = true) {
await browser.get(`https://${app.fqdn}`); await browser.get(`https://${app.fqdn}`);
await waitForElement(By.id('inputUsername')); await waitForElement(By.id('loginProceedButton'));
await browser.findElement(By.id('inputUsername')).sendKeys(username); await browser.findElement(By.id('loginProceedButton')).click();
await browser.findElement(By.id('inputPassword')).sendKeys(password);
await browser.findElement(By.id('loginSubmitButton')).click(); if (!session) {
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 waitForElement(By.xpath('//a[text()="Alerts"]')); await waitForElement(By.xpath('//a[text()="Alerts"]'));
} }
async function logout() { async function logout() {
await browser.get(`https://${app.fqdn}/logout`); await browser.get(`https://${app.fqdn}/logout`);
await waitForElement(By.xpath('//input[@name="username"]')); await waitForElement(By.id('loginProceedButton'));
}
async function loadApp() {
await browser.get(`https://${app.fqdn}`);
await waitForElement(By.xpath('//a[text()="Alerts"]'));
} }
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); }); xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
@ -75,12 +86,12 @@ describe('Application life cycle test', function () {
it('can get app information', getAppInfo); it('can get app information', getAppInfo);
it('can login', login); it('can login', login.bind(null, false));
it('can logout', logout); it('can load app', loadApp);
it('can restart app', function () { execSync(`cloudron restart --app ${app.id}`, EXEC_ARGS); }); it('can restart app', function () { execSync(`cloudron restart --app ${app.id}`, EXEC_ARGS); });
it('can login', login);
it('can logout', logout); it('can load app', loadApp);
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', function () { it('restore app', function () {
@ -91,13 +102,13 @@ describe('Application life cycle test', function () {
execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, EXEC_ARGS); execSync(`cloudron restore --backup ${backups[0].id} --app ${app.id}`, EXEC_ARGS);
}); });
it('can login', login); it('can load app', loadApp);
it('can logout', logout);
it('move to different location', function () { execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS); }); it('move to different location', function () { execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS); });
it('can get app information', getAppInfo); it('can get app information', getAppInfo);
it('can login', login); it('can login', login);
it('can load app', loadApp);
it('can logout', logout); it('can logout', logout);
it('uninstall app', function () { execSync(`cloudron uninstall --app ${app.id}`, EXEC_ARGS); }); it('uninstall app', function () { execSync(`cloudron uninstall --app ${app.id}`, EXEC_ARGS); });
@ -105,9 +116,15 @@ describe('Application life cycle test', function () {
// test update // test update
it('can install app', function () { execSync(`cloudron install --appstore-id io.prometheus.cloudronapp --location ${LOCATION}`, EXEC_ARGS); }); it('can install app', function () { execSync(`cloudron install --appstore-id io.prometheus.cloudronapp --location ${LOCATION}`, EXEC_ARGS); });
it('can get app information', getAppInfo); it('can get app information', getAppInfo);
// it('can login', login);
it('can load app', loadApp);
it('can update', function () { execSync(`cloudron update --app ${app.id}`, EXEC_ARGS); }); it('can update', function () { execSync(`cloudron update --app ${app.id}`, EXEC_ARGS); });
it('can login', login);
it('can load app', loadApp);
it('can logout', logout); it('can logout', logout);
it('uninstall app', function () { execSync(`cloudron uninstall --app ${app.id}`, EXEC_ARGS); }); it('uninstall app', function () { execSync(`cloudron uninstall --app ${app.id}`, EXEC_ARGS); });
}); });