diff --git a/browser/metro/base/tests/mochitest/browser_history.js b/browser/metro/base/tests/mochitest/browser_history.js index 9c8f5d1612d..8fbe0b2b5e6 100644 --- a/browser/metro/base/tests/mochitest/browser_history.js +++ b/browser/metro/base/tests/mochitest/browser_history.js @@ -12,18 +12,27 @@ function test() { runTests(); } +function scrollToEnd() { + let startBox = document.getElementById("start-scrollbox"); + let [, scrollInterface] = ScrollUtils.getScrollboxFromElement(startBox); + + scrollInterface.scrollBy(50000, 0); +} + function setup() { PanelUI.hide(); HistoryTestHelper.setup(); - if (StartUI.isStartPageVisible) - return; + if (!StartUI.isStartPageVisible) { + yield addTab("about:start"); - yield addTab("about:start"); + yield waitForCondition(() => StartUI.isStartPageVisible); - yield waitForCondition(() => StartUI.isStartPageVisible); + yield hideContextUI(); + } - yield hideContextUI(); + // Scroll to make sure all tiles are visible. + scrollToEnd(); } function tearDown() { @@ -166,6 +175,7 @@ gTests.push({ let item2 = gStartView._set.getItemsByUrl(uriFromIndex(5))[0]; let item3 = gStartView._set.getItemsByUrl(uriFromIndex(12))[0]; + scrollToEnd(); let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar); sendContextMenuClickToElement(window, item1, 10, 10); sendContextMenuClickToElement(window, item2, 10, 10); @@ -269,6 +279,7 @@ gTests.push({ let initialLocation2 = gStartView._set.getIndexOfItem(item2); let initialLocation3 = gStartView._set.getIndexOfItem(item3); + scrollToEnd(); let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar); sendContextMenuClickToElement(window, item1, 10, 10); sendContextMenuClickToElement(window, item2, 10, 10); @@ -313,6 +324,7 @@ gTests.push({ let item2 = gStartView._set.getItemsByUrl(uriFromIndex(5))[0]; let item3 = gStartView._set.getItemsByUrl(uriFromIndex(12))[0]; + scrollToEnd(); let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar); sendContextMenuClickToElement(window, item1, 10, 10); sendContextMenuClickToElement(window, item2, 10, 10); @@ -391,6 +403,7 @@ gTests.push({ let item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0]; let item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0]; + scrollToEnd(); let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar); sendContextMenuClickToElement(window, item1, 10, 10); sendContextMenuClickToElement(window, item2, 10, 10); @@ -444,6 +457,7 @@ gTests.push({ let item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0]; let item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0]; + scrollToEnd(); let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar); sendContextMenuClickToElement(window, item1, 10, 10); sendContextMenuClickToElement(window, item2, 10, 10); @@ -521,6 +535,7 @@ gTests.push({ let item2 = gPanelView._set.getItemsByUrl(uriFromIndex(5))[0]; let item3 = gPanelView._set.getItemsByUrl(uriFromIndex(12))[0]; + scrollToEnd(); let promise = waitForEvent(Elements.contextappbar, "transitionend", null, Elements.contextappbar); sendContextMenuClickToElement(window, item1, 10, 10); sendContextMenuClickToElement(window, item2, 10, 10);