mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 845806 - Log robocop waitForText, waitForTest failures; r=jmaher
This commit is contained in:
parent
ed7f3825de
commit
d7630e8156
@ -263,6 +263,10 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||
}
|
||||
mSolo.sleep(100);
|
||||
}
|
||||
// log out wait failure for diagnostic purposes only;
|
||||
// a failed wait may be normal and does not necessarily
|
||||
// warrant a test assertion/failure
|
||||
mAsserter.dumpLog("waitForTest timeout after "+timeout+" ms");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -340,17 +344,27 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||
return assets.open(filename);
|
||||
}
|
||||
|
||||
public boolean waitForText(String text) {
|
||||
boolean rc = mSolo.waitForText(text);
|
||||
if (!rc) {
|
||||
// log out failed wait for diagnostic purposes only;
|
||||
// waitForText failures are sometimes expected/normal
|
||||
mAsserter.dumpLog("waitForText timeout on "+text);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
public final void selectMenuItem(String menuItemName) {
|
||||
// build the item name ready to be used
|
||||
String itemName = "^" + menuItemName + "$";
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.MENU);
|
||||
if (mSolo.waitForText(itemName)) {
|
||||
if (waitForText(itemName)) {
|
||||
mSolo.clickOnText(itemName);
|
||||
} else {
|
||||
if (mSolo.searchText("(^More$|^Tools$)")) {
|
||||
mSolo.clickOnText("(^More$|^Tools$)");
|
||||
}
|
||||
mSolo.waitForText(itemName);
|
||||
waitForText(itemName);
|
||||
mSolo.clickOnText(itemName);
|
||||
}
|
||||
}
|
||||
@ -398,7 +412,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||
*/
|
||||
protected ListView getAllPagesList(String waitText) {
|
||||
Activity awesomeBarActivity = clickOnAwesomeBar();
|
||||
mSolo.waitForText(waitText);
|
||||
waitForText(waitText);
|
||||
|
||||
ArrayList<ListView> views = mSolo.getCurrentListViews();
|
||||
for (ListView view : views) {
|
||||
@ -433,7 +447,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||
protected ListView getHistoryList() {
|
||||
Activity awesomeBarActivity = clickOnAwesomeBar();
|
||||
mSolo.clickOnText("History");
|
||||
mSolo.waitForText("Today|Yesterday");
|
||||
waitForText("Today|Yesterday");
|
||||
ArrayList<ListView> views = mSolo.getCurrentListViews();
|
||||
for (ListView view : views) {
|
||||
if (view.getTag().equals("history")) {
|
||||
@ -523,7 +537,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||
mAsserter.ok(success, "waiting for add tab view", "add tab view available");
|
||||
mAsserter.ok(addTab.click(), "checking that add_tab clicked", "add_tab element clicked");
|
||||
// must pause before sending keys, until awesome bar is displayed; waiting for known text is simple
|
||||
mSolo.waitForText("History");
|
||||
waitForText("History");
|
||||
// cannot use loadUrl(): getText fails because we are using a different urlbar
|
||||
mActions.sendKeys(url);
|
||||
hitEnterAndWait();
|
||||
@ -606,7 +620,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||
fwdBtn.click();
|
||||
} else {
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.MENU);
|
||||
mSolo.waitForText("^New Tab$");
|
||||
waitForText("^New Tab$");
|
||||
if (!osVersion.equals("2.x")) {
|
||||
Element fwdBtn = mDriver.findElement(getActivity(), "forward");
|
||||
fwdBtn.click();
|
||||
@ -622,7 +636,7 @@ abstract class BaseTest extends ActivityInstrumentationTestCase2<Activity> {
|
||||
reloadBtn.click();
|
||||
} else {
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.MENU);
|
||||
mSolo.waitForText("^New Tab$");
|
||||
waitForText("^New Tab$");
|
||||
if (!osVersion.equals("2.x")) {
|
||||
Element reloadBtn = mDriver.findElement(getActivity(), "reload");
|
||||
reloadBtn.click();
|
||||
|
@ -27,7 +27,7 @@ abstract class PixelTest extends BaseTest {
|
||||
Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
|
||||
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.MENU);
|
||||
mSolo.waitForText("Reload");
|
||||
waitForText("Reload");
|
||||
mSolo.clickOnText("Reload");
|
||||
|
||||
paintExpecter.blockUntilClear(PAINT_CLEAR_DELAY);
|
||||
|
@ -79,7 +79,7 @@ public class testBookmark extends PixelTest {
|
||||
ListView bookmarksList = getBookmarksList();
|
||||
|
||||
// Wait for bookmark to appear in list
|
||||
mSolo.waitForText(ABOUT_HOME_URL);
|
||||
waitForText(ABOUT_HOME_URL);
|
||||
|
||||
mAsserter.ok(bookmarksList != null, "checking that bookmarks list exists", "bookmarks list exists");
|
||||
|
||||
@ -96,7 +96,7 @@ public class testBookmark extends PixelTest {
|
||||
}
|
||||
|
||||
insertOneBookmark();
|
||||
mSolo.waitForText(BOOKMARK_TITLE);
|
||||
waitForText(BOOKMARK_TITLE);
|
||||
|
||||
mAsserter.is(bookmarksList.getAdapter().getCount(), 5,
|
||||
"bookmarks list has 5 children (the default bookmarks and the new one)");
|
||||
@ -160,7 +160,7 @@ public class testBookmark extends PixelTest {
|
||||
private void toggleBookmark() {
|
||||
getInstrumentation().waitForIdleSync();
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.MENU);
|
||||
mSolo.waitForText("Bookmark");
|
||||
waitForText("Bookmark");
|
||||
mSolo.clickOnText("Bookmark");
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class testBookmarksTab extends BaseTest {
|
||||
View child;
|
||||
ListView list = getBookmarksList();
|
||||
|
||||
mSolo.waitForText("Desktop Bookmarks");
|
||||
waitForText("Desktop Bookmarks");
|
||||
mAsserter.isnot(list, null, "checking that bookmarks list exists");
|
||||
|
||||
int count = list.getAdapter().getCount();
|
||||
@ -64,7 +64,7 @@ public class testBookmarksTab extends BaseTest {
|
||||
|
||||
child = list.getChildAt(0);
|
||||
mSolo.clickOnView(child);
|
||||
mSolo.waitForText("Bookmarks Toolbar");
|
||||
waitForText("Bookmarks Toolbar");
|
||||
|
||||
count = list.getAdapter().getCount();
|
||||
mAsserter.is(count, 4, "desktop folder has correct number of children");
|
||||
@ -75,7 +75,7 @@ public class testBookmarksTab extends BaseTest {
|
||||
|
||||
child = list.getChildAt(1);
|
||||
mSolo.clickOnView(child);
|
||||
mSolo.waitForText("BOOKMARK_TITLE");
|
||||
waitForText("BOOKMARK_TITLE");
|
||||
|
||||
count = list.getAdapter().getCount();
|
||||
mAsserter.is(count, 2, "toolbar folder has correct number of children");
|
||||
@ -96,7 +96,7 @@ public class testBookmarksTab extends BaseTest {
|
||||
|
||||
private void testContextMenu(String url) {
|
||||
list = getBookmarksList();
|
||||
mSolo.waitForText(url);
|
||||
waitForText(url);
|
||||
|
||||
// wait for the bookmarks list to be populated
|
||||
View child;
|
||||
@ -165,19 +165,19 @@ public class testBookmarksTab extends BaseTest {
|
||||
mAsserter.is(checkBookmarkEdit(1,"Bookmark Keyword"), true, "Bookmark Keyword was changed");
|
||||
|
||||
// Remove Bookmark from Context Menu
|
||||
mSolo.waitForText("Bookmarks");
|
||||
waitForText("Bookmarks");
|
||||
child = list.getChildAt(1);
|
||||
mSolo.clickLongOnView(child);
|
||||
mSolo.waitForText("Open in New Tab");
|
||||
waitForText("Open in New Tab");
|
||||
mSolo.clickOnText("Remove");
|
||||
|
||||
// Wait for the toaster notification
|
||||
mSolo.waitForText("Bookmark Removed");
|
||||
waitForText("Bookmark Removed");
|
||||
|
||||
// Verify Bookmark is removed
|
||||
child = list.getChildAt(1);
|
||||
mSolo.clickLongOnView(child);
|
||||
mSolo.waitForText("Open in New Tab");
|
||||
waitForText("Open in New Tab");
|
||||
mAsserter.is(mSolo.searchText("Bookmark Name"), false, "Removed bookmark has been deleted");
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.BACK); // Exit the Context Menu
|
||||
|
||||
@ -191,11 +191,11 @@ public class testBookmarksTab extends BaseTest {
|
||||
View child;
|
||||
mSolo.clickOnText("Bookmarks");
|
||||
child = list.getChildAt(bookmarkIndex);
|
||||
mSolo.waitForText("Desktop Bookmarks");
|
||||
waitForText("Desktop Bookmarks");
|
||||
mSolo.clickLongOnView(child);
|
||||
mSolo.waitForText("Open in New Tab");
|
||||
waitForText("Open in New Tab");
|
||||
mSolo.clickOnText("Edit");
|
||||
mSolo.waitForText("Edit Bookmark");
|
||||
waitForText("Edit Bookmark");
|
||||
|
||||
// Clear the Field
|
||||
mSolo.clearEditText(fieldIndex);
|
||||
@ -204,7 +204,7 @@ public class testBookmarksTab extends BaseTest {
|
||||
mSolo.clickOnEditText(fieldIndex);
|
||||
mActions.sendKeys(addedText);
|
||||
mSolo.clickOnText("OK");
|
||||
mSolo.waitForText("Bookmark Updated");
|
||||
waitForText("Bookmark Updated");
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.BACK); // close the VKB
|
||||
}
|
||||
|
||||
@ -214,11 +214,11 @@ public class testBookmarksTab extends BaseTest {
|
||||
View child;
|
||||
mSolo.clickOnText("Bookmarks");
|
||||
child = list.getChildAt(bookmarkIndex);
|
||||
mSolo.waitForText("Desktop Bookmarks");
|
||||
waitForText("Desktop Bookmarks");
|
||||
mSolo.clickLongOnView(child);
|
||||
mSolo.waitForText("Open in New Tab");
|
||||
waitForText("Open in New Tab");
|
||||
mSolo.clickOnText("Edit");
|
||||
mSolo.waitForText("Edit Bookmark");
|
||||
waitForText("Edit Bookmark");
|
||||
|
||||
// If the OS is not Gingerbread the vkb will be opened so we need to close it in order to press the "Cancel" button
|
||||
if (!(mDevice.version.equals("2.x"))) {
|
||||
@ -228,12 +228,12 @@ public class testBookmarksTab extends BaseTest {
|
||||
// Check if the new text was added
|
||||
if (mSolo.searchText(addedText)) {
|
||||
mSolo.clickOnText("Cancel");
|
||||
mSolo.waitForText("Desktop Bookmarks");
|
||||
waitForText("Desktop Bookmarks");
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.BACK); // close the VKB
|
||||
return true;
|
||||
} else {
|
||||
mSolo.clickOnText("Cancel");
|
||||
mSolo.waitForText("Desktop Bookmarks");
|
||||
waitForText("Desktop Bookmarks");
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.BACK); // close the VKB
|
||||
return false;
|
||||
}
|
||||
|
@ -34,11 +34,11 @@ public class testClearPrivateData extends PixelTest {
|
||||
|
||||
// Quit the awesomescreen
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
|
||||
mSolo.waitForText("Browser Blank Page 01");
|
||||
waitForText("Browser Blank Page 01");
|
||||
|
||||
// Clearing private data
|
||||
selectMenuItem("Settings");
|
||||
if (mSolo.waitForText("^Clear private data$")) {
|
||||
if (waitForText("^Clear private data$")) {
|
||||
mSolo.clickOnText("^Clear private data$");
|
||||
}
|
||||
mAsserter.ok(mSolo.searchButton("Clear data"),"checking clear button","clear button exists");
|
||||
|
@ -29,7 +29,7 @@ public class testDoorHanger extends BaseTest {
|
||||
|
||||
// Test geolocation notification
|
||||
loadUrl(GEO_URL);
|
||||
mSolo.waitForText("wants your location");
|
||||
waitForText("wants your location");
|
||||
mAsserter.is(mSolo.searchText("wants your location"), true, "Geolocation doorhanger has been displayed");
|
||||
|
||||
// Test "Share" button hides the notification
|
||||
@ -39,7 +39,7 @@ public class testDoorHanger extends BaseTest {
|
||||
|
||||
// Re-trigger geolocation notification
|
||||
loadUrl(GEO_URL);
|
||||
mSolo.waitForText("wants your location");
|
||||
waitForText("wants your location");
|
||||
|
||||
// Test "Don't share" button hides the notification
|
||||
mSolo.clickOnCheckBox(0);
|
||||
@ -48,7 +48,7 @@ public class testDoorHanger extends BaseTest {
|
||||
|
||||
// Re-trigger geolocation notification
|
||||
loadUrl(GEO_URL);
|
||||
mSolo.waitForText("wants your location");
|
||||
waitForText("wants your location");
|
||||
|
||||
// Add a new tab
|
||||
addTab(BLANK_URL);
|
||||
@ -58,7 +58,7 @@ public class testDoorHanger extends BaseTest {
|
||||
|
||||
// Load offline storage page
|
||||
loadUrl(OFFLINE_STORAGE_URL);
|
||||
mSolo.waitForText("wants to store data on your device for offline use");
|
||||
waitForText("wants to store data on your device for offline use");
|
||||
|
||||
// Test doorhanger dismissed when tapping "Not Now"
|
||||
mSolo.clickOnText("Not Now");
|
||||
@ -66,7 +66,7 @@ public class testDoorHanger extends BaseTest {
|
||||
|
||||
// Load offline storage page
|
||||
loadUrl(OFFLINE_STORAGE_URL);
|
||||
mSolo.waitForText("wants to store data on your device for offline use");
|
||||
waitForText("wants to store data on your device for offline use");
|
||||
|
||||
// Test doorhanger dismissed when tapping "Allow" and is not displayed again
|
||||
mSolo.clickOnText("Allow");
|
||||
@ -76,7 +76,7 @@ public class testDoorHanger extends BaseTest {
|
||||
|
||||
// Load login page
|
||||
loadUrl(LOGIN_URL);
|
||||
mSolo.waitForText("to remeber password for");
|
||||
waitForText("to remeber password for");
|
||||
|
||||
// Test doorhanger is dismissed when tapping "Not Now"
|
||||
mSolo.clickOnText("Not Now");
|
||||
@ -84,7 +84,7 @@ public class testDoorHanger extends BaseTest {
|
||||
|
||||
// Load login page
|
||||
loadUrl(LOGIN_URL);
|
||||
mSolo.waitForText("prevented this site from opening");
|
||||
waitForText("prevented this site from opening");
|
||||
|
||||
// Test doorhanger is dismissed when tapping "Never show" and is no longer triggered
|
||||
mSolo.clickOnText("Remember");
|
||||
|
@ -60,7 +60,7 @@ public class testHistoryTab extends PixelTest {
|
||||
loadAndPaint(url);
|
||||
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.MENU);
|
||||
mSolo.waitForText("Settings");
|
||||
waitForText("Settings");
|
||||
|
||||
// On ICS+ phones, there is no button labeled "Bookmarks"
|
||||
// instead we have to just dig through every button on the screen
|
||||
@ -102,7 +102,7 @@ public class testHistoryTab extends PixelTest {
|
||||
|
||||
// Around midnight we will switch from Today -> Yesterday, account for both
|
||||
if (!mSolo.waitForText("Today")) {
|
||||
mSolo.waitForText("Yesterday");
|
||||
waitForText("Yesterday");
|
||||
}
|
||||
|
||||
mAsserter.isnot(listview, null, "checking that history list exists");
|
||||
@ -161,7 +161,7 @@ public class testHistoryTab extends PixelTest {
|
||||
|
||||
private void testContextMenu(String url) {
|
||||
listview = getHistoryList();
|
||||
mSolo.waitForText(url);
|
||||
waitForText(url);
|
||||
|
||||
// wait for the history list to be populated
|
||||
mFirstChild = null;
|
||||
@ -215,7 +215,7 @@ public class testHistoryTab extends PixelTest {
|
||||
private void testClick(String url) {
|
||||
listview = getHistoryList();
|
||||
|
||||
mSolo.waitForText(url);
|
||||
waitForText(url);
|
||||
|
||||
View child = listview.getChildAt(0);
|
||||
mSolo.clickOnView(child);
|
||||
|
@ -23,7 +23,7 @@ public class testPermissions extends PixelTest {
|
||||
private void geolocationTest() {
|
||||
// Test geolocation notification
|
||||
loadAndPaint(getAbsoluteUrl("/robocop/robocop_geolocation.html"));
|
||||
mSolo.waitForText("wants your location");
|
||||
waitForText("wants your location");
|
||||
|
||||
// Uncheck the "Don't ask again for this site" checkbox
|
||||
ArrayList<CheckBox> checkBoxes = mSolo.getCurrentCheckBoxes();
|
||||
@ -44,7 +44,7 @@ public class testPermissions extends PixelTest {
|
||||
|
||||
// Re-trigger geolocation notification
|
||||
reloadAndPaint();
|
||||
mSolo.waitForText("wants your location");
|
||||
waitForText("wants your location");
|
||||
|
||||
// Make sure the checkbox is checked this time
|
||||
mAsserter.ok(mSolo.isCheckBoxChecked(0), "checkbox checked", "checkbox is checked");
|
||||
|
@ -43,7 +43,7 @@ public class testSettingsMenuItems extends PixelTest {
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
|
||||
verifyUrl("about:home");
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
|
||||
mSolo.waitForText("Enter Search"); // Waiting for page title to appear to be sure that is fully loaded before opening the menu
|
||||
waitForText("Enter Search"); // Waiting for page title to appear to be sure that is fully loaded before opening the menu
|
||||
|
||||
selectMenuItem("Settings");
|
||||
checkMenuSections(menuItems);
|
||||
@ -81,7 +81,7 @@ public class testSettingsMenuItems extends PixelTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
mSolo.waitForText("^Cancel$");
|
||||
waitForText("^Cancel$");
|
||||
mSolo.clickOnText("^Cancel$");
|
||||
j = 0;
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ public class testShareLink extends BaseTest {
|
||||
blockForGeckoReady();
|
||||
|
||||
loadUrl(url);
|
||||
mSolo.waitForText("Big Link"); // Waiting for page title to ensure the page is loaded
|
||||
waitForText("Big Link"); // Waiting for page title to ensure the page is loaded
|
||||
selectMenuItem("Share");
|
||||
mSolo.waitForText("Share Via");
|
||||
waitForText("Share Via");
|
||||
|
||||
// Get list of current avaliable share activities and verify them
|
||||
shareOptions = getShareOptions();
|
||||
@ -66,7 +66,7 @@ public class testShareLink extends BaseTest {
|
||||
// Make sure the keyboard is closed since a back here would just close the Awesomebar
|
||||
mSolo.clickOnText("Bookmarks");
|
||||
mSolo.clickOnText("Sites");
|
||||
mSolo.waitForText("Big Link");
|
||||
waitForText("Big Link");
|
||||
|
||||
View allpages = tslist.getChildAt(1);
|
||||
if (allpages != null) {
|
||||
@ -94,9 +94,9 @@ public class testShareLink extends BaseTest {
|
||||
}
|
||||
|
||||
public void verifySharePopup(ArrayList<String> shareOptions, String openedFrom) {
|
||||
mSolo.waitForText("Share");
|
||||
waitForText("Share");
|
||||
mSolo.clickOnText("Share");
|
||||
mSolo.waitForText("Share Via");
|
||||
waitForText("Share Via");
|
||||
ArrayList<String> displayedOptions = getSharePopupOption();
|
||||
for (String option:shareOptions) {
|
||||
// Verify if the option is present in the list of displayed share options
|
||||
|
@ -86,7 +86,7 @@ public class testSystemPages extends PixelTest {
|
||||
// Make sure the about: page was loaded without opening a new tab and verify the page Url
|
||||
waitForPaint(paintExpecter); // waiting for the page to load
|
||||
selectMenuItem(item);
|
||||
mSolo.waitForText("About");
|
||||
waitForText("About");
|
||||
|
||||
paintExpecter = mActions.expectPaint(); // Set up listener to catch the page load
|
||||
mSolo.clickOnText("About");
|
||||
|
@ -38,22 +38,22 @@ public class testTabHistory extends PixelTest {
|
||||
|
||||
// Go to the 2nd page
|
||||
nav.back();
|
||||
mSolo.waitForText("Browser Blank Page 02");
|
||||
waitForText("Browser Blank Page 02");
|
||||
verifyPageTitle("Browser Blank Page 02");
|
||||
|
||||
// Go to the first page
|
||||
nav.back();
|
||||
mSolo.waitForText("Browser Blank Page 01");
|
||||
waitForText("Browser Blank Page 01");
|
||||
verifyPageTitle("Browser Blank Page 01");
|
||||
|
||||
// Go forward to the second page
|
||||
nav.forward();
|
||||
mSolo.waitForText("Browser Blank Page 02");
|
||||
waitForText("Browser Blank Page 02");
|
||||
verifyPageTitle("Browser Blank Page 02");
|
||||
|
||||
// Reload page
|
||||
nav.reload();
|
||||
mSolo.waitForText("Browser Blank Page 02");
|
||||
waitForText("Browser Blank Page 02");
|
||||
verifyPageTitle("Browser Blank Page 02");
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ public class testWebContentContextMenu extends PixelTest {
|
||||
try { Thread.sleep(2000); } catch(Exception e) {}
|
||||
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.MENU);
|
||||
mSolo.waitForText("Bookmark");
|
||||
waitForText("Bookmark");
|
||||
|
||||
// TODO: This doesn't work for some reason. We got a 'Bookmark added' and
|
||||
// will check for 'Bookmark removed'
|
||||
|
Loading…
Reference in New Issue
Block a user