mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 851130 - Part 7 - Update all tests to support new start tab. r=sfoster
This commit is contained in:
parent
98f95d4bb5
commit
755f946f45
@ -5,7 +5,7 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
let gStartView = BookmarksStartView._view;
|
||||
let gStartView = null;
|
||||
|
||||
function test() {
|
||||
runTests();
|
||||
@ -13,16 +13,17 @@ function test() {
|
||||
|
||||
function setup() {
|
||||
PanelUI.hide();
|
||||
|
||||
if (!BrowserUI.isStartTabVisible) {
|
||||
let tab = yield addTab("about:start");
|
||||
gStartView = tab.browser.contentWindow.BookmarksStartView._view;
|
||||
|
||||
yield waitForCondition(() => BrowserUI.isStartTabVisible);
|
||||
|
||||
yield hideContextUI();
|
||||
}
|
||||
|
||||
BookmarksTestHelper.setup();
|
||||
|
||||
yield hideContextUI();
|
||||
|
||||
if (StartUI.isStartPageVisible)
|
||||
return;
|
||||
|
||||
yield addTab("about:start");
|
||||
|
||||
yield waitForCondition(() => StartUI.isStartPageVisible);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
|
@ -15,10 +15,10 @@ gTests.push({
|
||||
yield addTab("about:start");
|
||||
|
||||
yield waitForCondition(function () {
|
||||
return StartUI.isStartPageVisible;
|
||||
return BrowserUI.isStartTabVisible;
|
||||
});
|
||||
|
||||
is(StartUI.isVisible, true, "Start UI is displayed on about:start");
|
||||
is(BrowserUI.isStartTabVisible, true, "Start UI is displayed on about:start");
|
||||
is(ContextUI.navbarVisible, true, "Navbar is displayed on about:start");
|
||||
is(ContextUI.tabbarVisible, false, "Tabbar is not displayed initially");
|
||||
is(ContextUI.contextAppbarVisible, false, "Appbar is not displayed initially");
|
||||
@ -41,7 +41,7 @@ gTests.push({
|
||||
is(ContextUI.tabbarVisible, true, "Tabbar is visible after third swipe");
|
||||
is(ContextUI.contextAppbarVisible, false, "Appbar is hidden after third swipe");
|
||||
|
||||
is(StartUI.isVisible, true, "Start UI is still visible");
|
||||
is(BrowserUI.isStartTabVisible, true, "Start UI is still visible");
|
||||
}
|
||||
});
|
||||
|
||||
@ -50,7 +50,7 @@ gTests.push({
|
||||
run: function testAbout() {
|
||||
yield addTab("about:");
|
||||
ContextUI.dismiss();
|
||||
is(StartUI.isVisible, false, "Start UI is not visible on about:");
|
||||
is(BrowserUI.isStartTabVisible, false, "Start UI is not visible on about:");
|
||||
is(ContextUI.navbarVisible, false, "Navbar is not initially visible on about:");
|
||||
is(ContextUI.tabbarVisible, false, "Tabbar is not initially visible on about:");
|
||||
|
||||
@ -62,7 +62,7 @@ gTests.push({
|
||||
is(ContextUI.navbarVisible, false, "Navbar is not visible after second swipe");
|
||||
is(ContextUI.tabbarVisible, false, "Tabbar is not visible after second swipe");
|
||||
|
||||
is(StartUI.isVisible, false, "Start UI is still not visible");
|
||||
is(BrowserUI.isStartTabVisible, false, "Start UI is still not visible");
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -5,31 +5,31 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
let gStartView = HistoryStartView._view;
|
||||
let gStartView = null;
|
||||
|
||||
function test() {
|
||||
runTests();
|
||||
}
|
||||
|
||||
function scrollToEnd() {
|
||||
let startBox = document.getElementById("start-scrollbox");
|
||||
let [, scrollInterface] = ScrollUtils.getScrollboxFromElement(startBox);
|
||||
|
||||
scrollInterface.scrollBy(50000, 0);
|
||||
let scroller = getBrowser().contentWindow.StartUI.getScrollBoxObject();
|
||||
scroller.scrollBy(50000, 0);
|
||||
}
|
||||
|
||||
function setup() {
|
||||
PanelUI.hide();
|
||||
HistoryTestHelper.setup();
|
||||
|
||||
if (!StartUI.isStartPageVisible) {
|
||||
yield addTab("about:start");
|
||||
if (!BrowserUI.isStartTabVisible) {
|
||||
let tab = yield addTab("about:start");
|
||||
gStartView = tab.browser.contentWindow.HistoryStartView._view;
|
||||
|
||||
yield waitForCondition(() => StartUI.isStartPageVisible);
|
||||
yield waitForCondition(() => BrowserUI.isStartTabVisible);
|
||||
|
||||
yield hideContextUI();
|
||||
}
|
||||
|
||||
HistoryTestHelper.setup();
|
||||
|
||||
// Scroll to make sure all tiles are visible.
|
||||
scrollToEnd();
|
||||
}
|
||||
|
@ -18,25 +18,25 @@ function test() {
|
||||
gTests.push({
|
||||
desc: "Test sync tabs from other devices UI",
|
||||
run: function run() {
|
||||
if (StartUI.isStartPageVisible)
|
||||
if (BrowserUI.isStartTabVisible)
|
||||
return;
|
||||
|
||||
yield addTab("about:start");
|
||||
yield waitForCondition(() => StartUI.isStartPageVisible);
|
||||
yield waitForCondition(() => BrowserUI.isStartTabVisible);
|
||||
yield hideContextUI();
|
||||
|
||||
is(Weave.Status.checkSetup(), Weave.CLIENT_NOT_CONFIGURED, "Sync should be disabled on start");
|
||||
|
||||
let vbox = document.getElementById("start-remotetabs");
|
||||
let vbox = Browser.selectedBrowser.contentDocument.getElementById("start-remotetabs");
|
||||
ok(vbox.hidden, "remote tabs in the start page should be hidden when sync is not enabled");
|
||||
|
||||
RemoteTabsStartView._view.setUIAccessVisible(true);
|
||||
Browser.selectedBrowser.contentWindow.RemoteTabsStartView._view.setUIAccessVisible(true);
|
||||
|
||||
// start page grid should be visible
|
||||
ok(vbox, "remote tabs grid is present on start page");
|
||||
is(vbox.hidden, false, "remote tabs should be visible in start page when sync is enabled");
|
||||
|
||||
RemoteTabsStartView._view.setUIAccessVisible(false);
|
||||
Browser.selectedBrowser.contentWindow.RemoteTabsStartView._view.setUIAccessVisible(false);
|
||||
|
||||
ok(vbox.hidden, "remote tabs in the start page should be hidden when sync is not enabled");
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ gTests.push({
|
||||
yield addTab(chromeRoot + "browser_selection_basic.html");
|
||||
|
||||
yield waitForCondition(function () {
|
||||
return !StartUI.isStartPageVisible;
|
||||
return !BrowserUI.isStartTabVisible;
|
||||
}, 10000, 100);
|
||||
|
||||
yield hideContextUI();
|
||||
|
@ -31,7 +31,7 @@ gTests.push({
|
||||
yield addTab(chromeRoot + "browser_selection_caretfocus.html");
|
||||
|
||||
yield waitForCondition(function () {
|
||||
return !StartUI.isStartPageVisible;
|
||||
return !BrowserUI.isStartTabVisible;
|
||||
});
|
||||
|
||||
yield hideContextUI();
|
||||
|
@ -20,7 +20,7 @@ gTests.push({
|
||||
info(chromeRoot + "browser_selection_contenteditable.html");
|
||||
yield addTab(chromeRoot + "browser_selection_contenteditable.html");
|
||||
yield waitForCondition(function () {
|
||||
return !StartUI.isStartPageVisible;
|
||||
return !BrowserUI.isStartTabVisible;
|
||||
}, kCommonWaitMs, kCommonPollMs);
|
||||
|
||||
yield hideContextUI();
|
||||
|
@ -38,7 +38,7 @@ gTests.push({
|
||||
yield addTab(chromeRoot + "browser_selection_frame_content.html");
|
||||
|
||||
yield waitForCondition(function () {
|
||||
return !StartUI.isStartPageVisible;
|
||||
return !BrowserUI.isStartTabVisible;
|
||||
}, 10000, 100);
|
||||
|
||||
yield hideContextUI();
|
||||
|
@ -41,7 +41,7 @@ gTests.push({
|
||||
yield addTab(chromeRoot + "browser_selection_frame_inputs.html");
|
||||
|
||||
yield waitForCondition(function () {
|
||||
return !StartUI.isStartPageVisible;
|
||||
return !BrowserUI.isStartTabVisible;
|
||||
}, 10000, 100);
|
||||
|
||||
yield hideContextUI();
|
||||
|
@ -41,7 +41,7 @@ gTests.push({
|
||||
yield addTab(chromeRoot + "browser_selection_frame_textarea.html");
|
||||
|
||||
yield waitForCondition(function () {
|
||||
return !StartUI.isStartPageVisible;
|
||||
return !BrowserUI.isStartTabVisible;
|
||||
}, 10000, 100);
|
||||
|
||||
yield hideContextUI();
|
||||
|
@ -44,7 +44,7 @@ gTests.push({
|
||||
yield addTab(chromeRoot + "browser_selection_inputs.html");
|
||||
|
||||
yield waitForCondition(function () {
|
||||
return !StartUI.isStartPageVisible;
|
||||
return !BrowserUI.isStartTabVisible;
|
||||
});
|
||||
|
||||
yield hideContextUI();
|
||||
|
@ -38,7 +38,7 @@ gTests.push({
|
||||
yield addTab(chromeRoot + "browser_selection_textarea.html");
|
||||
|
||||
yield waitForCondition(function () {
|
||||
return !StartUI.isStartPageVisible;
|
||||
return !BrowserUI.isStartTabVisible;
|
||||
}, 10000, 100);
|
||||
|
||||
yield hideContextUI();
|
||||
|
@ -23,7 +23,7 @@ gTests.push({
|
||||
yield addTab(chromeRoot + "res/textblock01.html");
|
||||
|
||||
yield waitForCondition(function () {
|
||||
return !StartUI.isStartPageVisible;
|
||||
return !BrowserUI.isStartTabVisible;
|
||||
});
|
||||
|
||||
yield hideContextUI();
|
||||
|
@ -9,14 +9,20 @@
|
||||
// Test helpers
|
||||
|
||||
let TopSitesTestHelper = {
|
||||
get grid() {
|
||||
return Browser.selectedBrowser.contentDocument.getElementById("start-topsites-grid");
|
||||
},
|
||||
get document() {
|
||||
return Browser.selectedBrowser.contentDocument;
|
||||
},
|
||||
setup: function() {
|
||||
return Task.spawn(function(){
|
||||
if (StartUI.isStartPageVisible)
|
||||
if (BrowserUI.isStartTabVisible)
|
||||
return;
|
||||
|
||||
yield addTab("about:start");
|
||||
|
||||
yield waitForCondition(() => StartUI.isStartPageVisible);
|
||||
yield waitForCondition(() => BrowserUI.isStartTabVisible);
|
||||
});
|
||||
},
|
||||
mockLinks: function th_mockLinks(aLinks) {
|
||||
@ -176,18 +182,18 @@ gTests.push({
|
||||
desc: "load and display top sites",
|
||||
setUp: function() {
|
||||
yield TopSitesTestHelper.setup();
|
||||
let grid = document.getElementById("start-topsites-grid");
|
||||
let grid = TopSitesTestHelper.grid;
|
||||
|
||||
// setup - set history to known state
|
||||
yield TopSitesTestHelper.setLinks("brian,dougal,dylan,ermintrude,florence,moose,sgtsam,train,zebedee,zeebad");
|
||||
|
||||
let arrangedPromise = waitForEvent(grid, "arranged");
|
||||
yield TopSitesTestHelper.updatePagesAndWait();
|
||||
yield arrangedPromise;
|
||||
// pause until the update has fired and the view is finishd updating
|
||||
yield arrangedPromise;
|
||||
},
|
||||
run: function() {
|
||||
let grid = document.getElementById("start-topsites-grid");
|
||||
let grid = TopSitesTestHelper.grid;
|
||||
let items = grid.children;
|
||||
is(items.length, 8, "should be 8 topsites"); // i.e. not 10
|
||||
if(items.length) {
|
||||
@ -217,17 +223,17 @@ gTests.push({
|
||||
this.pins
|
||||
);
|
||||
// pause until the update has fired and the view is finishd updating
|
||||
let arrangedPromise = waitForEvent(document.getElementById("start-topsites-grid"), "arranged");
|
||||
let arrangedPromise = waitForEvent(TopSitesTestHelper.grid, "arranged");
|
||||
yield TopSitesTestHelper.updatePagesAndWait();
|
||||
yield arrangedPromise;
|
||||
},
|
||||
run: function() {
|
||||
// test that pinned state of each site as rendered matches our expectations
|
||||
let pins = this.pins.split(",");
|
||||
let items = document.getElementById("start-topsites-grid").children;
|
||||
let items = TopSitesTestHelper.grid.children;
|
||||
is(items.length, 8, "should be 8 topsites in the grid");
|
||||
|
||||
is(document.querySelectorAll("#start-topsites-grid > [pinned]").length, 3, "should be 3 children with 'pinned' attribute");
|
||||
is(TopSitesTestHelper.document.querySelectorAll("#start-topsites-grid > [pinned]").length, 3, "should be 3 children with 'pinned' attribute");
|
||||
try {
|
||||
Array.forEach(items, function(aItem, aIndex){
|
||||
// pinned state should agree with the pins array
|
||||
@ -258,7 +264,7 @@ gTests.push({
|
||||
// setup - set history to known state
|
||||
yield TopSitesTestHelper.setLinks("sgtsam,train,zebedee,zeebad", []); // nothing initially pinned
|
||||
// pause until the update has fired and the view is finishd updating
|
||||
let arrangedPromise = waitForEvent(document.getElementById("start-topsites-grid"), "arranged");
|
||||
let arrangedPromise = waitForEvent(TopSitesTestHelper.grid, "arranged");
|
||||
yield TopSitesTestHelper.updatePagesAndWait();
|
||||
yield arrangedPromise;
|
||||
},
|
||||
@ -266,7 +272,7 @@ gTests.push({
|
||||
// pin a site
|
||||
// test that site is pinned as expected
|
||||
// and that sites fill positions around it
|
||||
let grid = document.getElementById("start-topsites-grid"),
|
||||
let grid = TopSitesTestHelper.grid,
|
||||
items = grid.children;
|
||||
is(items.length, 4, this.desc + ": should be 4 topsites");
|
||||
|
||||
@ -315,14 +321,14 @@ gTests.push({
|
||||
this.pins
|
||||
);
|
||||
// pause until the update has fired and the view is finishd updating
|
||||
let arrangedPromise = waitForEvent(document.getElementById("start-topsites-grid"), "arranged");
|
||||
let arrangedPromise = waitForEvent(TopSitesTestHelper.grid, "arranged");
|
||||
yield TopSitesTestHelper.updatePagesAndWait();
|
||||
yield arrangedPromise;
|
||||
},
|
||||
run: function() {
|
||||
// unpin a pinned site
|
||||
// test that sites are unpinned as expected
|
||||
let grid = document.getElementById("start-topsites-grid"),
|
||||
let grid = TopSitesTestHelper.grid,
|
||||
items = grid.children;
|
||||
is(items.length, 8, this.desc + ": should be 8 topsites");
|
||||
let site = {
|
||||
@ -356,7 +362,7 @@ gTests.push({
|
||||
",dougal"
|
||||
);
|
||||
// pause until the update has fired and the view is finishd updating
|
||||
let arrangedPromise = waitForEvent(document.getElementById("start-topsites-grid"), "arranged");
|
||||
let arrangedPromise = waitForEvent(TopSitesTestHelper.grid, "arranged");
|
||||
yield TopSitesTestHelper.updatePagesAndWait();
|
||||
yield arrangedPromise;
|
||||
},
|
||||
@ -364,7 +370,7 @@ gTests.push({
|
||||
try {
|
||||
// block a site
|
||||
// test that sites are removed from the grid as expected
|
||||
let grid = document.getElementById("start-topsites-grid"),
|
||||
let grid = TopSitesTestHelper.grid,
|
||||
items = grid.children;
|
||||
is(items.length, 8, this.desc + ": should be 8 topsites");
|
||||
|
||||
@ -444,14 +450,14 @@ gTests.push({
|
||||
this.pins
|
||||
);
|
||||
// pause until the update has fired and the view is finishd updating
|
||||
let arrangedPromise = waitForEvent(document.getElementById("start-topsites-grid"), "arranged");
|
||||
let arrangedPromise = waitForEvent(TopSitesTestHelper.grid, "arranged");
|
||||
yield TopSitesTestHelper.updatePagesAndWait();
|
||||
yield arrangedPromise;
|
||||
},
|
||||
run: function() {
|
||||
// delete a both pinned and unpinned sites
|
||||
// test that sites are removed from the grid
|
||||
let grid = document.getElementById("start-topsites-grid"),
|
||||
let grid = TopSitesTestHelper.grid,
|
||||
items = grid.children;
|
||||
is(items.length, 4, this.desc + ": should be 4 topsites");
|
||||
|
||||
|
@ -91,19 +91,16 @@ function removeMockSearchDefault(aTimeoutMs) {
|
||||
=============================================================================*/
|
||||
|
||||
function test() {
|
||||
runTests();
|
||||
waitForExplicitFinish();
|
||||
Task.spawn(function(){
|
||||
yield addTab("about:blank");
|
||||
}).then(runTests);
|
||||
}
|
||||
|
||||
|
||||
function setUp() {
|
||||
if (!gEdit)
|
||||
gEdit = document.getElementById("urlbar-edit");
|
||||
|
||||
yield addTab("about:start");
|
||||
yield showNavBar();
|
||||
yield waitForCondition(function () {
|
||||
return StartUI.isStartPageVisible;
|
||||
});
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
@ -164,6 +161,8 @@ gTests.push({
|
||||
run: function testSearchKeyboard() {
|
||||
yield addMockSearchDefault();
|
||||
|
||||
yield waitForCondition(() => !Browser.selectedTab.isLoading());
|
||||
|
||||
sendElementTap(window, gEdit);
|
||||
ok(gEdit.isEditing, "focus urlbar: in editing mode");
|
||||
ok(!gEdit.popup.popupOpen, "focus urlbar: popup not open yet");
|
||||
@ -209,6 +208,8 @@ gTests.push({
|
||||
run: function testUrlbarSearchesTouch() {
|
||||
yield addMockSearchDefault();
|
||||
|
||||
yield waitForCondition(() => !Browser.selectedTab.isLoading());
|
||||
|
||||
sendElementTap(window, gEdit);
|
||||
ok(gEdit.isEditing, "focus urlbar: in editing mode");
|
||||
ok(!gEdit.popup.popupOpen, "focus urlbar: popup not open yet");
|
||||
|
@ -780,8 +780,9 @@ function runTests() {
|
||||
let badTabs = [];
|
||||
Browser.tabs.forEach(function(item, index, array) {
|
||||
let location = item.browser.currentURI.spec;
|
||||
if (index == 0 && location == "about:blank")
|
||||
if (index == 0 && location == "about:blank" || location == "about:start") {
|
||||
return;
|
||||
}
|
||||
ok(false, "Left over tab after test: '" + location + "'");
|
||||
badTabs.push(item);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user