How can I test the show/hide password functionality on an android App

Hi everybody,

On real android device, my App under test offers the functionality to show / hide password on login screen.

I already write the java code to click the show / hide password button:
Helper.waitVisibilityOfElement(By.id(TestSignUpElements.showHideButtonId)).click();
But I wonder how can I check that the password is is plain language or masked?

My actual failed code:
//Check that the password is masked => failed
Assert.assertFalse(Helper.waitVisibilityOfElement(By.id(TestSignUpElements.passwordTextRowId)).isDisplayed());
//Click the show password button
Helper.waitVisibilityOfElement(By.id(TestSignUpElements.showHideButtonId)).click();
//Check that the password is in plain language
Assert.assertTrue(Helper.waitVisibilityOfElement(By.id(TestSignUpElements.passwordTextRowId)).isDisplayed());

Thank you for your help

Get the password from password field and match it with the text you have entered. If the text matches password is visible.

1 Like

Thanks, it’s worked perfectly.