зеркало из https://github.com/mozilla/gecko-dev.git
Bug 914377 - Intermittent testShareLink | Exception caught - junit.framework.AssertionFailedError: View is null and can therefore not be clicked! r=gbrown
This commit is contained in:
Родитель
07abb7c0e4
Коммит
89f99b0161
|
@ -98,7 +98,7 @@ abstract class AboutHomeTest extends BaseTest {
|
|||
protected View getDisplayedBookmark(String url) {
|
||||
openAboutHomeTab(AboutHomeTabs.BOOKMARKS);
|
||||
ListView bookmarksTabList = findListViewWithTag("bookmarks");
|
||||
waitForListToLoad(bookmarksTabList);
|
||||
waitForNonEmptyListToLoad(bookmarksTabList);
|
||||
ListAdapter adapter = bookmarksTabList.getAdapter();
|
||||
if (adapter != null) {
|
||||
for (int i = 0; i < adapter.getCount(); i++ ) {
|
||||
|
@ -127,11 +127,13 @@ abstract class AboutHomeTest extends BaseTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Waits for the given ListView to have a non-empty adapter.
|
||||
* Waits for the given ListView to have a non-empty adapter and be populated
|
||||
* with a minimum number of items.
|
||||
*
|
||||
* This method will return false if the given ListView or its adapter are null.
|
||||
* This method will return false if the given ListView or its adapter is null,
|
||||
* or if the ListView does not have the minimum number of items.
|
||||
*/
|
||||
protected boolean waitForListToLoad(final ListView listView) {
|
||||
protected boolean waitForListToLoad(final ListView listView, final int minSize) {
|
||||
Condition listWaitCondition = new Condition() {
|
||||
@Override
|
||||
public boolean isSatisfied() {
|
||||
|
@ -144,12 +146,16 @@ abstract class AboutHomeTest extends BaseTest {
|
|||
return false;
|
||||
}
|
||||
|
||||
return (adapter.getCount() > 0);
|
||||
return (listView.getCount() - listView.getHeaderViewsCount() >= minSize);
|
||||
}
|
||||
};
|
||||
return waitForCondition(listWaitCondition, MAX_WAIT_MS);
|
||||
}
|
||||
|
||||
protected boolean waitForNonEmptyListToLoad(final ListView listView) {
|
||||
return waitForListToLoad(listView, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an active ListView with the specified tag .
|
||||
*
|
||||
|
|
|
@ -44,7 +44,7 @@ public class testBookmarklets extends AboutHomeTest {
|
|||
openAboutHomeTab(AboutHomeTabs.BOOKMARKS);
|
||||
|
||||
ListView bookmarks = findListViewWithTag("bookmarks");
|
||||
mAsserter.is(waitForListToLoad(bookmarks), true, "list is properly loaded");
|
||||
mAsserter.is(waitForNonEmptyListToLoad(bookmarks), true, "list is properly loaded");
|
||||
|
||||
int width = mDriver.getGeckoWidth();
|
||||
int height = mDriver.getGeckoHeight();
|
||||
|
|
|
@ -33,7 +33,7 @@ public class testHistory extends AboutHomeTest {
|
|||
openAboutHomeTab(AboutHomeTabs.MOST_RECENT);
|
||||
|
||||
final ListView hList = findListViewWithTag("most_recent");
|
||||
mAsserter.is(waitForListToLoad(hList), true, "list is properly loaded");
|
||||
mAsserter.is(waitForNonEmptyListToLoad(hList), true, "list is properly loaded");
|
||||
|
||||
// Click on the history item and wait for the page to load
|
||||
// wait for the history list to be populated
|
||||
|
|
|
@ -72,7 +72,7 @@ public class testShareLink extends AboutHomeTest {
|
|||
openAboutHomeTab(AboutHomeTabs.BOOKMARKS);
|
||||
|
||||
ListView bookmarksList = findListViewWithTag("bookmarks");
|
||||
mAsserter.is(waitForListToLoad(bookmarksList), true, "list is properly loaded");
|
||||
mAsserter.is(waitForNonEmptyListToLoad(bookmarksList), true, "list is properly loaded");
|
||||
|
||||
View bookmarksItem = bookmarksList.getChildAt(bookmarksList.getHeaderViewsCount());
|
||||
mSolo.clickLongOnView(bookmarksItem);
|
||||
|
@ -101,7 +101,7 @@ public class testShareLink extends AboutHomeTest {
|
|||
mActions.drag(width / 2, width / 2, height - 10, height / 2);
|
||||
|
||||
ListView topSitesList = findListViewWithTag("top_sites");
|
||||
mAsserter.is(waitForListToLoad(topSitesList), true, "list is properly loaded");
|
||||
mAsserter.is(waitForNonEmptyListToLoad(topSitesList), true, "list is properly loaded");
|
||||
View mostVisitedItem = topSitesList.getChildAt(topSitesList.getHeaderViewsCount());
|
||||
mSolo.clickLongOnView(mostVisitedItem);
|
||||
verifySharePopup(shareOptions,"top_sites");
|
||||
|
@ -110,7 +110,7 @@ public class testShareLink extends AboutHomeTest {
|
|||
openAboutHomeTab(AboutHomeTabs.MOST_RECENT);
|
||||
|
||||
ListView mostRecentList = findListViewWithTag("most_recent");
|
||||
mAsserter.is(waitForListToLoad(mostRecentList), true, "list is properly loaded");
|
||||
mAsserter.is(waitForNonEmptyListToLoad(mostRecentList), true, "list is properly loaded");
|
||||
|
||||
// Getting second child after header views because the first is the "Today" label
|
||||
View mostRecentItem = mostRecentList.getChildAt(mostRecentList.getHeaderViewsCount() + 1);
|
||||
|
|
Загрузка…
Ссылка в новой задаче