Bug 1440703 - Add automated test to check that the Bookmarks Toolbar and Sidebar can be enabled from the Bookmarks Menu. r=Standard8
authorPaul Silaghi <psilaghi@mozilla.com>
Wed, 07 Mar 2018 10:47:43 +0200
changeset 407086 2339a45e7261
parent 407085 857cd5aebd4b
child 407087 262c064710de
push id33589
push usercsabou@mozilla.com
push dateThu, 08 Mar 2018 03:59:55 +0000
treeherdermozilla-central@888f3dded126 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs1440703
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1440703 - Add automated test to check that the Bookmarks Toolbar and Sidebar can be enabled from the Bookmarks Menu. r=Standard8
browser/components/places/tests/browser/browser.ini
browser/components/places/tests/browser/browser_enable_toolbar_sidebar.js
--- a/browser/components/places/tests/browser/browser.ini
+++ b/browser/components/places/tests/browser/browser.ini
@@ -62,16 +62,17 @@ skip-if = (os == 'win' && ccov) # Bug 14
 skip-if = (os == 'win' && ccov) # Bug 1423667
 [browser_copy_query_without_tree.js]
 skip-if = (os == 'win' && ccov) # Bug 1423667
 subsuite = clipboard
 [browser_cutting_bookmarks.js]
 skip-if = (os == 'win' && ccov) # Bug 1423667
 subsuite = clipboard
 [browser_drag_bookmarks_on_toolbar.js]
+[browser_enable_toolbar_sidebar.js]
 [browser_forgetthissite_single.js]
 [browser_history_sidebar_search.js]
 [browser_library_batch_delete.js]
 skip-if = (os == 'win' && ccov) # Bug 1423667
 [browser_library_commands.js]
 skip-if = (os == 'win' && ccov) # Bug 1423667
 [browser_library_delete_bookmarks_in_tags.js]
 [browser_library_delete_tags.js]
new file mode 100644
--- /dev/null
+++ b/browser/components/places/tests/browser/browser_enable_toolbar_sidebar.js
@@ -0,0 +1,66 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+/**
+ * Test that the Bookmarks Toolbar and Sidebar can be enabled from the Bookmarks Menu ("View history,
+ * saved bookmarks, and more" button.
+ */
+
+// Cleanup.
+registerCleanupFunction(async () => {
+  CustomizableUI.setToolbarVisibility("PersonalToolbar", false);
+  SidebarUI.hide();
+});
+
+async function selectAppMenuView(buttonId, viewId) {
+  let btn;
+  await BrowserTestUtils.waitForCondition(() => {
+    btn = document.getElementById(buttonId);
+    return btn;
+  }, "Should have the " + buttonId + "button");
+  let view = document.getElementById(viewId);
+  let viewPromise = BrowserTestUtils.waitForEvent(view, "ViewShown");
+  btn.click();
+  await viewPromise;
+}
+
+async function openBookmarkingToolsPanelInLibraryToolbarButton() {
+  await selectAppMenuView("library-button", "appMenu-libraryView");
+  await selectAppMenuView("appMenu-library-bookmarks-button", "PanelUI-bookmarks");
+  await selectAppMenuView("panelMenu_bookmarkingTools", "PanelUI-bookmarkingTools");
+}
+
+add_task(async function test_enable_toolbar() {
+  await openBookmarkingToolsPanelInLibraryToolbarButton();
+
+  let viewBookmarksToolbarBtn;
+  await BrowserTestUtils.waitForCondition(() => {
+    viewBookmarksToolbarBtn = document.getElementById("panelMenu_viewBookmarksToolbar");
+    return viewBookmarksToolbarBtn;
+  }, "Should have the library 'View Bookmarks Toolbar' button.");
+  viewBookmarksToolbarBtn.click();
+  let toolbar;
+  await BrowserTestUtils.waitForCondition(() => {
+    toolbar = document.getElementById("PersonalToolbar");
+    return !toolbar.collapsed;
+  }, "Should have the Bookmarks Toolbar enabled.");
+  Assert.ok(!toolbar.collapsed, "Bookmarks Toolbar is enabled");
+});
+
+add_task(async function test_enable_sidebar() {
+  await openBookmarkingToolsPanelInLibraryToolbarButton();
+
+  let viewBookmarksSidebarBtn;
+  await BrowserTestUtils.waitForCondition(() => {
+    viewBookmarksSidebarBtn = document.getElementById("panelMenu_viewBookmarksSidebar");
+    return viewBookmarksSidebarBtn;
+  }, "Should have the library 'View Bookmarks Sidebar' button.");
+  viewBookmarksSidebarBtn.click();
+  let sidebar;
+  await BrowserTestUtils.waitForCondition(() => {
+    sidebar = document.getElementById("sidebar-box");
+    return !sidebar.hidden;
+  }, "Should have the Bookmarks Sidebar enabled.");
+  Assert.ok(!sidebar.hidden, "Bookmarks Sidebar is enabled");
+});