Fixup test for real login form

master
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);
}
async function invalidPassword() {
const result = await superagent.get('https://' + app.fqdn).auth(username, password + 'x').ok(() => true);
expect(result.statusCode).to.eql(401);
async function login() {
await browser.manage().deleteAllCookies();
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() {
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 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); });
it('install app', async function () {
execSync('cloudron install --port-bindings SYNC_PORT=' + SYNC_PORT + ' --location ' + LOCATION, EXEC_ARGS);
await timers.setTimeout(30000);
});
it('install app', function () { execSync('cloudron install --port-bindings SYNC_PORT=' + SYNC_PORT + ' --location ' + LOCATION, EXEC_ARGS); });
// await timers.setTimeout(30000);
it('can get app information', getAppInfo);
it('fails with invalid password', invalidPassword);
it('can login', login);
it('can load page', loadPage);
it('can add folder', addFolder);
it('backup app', async function () {
execSync('cloudron backup create --app ' + app.id, EXEC_ARGS);
await timers.setTimeout(30000);
// await timers.setTimeout(30000);
});
it('restore app', async function () {
await browser.get('about:blank');
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 check folder', checkFolder);
it('move to different location', async function () {
await browser.get('about:blank');
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 login', login);
it('can load page', loadPage);
it('can check folder', checkFolder);
@ -130,6 +130,7 @@ describe('Application life cycle test', function () {
await timers.setTimeout(30000);
});
it('can get app information', getAppInfo);
it('can login', login);
it('can load page', loadPage);
it('can add folder', addFolder);
it('can update', async function () {