From 33135d2354002a6846d03e2efc36ba7316002244 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Mon, 9 Dec 2024 09:57:55 +0100 Subject: [PATCH] Fix test --- test/test.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/test.js b/test/test.js index ba1a57c..5316619 100755 --- a/test/test.js +++ b/test/test.js @@ -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);