Use sendKeys instead of click for the webauthn tests
Closes #33362 Closes #33037 Closes #32548 Signed-off-by: rmartinc <rmartinc@redhat.com>
This commit is contained in:
parent
54b6cd614c
commit
7a886aab64
4 changed files with 29 additions and 6 deletions
|
@ -24,6 +24,7 @@ import org.keycloak.testsuite.util.DroneUtils;
|
|||
import org.keycloak.testsuite.util.OAuthClient;
|
||||
import org.keycloak.testsuite.util.WaitUtils;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.Keys;
|
||||
import org.openqa.selenium.NoSuchElementException;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.chrome.ChromeDriver;
|
||||
|
@ -216,8 +217,7 @@ public class LoginPage extends LanguageComboboxAwarePage {
|
|||
}
|
||||
|
||||
public void clickRegister() {
|
||||
registerLink.click();
|
||||
WaitUtils.waitForPageToLoad();
|
||||
clickLink(registerLink);
|
||||
}
|
||||
|
||||
public void clickSocial(String alias) {
|
||||
|
|
|
@ -129,7 +129,7 @@ public class LoginTotpPage extends LanguageComboboxAwarePage {
|
|||
public void selectOtpCredential(String credentialName) {
|
||||
WebElement webElement = driver.findElement(
|
||||
getXPathForLookupCardWithName(credentialName));
|
||||
UIUtils.clickLink(webElement);
|
||||
UIUtils.click(webElement);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.openqa.selenium.TimeoutException;
|
|||
import org.openqa.selenium.WebDriver;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||
import org.openqa.selenium.interactions.Actions;
|
||||
import org.openqa.selenium.support.ui.ExpectedConditions;
|
||||
import org.openqa.selenium.support.ui.Select;
|
||||
import org.openqa.selenium.support.ui.WebDriverWait;
|
||||
|
@ -69,11 +68,35 @@ public final class UIUtils {
|
|||
performOperationWithPageReload(() -> getCurrentDriver().navigate().refresh());
|
||||
}
|
||||
|
||||
/**
|
||||
* The method executes click or sendKeys(Keys.ENTER) in the element.
|
||||
* In the chrome driver click is emulated by pressing the ENTER key. Since
|
||||
* the upgrade to chrome 128 some clicks are missed and that triggers CI
|
||||
* failures. The method is intended to be used for buttons and links which
|
||||
* accept clicking by pressing the ENTER key. If the element passed does
|
||||
* not allow clicking using keys use the {@link #click(WebElement) click}
|
||||
* method.
|
||||
*
|
||||
* @param element The element to click
|
||||
*/
|
||||
public static void clickLink(WebElement element) {
|
||||
WebDriver driver = getCurrentDriver();
|
||||
|
||||
waitUntilElement(element).is().clickable();
|
||||
|
||||
performOperationWithPageReload(BrowserDriverUtil.isDriverChrome(driver)
|
||||
? () -> element.sendKeys(Keys.ENTER)
|
||||
: element::click);
|
||||
}
|
||||
|
||||
/**
|
||||
* The method executes click in the element. This method always uses click and
|
||||
* is not emulated by key pressing in chrome.
|
||||
*
|
||||
* @param element The element to click
|
||||
*/
|
||||
public static void click(WebElement element) {
|
||||
waitUntilElement(element).is().clickable();
|
||||
performOperationWithPageReload(element::click);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.keycloak.testsuite.webauthn.pages.fragments;
|
|||
import org.openqa.selenium.WebElement;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.keycloak.testsuite.util.UIUtils.clickLink;
|
||||
import static org.keycloak.testsuite.util.UIUtils.click;
|
||||
import static org.keycloak.testsuite.util.UIUtils.getTextFromElement;
|
||||
import static org.keycloak.testsuite.util.UIUtils.isElementVisible;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public abstract class AbstractHeader extends AbstractFragmentWithMobileLayout {
|
|||
|
||||
protected void clickToolsBtn(WebElement btn) {
|
||||
clickOptions();
|
||||
clickLink(btn);
|
||||
click(btn);
|
||||
}
|
||||
|
||||
protected boolean isToolsBtnVisible(WebElement btn) {
|
||||
|
|
Loading…
Reference in a new issue