From f9386bd62b3f11dc7a93cd8406d4087d87ea2534 Mon Sep 17 00:00:00 2001 From: wojnarfilip Date: Mon, 18 Sep 2023 12:59:36 +0200 Subject: [PATCH] Update login flow in OCP social login --- .../testsuite/pages/social/OpenShiftLoginPage.java | 13 +++++++++++++ .../keycloak/testsuite/broker/SocialLoginTest.java | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/OpenShiftLoginPage.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/OpenShiftLoginPage.java index 055bf8e2f3..a883994697 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/OpenShiftLoginPage.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/OpenShiftLoginPage.java @@ -17,6 +17,7 @@ package org.keycloak.testsuite.pages.social; +import org.keycloak.testsuite.util.WaitUtils; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.NoSuchElementException; @@ -35,6 +36,9 @@ public class OpenShiftLoginPage extends AbstractSocialLoginPage { @FindBy(name = "password") private WebElement passwordInput; + @FindBy(name = "approve") + private WebElement authorizeButton; + private String userLoginLinkTitle; private WebElement userLoginLink; @@ -48,9 +52,18 @@ public class OpenShiftLoginPage extends AbstractSocialLoginPage { } } + WaitUtils.pause(3000); usernameInput.sendKeys(user); passwordInput.sendKeys(password); passwordInput.sendKeys(Keys.RETURN); + + try { + WaitUtils.pause(3000); + authorizeButton.click(); + } + catch (NoSuchElementException e) { + log.info("User already allowed in the app"); + } } public void setUserLoginLinkTitle(String title) { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/SocialLoginTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/SocialLoginTest.java index 539c20da2c..85f8ebe4e1 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/SocialLoginTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/SocialLoginTest.java @@ -250,7 +250,7 @@ public class SocialLoginTest extends AbstractKeycloakTest { public void openshiftLogin() { setTestProvider(OPENSHIFT); performLogin(); - assertUpdateProfile(false, false, true); + assertUpdateProfile(true, true, true); appPage.assertCurrent(); testTokenExchange(); }