diff --git a/mobile/android/base/tests/testMasterPassword.java.in b/mobile/android/base/tests/testMasterPassword.java.in index 2c9b0ed246b..41bfc1739c6 100644 --- a/mobile/android/base/tests/testMasterPassword.java.in +++ b/mobile/android/base/tests/testMasterPassword.java.in @@ -30,12 +30,12 @@ public class testMasterPassword extends PixelTest { // Look for the 'Settings' menu if this device/OS uses it selectMenuItem("Settings"); if (dev.type.equals("tablet")) { - mSolo.waitForText("Privacy & Security"); + waitForText("Privacy & Security"); mSolo.clickOnText("Privacy & Security"); } - mSolo.waitForText("^Use master password$"); + waitForText("^Use master password$"); mSolo.clickOnText("^Use master password$"); - mSolo.waitForText("^Create Master Password$"); + waitForText("^Create Master Password$"); // Verify that the OK button is not activated until both fields are filled closeTabletKeyboard(); @@ -59,9 +59,9 @@ public class testMasterPassword extends PixelTest { mSolo.clearEditText(1); mSolo.clickOnEditText(1); mActions.sendKeys(password); - mSolo.waitForText("^Cancel$"); + waitForText("^Cancel$"); mSolo.clickOnText("^Cancel$"); - mSolo.waitForText("^Use master password$"); + waitForText("^Use master password$"); mSolo.clickOnText("^Use master password$"); mAsserter.ok(mSolo.waitForText("^Create Master Password$"), "Checking if no password was set if the action was canceled", "No password was set"); @@ -72,16 +72,15 @@ public class testMasterPassword extends PixelTest { mActions.sendKeys(password); // Verify that the input characters are converted to dots automatically - mAsserter.ok(mSolo.waitForText("."), "waiting to convert the letters in dots", "The letters are converted in dots"); + mAsserter.ok(waitForText("."), "waiting to convert the letters in dots", "The letters are converted in dots"); mSolo.clickOnButton("OK"); // Verify that the Master Password was set - mSolo.waitForText("^Use master password$"); + waitForText("^Use master password$"); mSolo.clickOnText("^Use master password$"); mAsserter.ok(mSolo.searchText("Remove Master Password"), "Checking if the password is enabled", "The password is enabled"); - closeTabletKeyboard(); - mActions.sendSpecialKey(Actions.SpecialKey.BACK); // Go back to settings menu - mSolo.waitForText("^Settings$"); + clickOnButton("Cancel"); // Go back to settings menu + waitForText("^Settings$"); mActions.sendSpecialKey(Actions.SpecialKey.BACK);// Close the Settings Menu } @@ -90,12 +89,12 @@ public class testMasterPassword extends PixelTest { // Look for the 'Settings' menu if this device/OS uses it selectMenuItem("Settings"); if (dev.type.equals("tablet")) { - mSolo.waitForText("Privacy & Security"); + waitForText("Privacy & Security"); mSolo.clickOnText("Privacy & Security"); } - mSolo.waitForText("^Use master password$"); + waitForText("^Use master password$"); mSolo.clickOnText("^Use master password$"); - mSolo.waitForText("^Remove Master Password$"); + waitForText("^Remove Master Password$"); // Verify that the OK button is not activated if the password field is empty closeTabletKeyboard(); @@ -115,11 +114,10 @@ public class testMasterPassword extends PixelTest { mSolo.clickOnButton("OK"); // Verify that the Master Password was disabled - mSolo.waitForText("^Use master password$"); + waitForText("^Use master password$"); mSolo.clickOnText("^Use master password$"); - mAsserter.ok(mSolo.waitForText("^Create Master Password$"), "Checking if the password is disabled", "The password is disabled"); - toggleVKB(); // Close the VKB - mActions.sendSpecialKey(Actions.SpecialKey.BACK); // Close the Master Password menu + mAsserter.ok(waitForText("^Create Master Password$"), "Checking if the password is disabled", "The password is disabled"); + clickOnButton("Cancel"); // Go back to settings menu } public void editPasswordField(int i, String password) { @@ -131,7 +129,7 @@ public class testMasterPassword extends PixelTest { public void noDoorhangerDisplayed(String LOGIN_URL) { mSolo.waitForText("Browser Blank Page 01 | Enter Search or Address"); loadUrl(LOGIN_URL); - mAsserter.is(mSolo.waitForText("Save password for"), false, "Doorhanger notification is hidden"); + mAsserter.is(waitForText("Save password for"), false, "Doorhanger notification is hidden"); } public void doorhangerDisplayed(String LOGIN_URL) { @@ -153,25 +151,37 @@ public class testMasterPassword extends PixelTest { // Look for the 'Settings' menu if this device/OS uses it selectMenuItem("Settings"); if (dev.type.equals("tablet")) { - mSolo.waitForText("Privacy & Security"); + waitForText("Privacy & Security"); mSolo.clickOnText("Privacy & Security"); } // Clear private data - mSolo.waitForText("^Clear private data$"); + waitForText("^Clear private data$"); mSolo.clickOnText("^Clear private data$"); - mSolo.waitForText("^Clear data$"); - mSolo.clickOnText("^Clear data$"); - mAsserter.ok(mSolo.waitForText("^Private data cleared$"), "Waiting for private data to be cleared", "Private data is cleared"); + waitForText("Browsing & download history"); // Make sure the Clear private data pop-up is displayed + Actions.EventExpecter clearPrivateDataEventExpecter = mActions.expectGeckoEvent("Sanitize:Finished"); + if (mSolo.searchText("Clear data") && !mSolo.searchText("Cookies")) { + mSolo.clickOnText("^Clear data$"); + clearPrivateDataEventExpecter.blockForEvent(); + } else { // For some reason the pop-up was not opened + if (mSolo.searchText("Cookies")) { + mSolo.clickOnText("^Clear private data$"); + waitForText("Browsing & download history"); // Make sure the Clear private data pop-up is displayed + mSolo.clickOnText("^Clear data$"); + clearPrivateDataEventExpecter.blockForEvent(); + } else { + mAsserter.ok(false, "Something happened and the clear data dialog could not be opened", "Failed to clear data"); + } + } // Check that the Master Password isn't disabled by clearing private data - mSolo.waitForText("^Use master password$"); + waitForText("^Use master password$"); mSolo.clickOnText("^Use master password$"); mAsserter.ok(mSolo.searchText("^Remove Master Password$"), "Checking if the master password was disabled by clearing private data", "The master password is not disabled by clearing private data"); - closeTabletKeyboard(); - mActions.sendSpecialKey(Actions.SpecialKey.BACK);// Close the Master Password menu - mSolo.waitForText("^Settings$"); + clickOnButton("Cancel"); // Close the Master Password menu + waitForText("^Settings$"); mActions.sendSpecialKey(Actions.SpecialKey.BACK);// Close the Settings Menu + waitForText("Browser Blank Page 01"); // Make sure the Settings Menu has been closed } public void verifyLoginPage(String password, String badPassword) { @@ -206,7 +216,7 @@ public class testMasterPassword extends PixelTest { mSolo.clickOnButton(item); doorhangerDisplayed(LOGIN_URL);// Check that the doorhanger is displayed again mSolo.clickOnButton(item); - mSolo.waitForText("Browser Blank Page 01"); + waitForText("Browser Blank Page 01"); } } }