fix oidc login

This commit is contained in:
Girish Ramakrishnan 2024-12-22 16:09:54 +01:00
parent 716480882c
commit a4371d0283

View file

@ -37,7 +37,6 @@ describe('Application life cycle test', function () {
let username = process.env.USERNAME;
let password = process.env.PASSWORD;
let email = process.env.EMAIL;
let athenticated_by_oidc = false;
before(function () {
const chromeOptions = new Options().windowSize({ width: 1280, height: 1024 });
@ -102,7 +101,7 @@ describe('Application life cycle test', function () {
await waitForElement(By.xpath('//a[contains(@href, "/my-library")]'));
}
async function loginOIDC(username, password) {
async function loginOIDC(username, password, alreadyAuthenticated = false) {
browser.manage().deleteAllCookies();
await browser.get(`https://${app.fqdn}/login`);
await browser.sleep(2000);
@ -111,13 +110,11 @@ describe('Application life cycle test', function () {
await browser.findElement(By.xpath('//a[contains(., "Cloudron")]')).click();
await browser.sleep(2000);
if (!athenticated_by_oidc) {
if (!alreadyAuthenticated) {
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();
athenticated_by_oidc = true;
}
await browser.sleep(20000);
await waitForElement(By.xpath('//a[contains(@href, "/my-library")]'));