Fixup test for real login form

This commit is contained in:
Johannes Zellner 2023-11-13 15:54:18 +01:00
parent daccdb9237
commit 9805180643
1 changed files with 17 additions and 16 deletions

View File

@ -50,17 +50,17 @@ describe('Application life cycle test', function () {
await browser.wait(until.elementIsVisible(browser.findElement(elem)), TEST_TIMEOUT); await browser.wait(until.elementIsVisible(browser.findElement(elem)), TEST_TIMEOUT);
} }
async function invalidPassword() { async function login() {
const result = await superagent.get('https://' + app.fqdn).auth(username, password + 'x').ok(() => true); await browser.manage().deleteAllCookies();
expect(result.statusCode).to.eql(401); await browser.get('https://' + app.fqdn);
await waitForElement(By.id('user'));
await browser.findElement(By.id('user')).sendKeys(username);
await browser.findElement(By.id('password')).sendKeys(password);
await browser.findElement(By.xpath('//button[@type="submit"]')).click();
await waitForElement(By.xpath('//span[text()="Actions"]'));
} }
async function loadPage() { async function loadPage() {
await browser.manage().deleteAllCookies();
await browser.sleep(5000);
await browser.get('https://' + username + ':' + encodeURIComponent(password) + '@' + app.fqdn);
await browser.get('https://' + app.fqdn);
await browser.sleep(5000);
await browser.get('https://' + app.fqdn); await browser.get('https://' + app.fqdn);
await waitForElement(By.xpath('//span[text()="Actions"]')); await waitForElement(By.xpath('//span[text()="Actions"]'));
} }
@ -86,36 +86,36 @@ describe('Application life cycle test', function () {
xit('build app', function () { execSync('cloudron build', EXEC_ARGS); }); xit('build app', function () { execSync('cloudron build', EXEC_ARGS); });
it('install app', async function () { it('install app', function () { execSync('cloudron install --port-bindings SYNC_PORT=' + SYNC_PORT + ' --location ' + LOCATION, EXEC_ARGS); });
execSync('cloudron install --port-bindings SYNC_PORT=' + SYNC_PORT + ' --location ' + LOCATION, EXEC_ARGS); // await timers.setTimeout(30000);
await timers.setTimeout(30000);
});
it('can get app information', getAppInfo); it('can get app information', getAppInfo);
it('fails with invalid password', invalidPassword); it('can login', login);
it('can load page', loadPage); it('can load page', loadPage);
it('can add folder', addFolder); it('can add folder', addFolder);
it('backup app', async function () { it('backup app', async function () {
execSync('cloudron backup create --app ' + app.id, EXEC_ARGS); execSync('cloudron backup create --app ' + app.id, EXEC_ARGS);
await timers.setTimeout(30000); // await timers.setTimeout(30000);
}); });
it('restore app', async function () { it('restore app', async function () {
await browser.get('about:blank'); await browser.get('about:blank');
execSync('cloudron restore --app ' + app.id, EXEC_ARGS); execSync('cloudron restore --app ' + app.id, EXEC_ARGS);
await timers.setTimeout(30000); await timers.setTimeout(5000);
}); });
it('can login', login);
it('can load page', loadPage); it('can load page', loadPage);
it('can check folder', checkFolder); it('can check folder', checkFolder);
it('move to different location', async function () { it('move to different location', async function () {
await browser.get('about:blank'); await browser.get('about:blank');
execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS); execSync(`cloudron configure --location ${LOCATION}2 --app ${app.id}`, EXEC_ARGS);
await timers.setTimeout(30000); await timers.setTimeout(5000);
}); });
it('can get app information', getAppInfo); it('can get app information', getAppInfo);
it('can login', login);
it('can load page', loadPage); it('can load page', loadPage);
it('can check folder', checkFolder); it('can check folder', checkFolder);
@ -130,6 +130,7 @@ describe('Application life cycle test', function () {
await timers.setTimeout(30000); await timers.setTimeout(30000);
}); });
it('can get app information', getAppInfo); it('can get app information', getAppInfo);
it('can login', login);
it('can load page', loadPage); it('can load page', loadPage);
it('can add folder', addFolder); it('can add folder', addFolder);
it('can update', async function () { it('can update', async function () {