Created
September 13, 2024 12:54
-
-
Save SarahElson/a0dd9f6adc27cbf500dc3c193aafe6d7 to your computer and use it in GitHub Desktop.
How to Test Biometric Authentication With Appium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LoginPage { | |
private final AndroidDriver androidDriver; | |
private final WebDriverWait wait; | |
public LoginPage(final AndroidDriver androidDriver) { | |
this.androidDriver = androidDriver; | |
this.wait = new WebDriverWait(androidDriver, Duration.ofSeconds(10)); | |
} | |
private WebElement fingerPrintBtn() { | |
return this.androidDriver.findElement(AppiumBy.accessibilityId("button-biometric")); | |
} | |
private WebElement cancelBtnInAuthenticationView() { | |
return this.wait.until(ExpectedConditions.visibilityOfElementLocated(AppiumBy.accessibilityId("Tap to cancel authentication"))); | |
} | |
public void performBiometricLogin(final int fingerPrintId) { | |
fingerPrintBtn().click(); | |
cancelBtnInAuthenticationView().isDisplayed(); | |
this.androidDriver.fingerPrint(fingerPrintId); | |
} | |
public String getSuccessMessageTitle() { | |
return this.wait.until(ExpectedConditions.visibilityOfElementLocated(AppiumBy.id("android:id/alertTitle"))).getText(); | |
} | |
public String getSuccessMessageText () { | |
return this.androidDriver.findElement(AppiumBy.id("android:id/message")).getText(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment