Bug 1088220 - Update tests with new strings. r=margaret

--HG--
rename : mobile/android/base/tests/robocop_login.html => mobile/android/base/tests/robocop_login_01.html
rename : mobile/android/base/tests/robocop_login.html => mobile/android/base/tests/robocop_login_02.html
extra : rebase_source : 0b837de9391803f191f6070a4fd70d7af065d48b
This commit is contained in:
Chenxia Liu 2015-03-25 17:29:01 -07:00
parent 3b2de6bae9
commit 76802c79b4
6 changed files with 45 additions and 26 deletions

View File

@ -5,7 +5,6 @@
package org.mozilla.gecko.tests;
public class StringHelper {
private StringHelper() {}
@ -55,6 +54,7 @@ public class StringHelper {
public static final String CONTEXT_MENU_REMOVE = "Remove";
public static final String CONTEXT_MENU_COPY_ADDRESS = "Copy Address";
public static final String CONTEXT_MENU_EDIT_SITE_SETTINGS = "Edit Site Settings";
public static final String CONTEXT_MENU_SITE_SETTINGS_SAVE_PASSWORD = "Save Password";
public static final String CONTEXT_MENU_ADD_TO_HOME_SCREEN = "Add to Home Screen";
public static final String CONTEXT_MENU_PIN_SITE = "Pin Site";
public static final String CONTEXT_MENU_UNPIN_SITE = "Unpin Site";
@ -105,7 +105,8 @@ public class StringHelper {
public static final String ROBOCOP_BLANK_PAGE_05_URL = "/robocop/robocop_blank_05.html";
public static final String ROBOCOP_BOXES_URL = "/robocop/robocop_boxes.html";
public static final String ROBOCOP_GEOLOCATION_URL = "/robocop/robocop_geolocation.html";
public static final String ROBOCOP_LOGIN_URL = "/robocop/robocop_login.html";
public static final String ROBOCOP_LOGIN_01_URL= "/robocop/robocop_login_01.html";
public static final String ROBOCOP_LOGIN_02_URL= "/robocop/robocop_login_02.html";
public static final String ROBOCOP_POPUP_URL = "/robocop/robocop_popup.html";
public static final String ROBOCOP_OFFLINE_STORAGE_URL = "/robocop/robocop_offline_storage.html";
public static final String ROBOCOP_PICTURE_LINK_URL = "/robocop/robocop_picture_link.html";
@ -263,9 +264,9 @@ public class StringHelper {
public static final String OFFLINE_ALLOW = "Allow";
public static final String OFFLINE_DENY = "Don't allow";
public static final String LOGIN_MESSAGE = "Save password";
public static final String LOGIN_ALLOW = "Save";
public static final String LOGIN_DENY = "Don't save";
public static final String LOGIN_MESSAGE = "Would you like " + BRAND_NAME + " to remember this login?";
public static final String LOGIN_ALLOW = "Remember";
public static final String LOGIN_DENY = "Never";
public static final String POPUP_MESSAGE = "prevented this site from opening";
public static final String POPUP_ALLOW = "Show";

View File

@ -1,8 +1,8 @@
<html>
<script>
function login(){
document.login.username.value="Test";
document.login.password.value="Test";
document.login.username.value="Test1";
document.login.password.value="Test2";
document.getElementById('submit').click();
}
</script>

View File

@ -0,0 +1,21 @@
<html>
<script>
function login(){
document.login.username.value="Test2";
document.login.password.value="Test2";
document.getElementById('submit').click();
}
</script>
<head>
<title>Robocop Login</title>
<meta charset="utf-8">
</head>
<body onload="login()">
<h2>User Login </h2>
<form name="login" method="post" action="robocop_blank_02.html">
Username: <input type="text" name="username" id="username"><br>
Password: <input type="password" name="password" id="password"><br>
<input type="submit" id="submit" name="submit" value="Login!">
</form>
</body>
</html>

View File

@ -78,12 +78,12 @@ public class testClearPrivateData extends PixelTest {
}
public void clearPassword(){
String passwordStrings[] = {"Save password", "Save", "Don't save"};
String passwordStrings[] = { StringHelper.LOGIN_MESSAGE, StringHelper.LOGIN_ALLOW, StringHelper.LOGIN_DENY };
String title = StringHelper.ROBOCOP_BLANK_PAGE_01_TITLE;
String loginUrl = getAbsoluteUrl(StringHelper.ROBOCOP_LOGIN_URL);
String loginUrl = getAbsoluteUrl(StringHelper.ROBOCOP_LOGIN_01_URL);
loadCheckDismiss(passwordStrings[1], loginUrl, passwordStrings[0]);
checkOption(passwordStrings[1], "Clear");
checkOption(StringHelper.CONTEXT_MENU_SITE_SETTINGS_SAVE_PASSWORD, "Clear");
loadCheckDismiss(passwordStrings[2], loginUrl, passwordStrings[0]);
checkDevice(title, getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL));
}

View File

@ -24,7 +24,6 @@ public class testDoorHanger extends BaseTest {
String GEO_URL = getAbsoluteUrl(StringHelper.ROBOCOP_GEOLOCATION_URL);
String BLANK_URL = getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL);
String OFFLINE_STORAGE_URL = getAbsoluteUrl(StringHelper.ROBOCOP_OFFLINE_STORAGE_URL);
String LOGIN_URL = getAbsoluteUrl(StringHelper.ROBOCOP_LOGIN_URL);
blockForGeckoReady();
@ -63,7 +62,6 @@ public class testDoorHanger extends BaseTest {
mAsserter.is(mSolo.searchText(GEO_MESSAGE), false, "Geolocation doorhanger notification is hidden when opening a new tab");
*/
boolean offlineAllowedByDefault = true;
// Save offline-allow-by-default preferences first
final String[] prefNames = { "offline-apps.allow_by_default" };
@ -130,25 +128,24 @@ public class testDoorHanger extends BaseTest {
mAsserter.ok(false, "exception setting preference", e.toString());
}
// Load login page
loadUrlAndWait(LOGIN_URL);
// Load new login page
loadUrlAndWait(getAbsoluteUrl(StringHelper.ROBOCOP_LOGIN_01_URL));
waitForText(StringHelper.LOGIN_MESSAGE);
// Test doorhanger is dismissed when tapping "Don't save"
mSolo.clickOnButton(StringHelper.LOGIN_DENY);
waitForTextDismissed(StringHelper.LOGIN_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.LOGIN_MESSAGE), false, "Login doorhanger notification is hidden when denying saving password");
// Load login page
loadUrlAndWait(LOGIN_URL);
waitForText(StringHelper.LOGIN_MESSAGE);
// Test doorhanger is dismissed when tapping "Save" and is no longer triggered
// Test doorhanger is dismissed when tapping "Remember".
mSolo.clickOnButton(StringHelper.LOGIN_ALLOW);
waitForTextDismissed(StringHelper.LOGIN_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.LOGIN_MESSAGE), false, "Login doorhanger notification is hidden when allowing saving password");
// Load login page
loadUrlAndWait(getAbsoluteUrl(StringHelper.ROBOCOP_LOGIN_02_URL));
waitForText(StringHelper.LOGIN_MESSAGE);
// Test doorhanger is dismissed when tapping "Never".
mSolo.clickOnButton(StringHelper.LOGIN_DENY);
waitForTextDismissed(StringHelper.LOGIN_MESSAGE);
mAsserter.is(mSolo.searchText(StringHelper.LOGIN_MESSAGE), false, "Login doorhanger notification is hidden when denying saving password");
testPopupBlocking();
}

View File

@ -180,7 +180,7 @@ public class testMasterPassword extends PixelTest {
}
public void verifyLoginPage(String password, String badPassword) {
String LOGIN_URL = getAbsoluteUrl("/robocop/robocop_login.html");
String LOGIN_URL = getAbsoluteUrl(StringHelper.ROBOCOP_LOGIN_01_URL);
String option [] = {"Save", "Don't save"};
doorhangerDisplayed(LOGIN_URL);// Check that the doorhanger is displayed