This commit is contained in:
Girish Ramakrishnan 2024-12-09 09:57:55 +01:00
parent 4372579bff
commit 33135d2354
1 changed files with 4 additions and 8 deletions

View File

@ -29,7 +29,6 @@ describe('Application life cycle test', function () {
const SSH_PORT = 29420;
let app, browser;
let athenticated_by_oidc = false;
const repodir = '/tmp/testrepo';
const reponame = 'testrepo';
@ -108,24 +107,21 @@ describe('Application life cycle test', function () {
await login('root', 'changeme');
}
async function loginOIDC(username, password) {
async function loginOIDC(username, password, alreadyAuthenticated = true) {
browser.manage().deleteAllCookies();
await browser.get(`https://${app.fqdn}/user/login`);
await browser.sleep(2000);
await browser.findElement(By.xpath('//a[contains(@class, "openidConnect") and contains(., "Sign in with cloudron")]')).click();
await browser.findElement(By.xpath('//a[contains(@href, "/user/oauth2/Cloudron")]')).click();
await browser.sleep(2000);
if (!athenticated_by_oidc) {
if (!alreadyAuthenticated) {
await waitForElement(By.xpath('//input[@name="username"]'));
await browser.findElement(By.xpath('//input[@name="username"]')).sendKeys(username);
await browser.findElement(By.xpath('//input[@name="password"]')).sendKeys(password);
await browser.sleep(2000);
await browser.findElement(By.id('loginSubmitButton')).click();
await browser.sleep(2000);
athenticated_by_oidc = true;
}
await waitForElement(By.xpath('//img[contains(@class, "avatar")]'));
@ -219,7 +215,7 @@ describe('Application life cycle test', function () {
it('can send mail', sendMail);
it('can logout', logout);
it('can login', loginOIDC.bind(null, username, password));
it('can login', loginOIDC.bind(null, username, password, false));
it('can set avatar', setAvatar);
it('can get avatar', checkAvatar);