diff --git a/build/mobile/robocop/Actions.java b/build/mobile/robocop/Actions.java index ccea24276a69..d349c9a033e3 100644 --- a/build/mobile/robocop/Actions.java +++ b/build/mobile/robocop/Actions.java @@ -9,7 +9,17 @@ public interface Actions { /** Special keys supported by sendSpecialKey() */ public enum SpecialKey { - DOWN, UP, LEFT, RIGHT, ENTER, MENU, BACK + DOWN, + UP, + LEFT, + RIGHT, + ENTER, + MENU, + /** + * @deprecated Use Solo.goBack() in Robocop instead. + */ + @Deprecated + BACK } public interface EventExpecter { @@ -40,7 +50,7 @@ public interface Actions { /** * Sends an event to Gecko. - * + * * @param geckoEvent The geckoEvent JSONObject's type */ void sendGeckoEvent(String geckoEvent, String data); @@ -72,7 +82,7 @@ public interface Actions { * Listens for a gecko event to be sent from the Gecko instance. * The returned object can be used to test if the event has been * received. Note that only one event is listened for. - * + * * @param geckoEvent The geckoEvent JSONObject's type */ RepeatedEventExpecter expectGeckoEvent(String geckoEvent); @@ -85,9 +95,9 @@ public interface Actions { */ RepeatedEventExpecter expectPaint(); - /** - * Send a string to the application - * + /** + * Send a string to the application + * * @param keysToSend The string to send */ void sendKeys(String keysToSend); diff --git a/mobile/android/tests/browser/robocop/BaseTest.java b/mobile/android/tests/browser/robocop/BaseTest.java index 36f58a7b9b0b..8197fcd1c582 100644 --- a/mobile/android/tests/browser/robocop/BaseTest.java +++ b/mobile/android/tests/browser/robocop/BaseTest.java @@ -801,7 +801,7 @@ abstract class BaseTest extends BaseRobocopTest { Element backBtn = mDriver.findElement(getActivity(), R.id.back); backBtn.click(); } else { - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); } pageShowExpecter.blockForEvent(); @@ -869,7 +869,7 @@ abstract class BaseTest extends BaseRobocopTest { // item. Close it here. private void ensureMenuClosed() { if (mSolo.searchText("^New Tab$")) { - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); } } } diff --git a/mobile/android/tests/browser/robocop/ContentContextMenuTest.java b/mobile/android/tests/browser/robocop/ContentContextMenuTest.java index ced950c5b30e..f89750d27f30 100644 --- a/mobile/android/tests/browser/robocop/ContentContextMenuTest.java +++ b/mobile/android/tests/browser/robocop/ContentContextMenuTest.java @@ -98,7 +98,7 @@ abstract class ContentContextMenuTest extends PixelTest { mAsserter.ok(waitForText(shareOption), "Checking that the share pop-up is displayed", "The pop-up has been displayed"); // Close the Share Link option menu and wait for the page to be focused again - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); waitForText(pageTitle); } diff --git a/mobile/android/tests/browser/robocop/testAboutHomePageNavigation.java b/mobile/android/tests/browser/robocop/testAboutHomePageNavigation.java index 12a8f7e08fa0..d6861146fd79 100644 --- a/mobile/android/tests/browser/robocop/testAboutHomePageNavigation.java +++ b/mobile/android/tests/browser/robocop/testAboutHomePageNavigation.java @@ -114,6 +114,6 @@ public class testAboutHomePageNavigation extends UITest { mSolo.scrollToSide(Solo.RIGHT); mAsserter.is(pager.getCurrentItem(), 0, "Dragging right is not allowed when searching"); - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); */ } diff --git a/mobile/android/tests/browser/robocop/testAddSearchEngine.java b/mobile/android/tests/browser/robocop/testAddSearchEngine.java index 97b6c3708927..e2a3e70a28ab 100644 --- a/mobile/android/tests/browser/robocop/testAddSearchEngine.java +++ b/mobile/android/tests/browser/robocop/testAddSearchEngine.java @@ -161,7 +161,7 @@ public class testAddSearchEngine extends AboutHomeTest { }, MAX_WAIT_TEST_MS); // Exit about:home - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE); mAsserter.ok(correctNumSearchEnginesDisplayed, expectedCount + " Search Engines should be displayed" , "The correct number of Search Engines has been displayed"); } diff --git a/mobile/android/tests/browser/robocop/testAddonManager.java b/mobile/android/tests/browser/robocop/testAddonManager.java index 156e3a1fa1c0..4256d93c4d24 100644 --- a/mobile/android/tests/browser/robocop/testAddonManager.java +++ b/mobile/android/tests/browser/robocop/testAddonManager.java @@ -43,7 +43,7 @@ public class testAddonManager extends PixelTest { verifyUrlBarTitle(aboutAddonsURL); // Close the Add-on Manager - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); // Load the about:addons page and verify it was loaded loadAndPaint(aboutAddonsURL); diff --git a/mobile/android/tests/browser/robocop/testBookmarksPanel.java b/mobile/android/tests/browser/robocop/testBookmarksPanel.java index a98bfdb30a9b..a7e9505da452 100644 --- a/mobile/android/tests/browser/robocop/testBookmarksPanel.java +++ b/mobile/android/tests/browser/robocop/testBookmarksPanel.java @@ -110,7 +110,7 @@ public class testBookmarksPanel extends AboutHomeTest { } // Close the menu. - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); openBookmarkContextMenu(nonShareableURL); for (String contextMenuOption : mStringHelper.BOOKMARK_CONTEXT_MENU_ITEMS) { @@ -131,7 +131,7 @@ public class testBookmarksPanel extends AboutHomeTest { "Share option is not present"); // Close the menu. - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); } /** diff --git a/mobile/android/tests/browser/robocop/testClearPrivateData.java b/mobile/android/tests/browser/robocop/testClearPrivateData.java index 00b5306a70fc..39c9bcae57b0 100644 --- a/mobile/android/tests/browser/robocop/testClearPrivateData.java +++ b/mobile/android/tests/browser/robocop/testClearPrivateData.java @@ -4,7 +4,6 @@ package org.mozilla.gecko.tests; -import org.mozilla.gecko.Actions; import org.mozilla.gecko.R; import com.jayway.android.robotium.solo.Condition; @@ -90,10 +89,10 @@ public class testClearPrivateData extends PixelTest { public void checkDevice(final String title, final String url) { clearPrivateData(); if (mDevice.type.equals("phone")) { - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); mAsserter.ok(waitForText(mStringHelper.PRIVACY_SECTION_LABEL), "waiting to perform one back", "one back"); } - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); verifyUrlBarTitle(url); } diff --git a/mobile/android/tests/browser/robocop/testImportFromAndroid.java b/mobile/android/tests/browser/robocop/testImportFromAndroid.java index 08851f2bc994..9bf2eb1f8790 100644 --- a/mobile/android/tests/browser/robocop/testImportFromAndroid.java +++ b/mobile/android/tests/browser/robocop/testImportFromAndroid.java @@ -6,7 +6,6 @@ package org.mozilla.gecko.tests; import java.util.ArrayList; -import org.mozilla.gecko.Actions; import org.mozilla.gecko.AppConstants; import org.mozilla.gecko.GeckoProfile; @@ -55,7 +54,7 @@ public class testImportFromAndroid extends AboutHomeTest { firefoxBookmarks = mDatabaseHelper.getBrowserDBUrls(DatabaseHelper.BrowserDataType.BOOKMARKS); /** - * Add a delay to make sure the imported items are added to the array lists + * Add a delay to make sure the imported items are added to the array lists * if there are a lot of history items in the Android Browser database */ boolean success = waitForCondition(new Condition() { @@ -157,10 +156,10 @@ public class testImportFromAndroid extends AboutHomeTest { if ("phone".equals(mDevice.type)) { // Phones don't have headers like tablets, so we need to pop up one more level. waitForText(mStringHelper.IMPORT_FROM_ANDROID_LABEL); - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); } waitForText(mStringHelper.PRIVACY_SECTION_LABEL); // Settings is a header for the settings menu page. Waiting for Privacy ensures we are back in the top Settings view - mActions.sendSpecialKey(Actions.SpecialKey.BACK); // Exit Settings + mSolo.goBack(); // Exit Settings // Make sure the settings menu has been closed. mAsserter.ok(mSolo.waitForText(mStringHelper.TITLE_PLACE_HOLDER), "Waiting for search bar", "Search bar found"); diff --git a/mobile/android/tests/browser/robocop/testInputUrlBar.java b/mobile/android/tests/browser/robocop/testInputUrlBar.java index 012972ddec87..c4cd8a412e7a 100644 --- a/mobile/android/tests/browser/robocop/testInputUrlBar.java +++ b/mobile/android/tests/browser/robocop/testInputUrlBar.java @@ -88,10 +88,10 @@ public final class testInputUrlBar extends BaseTest { assertUrlBarText("uv"); // Dismiss the VKB - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); // Dismiss editing mode - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); waitForText(mStringHelper.TITLE_PLACE_HOLDER); diff --git a/mobile/android/tests/browser/robocop/testMasterPassword.java b/mobile/android/tests/browser/robocop/testMasterPassword.java index 1879e116494a..98cc57028c09 100644 --- a/mobile/android/tests/browser/robocop/testMasterPassword.java +++ b/mobile/android/tests/browser/robocop/testMasterPassword.java @@ -77,10 +77,10 @@ public class testMasterPassword extends PixelTest { if ("phone".equals(mDevice.type)) { // Phones don't have headers like tablets, so we need to pop up one more level. waitForText("Use master password"); - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); } waitForText(mStringHelper.SETTINGS_LABEL); - mActions.sendSpecialKey(Actions.SpecialKey.BACK);// Close the Settings Menu + mSolo.goBack();// Close the Settings Menu } public void disableMasterPassword(String password, String badPassword) { @@ -171,10 +171,10 @@ public class testMasterPassword extends PixelTest { if ("phone".equals(mDevice.type)) { // Phones don't have headers like tablets, so we need to pop up one more level. waitForText("Use master password"); - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); } waitForText(mStringHelper.SETTINGS_LABEL); - mActions.sendSpecialKey(Actions.SpecialKey.BACK);// Close the Settings Menu + mSolo.goBack();// Close the Settings Menu // Make sure the settings menu has been closed. mAsserter.ok(mSolo.waitForText("Browser Blank Page 01"), "Waiting for blank browser page after exiting settings", "Blank browser page present"); } diff --git a/mobile/android/tests/browser/robocop/testPromptGridInput.java b/mobile/android/tests/browser/robocop/testPromptGridInput.java index 32cae6b802dd..f645fe3be1b0 100644 --- a/mobile/android/tests/browser/robocop/testPromptGridInput.java +++ b/mobile/android/tests/browser/robocop/testPromptGridInput.java @@ -4,8 +4,6 @@ package org.mozilla.gecko.tests; -import org.mozilla.gecko.Actions; - public class testPromptGridInput extends BaseTest { protected int index = 1; public void testPromptGridInput() { @@ -29,7 +27,7 @@ public class testPromptGridInput extends BaseTest { mSolo.clickOnText("OK"); mAsserter.ok(waitForText("PASS"), "test passed", "PASS"); - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); } public void testGridItem(String title) { diff --git a/mobile/android/tests/browser/robocop/testSettingsMenuItems.java b/mobile/android/tests/browser/robocop/testSettingsMenuItems.java index cb01fb673fc2..21dde507a808 100644 --- a/mobile/android/tests/browser/robocop/testSettingsMenuItems.java +++ b/mobile/android/tests/browser/robocop/testSettingsMenuItems.java @@ -7,7 +7,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import org.mozilla.gecko.Actions; import org.mozilla.gecko.AppConstants; import org.mozilla.gecko.util.HardwareUtils; @@ -144,7 +143,7 @@ public class testSettingsMenuItems extends PixelTest { "The Settings menu did not load", mStringHelper.SETTINGS_LABEL); // Dismiss the Settings screen and verify that the view is returned to about:home page - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); // Waiting for page title to appear to be sure that is fully loaded before opening the menu mAsserter.ok(mSolo.waitForText(mStringHelper.TITLE_PLACE_HOLDER), "about:home did not load", @@ -281,7 +280,7 @@ public class testSettingsMenuItems extends PixelTest { mSolo.clickOnText("^Cancel$"); } else { // Some submenus aren't dialogs, but are nested screens; exit using "back". - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); } } } @@ -290,7 +289,7 @@ public class testSettingsMenuItems extends PixelTest { if (mDevice.type.equals("phone")) { int menuDepth = menuPath.length; while (menuDepth > 0) { - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); menuDepth--; // Sleep so subsequent back actions aren't lost. mSolo.sleep(150); diff --git a/mobile/android/tests/browser/robocop/testShareLink.java b/mobile/android/tests/browser/robocop/testShareLink.java index 55f62cdcfa62..e1184ec43852 100644 --- a/mobile/android/tests/browser/robocop/testShareLink.java +++ b/mobile/android/tests/browser/robocop/testShareLink.java @@ -56,7 +56,7 @@ public class testShareLink extends AboutHomeTest { } // Test share from the urlbar context menu - mActions.sendSpecialKey(Actions.SpecialKey.BACK); // Close the share menu + mSolo.goBack(); // Close the share menu mSolo.clickLongOnText(urlTitle); verifySharePopup(shareOptions,"urlbar"); @@ -145,7 +145,7 @@ public class testShareLink extends AboutHomeTest { // Verify if the option is present in the list of displayed share options mAsserter.ok(optionDisplayed(option, displayedOptions), "Share option for " + openedFrom + (openedFrom.equals("urlbar") ? "" : " item") + " found", option); } - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); /** * Adding a wait for the page title to make sure the Awesomebar will be dismissed * Because of Bug 712370 the Awesomescreen will be dismissed when the Share Menu is closed diff --git a/mobile/android/tests/browser/robocop/testSystemPages.java b/mobile/android/tests/browser/robocop/testSystemPages.java index 1338e5dca111..e0479ab94a85 100644 --- a/mobile/android/tests/browser/robocop/testSystemPages.java +++ b/mobile/android/tests/browser/robocop/testSystemPages.java @@ -35,7 +35,7 @@ public class testSystemPages extends PixelTest { loadAndPaint(mStringHelper.ABOUT_ABOUT_URL); // Press back to verify if the keyboard is dismissed or the previous about: page loads - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); // may not get a paint on Back...pause briefly to make sure it completes mSolo.sleep(AFTER_BACK_SLEEP_MS); diff --git a/mobile/android/tests/browser/robocop/testTitleBar.java b/mobile/android/tests/browser/robocop/testTitleBar.java index ca9c72fec487..706713e3d36e 100644 --- a/mobile/android/tests/browser/robocop/testTitleBar.java +++ b/mobile/android/tests/browser/robocop/testTitleBar.java @@ -1,6 +1,5 @@ package org.mozilla.gecko.tests; -import org.mozilla.gecko.Actions; import org.mozilla.gecko.util.HardwareUtils; /** @@ -45,13 +44,13 @@ public class testTitleBar extends PixelTest { mSolo.clickOnText(option); mAsserter.ok(waitForText(mStringHelper.CHARACTER_ENCODING_LABEL), "Waiting to press the option", "The pop-up is dismissed once clicked"); if (mDevice.type.equals("phone")) { - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); mAsserter.ok(waitForText(mStringHelper.CUSTOMIZE_SECTION_LABEL), "Waiting to perform one back", "One back performed"); - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); mAsserter.ok(waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL), "Waiting to exit settings", "Exit settings done"); } else { - mActions.sendSpecialKey(Actions.SpecialKey.BACK); + mSolo.goBack(); mAsserter.ok(waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL), "Waiting to exit settings", "Exit settings done"); } }