diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/BitbucketLoginPage.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/BitbucketLoginPage.java index 4f1392d817..a7ac7a30b0 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/BitbucketLoginPage.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/BitbucketLoginPage.java @@ -18,25 +18,40 @@ package org.keycloak.testsuite.pages.social; import org.openqa.selenium.Keys; +import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; +import static org.keycloak.testsuite.util.UIUtils.clickLink; +import static org.keycloak.testsuite.util.WaitUtils.pause; + /** * @author Vaclav Muzikar */ public class BitbucketLoginPage extends AbstractSocialLoginPage { - @FindBy(name = "username") + @FindBy(id = "username") private WebElement usernameInput; - @FindBy(name = "password") + @FindBy(id = "password") private WebElement passwordInput; - @FindBy(name = "commit") - private WebElement loginButton; + @FindBy(xpath = "//div[contains(@class,'additional-auths')]/p/a") + private WebElement loginWithAtlassianButton; @Override public void login(String user, String password) { + try { + clickLink(loginWithAtlassianButton); // BitBucket no longer has it's own login page yet sometimes it's + // displayed even though we need to use the Atlassian login page + } + catch (NoSuchElementException e) { + log.info("Already on Atlassian login page"); + } + usernameInput.sendKeys(user); + usernameInput.sendKeys(Keys.RETURN); + pause(1000); + passwordInput.sendKeys(password); passwordInput.sendKeys(Keys.RETURN); } diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/PayPalLoginPage.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/PayPalLoginPage.java index 4f98213c8d..c935b152d3 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/PayPalLoginPage.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/pages/social/PayPalLoginPage.java @@ -21,6 +21,8 @@ import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; +import static org.keycloak.testsuite.util.UIUtils.clickLink; + /** * @author Petter Lysne (petterlysne at hotmail dot com) */ @@ -34,6 +36,9 @@ public class PayPalLoginPage extends AbstractSocialLoginPage { @FindBy(name = "btnLogin") private WebElement loginButton; + @FindBy(name = "btnNext") + private WebElement nextButton; + @FindBy(name = "continueLogin") private WebElement continueLoginButton; @@ -42,11 +47,20 @@ public class PayPalLoginPage extends AbstractSocialLoginPage { try { usernameInput.clear(); // to remove pre-filled email usernameInput.sendKeys(user); + + try { + clickLink(nextButton); // sometimes the login process is just a one step, + // sometimes it's two steps so we need to click the 'Next' button + } + catch (NoSuchElementException e) { + // one step login process, no need to click the 'Next' button + } + passwordInput.sendKeys(password); - loginButton.click(); + clickLink(loginButton); } catch (NoSuchElementException e) { - continueLoginButton.click(); // already logged in, just need to confirm it + clickLink(continueLoginButton); // already logged in, just need to confirm it } } }