Bug 1352120 - tests draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 21 Jun 2017 15:06:32 +0100
changeset 598285 82cdcf6f6e985d2731805d6ce0d3eb73adb63c4f
parent 598284 203d4000a42b59ad45a1f4838bb9c5c627aa5895
child 634438 3a8ed5090a4366057820a2a95300b993a2681712
push id65163
push userbmo:gijskruitbosch+bugs@gmail.com
push dateWed, 21 Jun 2017 15:24:25 +0000
bugs1352120
milestone56.0a1
Bug 1352120 - tests MozReview-Commit-ID: GLBIyws7FaB
browser/base/content/test/general/browser_bookmark_popup.js
browser/components/customizableui/test/browser_914138_widget_API_overflowable_toolbar.js
browser/components/customizableui/test/browser_984455_bookmarks_items_reparenting.js
browser/components/places/tests/browser/browser_toolbarbutton_menu_context.js
testing/firefox-ui/tests/puppeteer/test_places.py
--- a/browser/base/content/test/general/browser_bookmark_popup.js
+++ b/browser/base/content/test/general/browser_bookmark_popup.js
@@ -4,17 +4,19 @@
 
 "use strict";
 
 /**
  * Test opening and closing the bookmarks panel.
  */
 
 let bookmarkPanel = document.getElementById("editBookmarkPanel");
-let bookmarkStar = document.getElementById("bookmarks-menu-button");
+let bookmarkStar = AppConstants.MOZ_PHOTON_THEME ?
+  document.getElementById("star-button") :
+  document.getElementById("bookmarks-menu-button");
 let bookmarkPanelTitle = document.getElementById("editBookmarkPanelTitle");
 let editBookmarkPanelRemoveButtonRect;
 
 StarUI._closePanelQuickForTesting = true;
 
 async function test_bookmarks_popup({isNewBookmark, popupShowFn, popupEditFn,
                                 shouldAutoClose, popupHideFn, isBookmarkRemoved}) {
   await BrowserTestUtils.withNewTab({gBrowser, url: "about:home"}, async function(browser) {
--- a/browser/components/customizableui/test/browser_914138_widget_API_overflowable_toolbar.js
+++ b/browser/components/customizableui/test/browser_914138_widget_API_overflowable_toolbar.js
@@ -8,17 +8,16 @@ var navbar = document.getElementById(Cus
 var overflowList = document.getElementById(navbar.getAttribute("overflowtarget"));
 
 const kTestBtn1 = "test-addWidgetToArea-overflow";
 const kTestBtn2 = "test-removeWidgetFromArea-overflow";
 const kTestBtn3 = "test-createWidget-overflow";
 const kHomeBtn = "home-button";
 const kDownloadsBtn = "downloads-button";
 const kSearchBox = "search-container";
-const kStarBtn = "bookmarks-menu-button";
 
 var originalWindowWidth;
 
 // Adding a widget should add it next to the widget it's being inserted next to.
 add_task(async function() {
   originalWindowWidth = window.outerWidth;
   createDummyXULButton(kTestBtn1, "Test");
   ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
--- a/browser/components/customizableui/test/browser_984455_bookmarks_items_reparenting.js
+++ b/browser/components/customizableui/test/browser_984455_bookmarks_items_reparenting.js
@@ -68,19 +68,21 @@ function checkSpecialContextMenus() {
     const kSpecialItemIDs = {
       "BMB_bookmarksToolbar": "BMB_bookmarksToolbarPopup",
       "BMB_unsortedBookmarks": "BMB_unsortedBookmarksPopup",
     };
 
     // Open the bookmarks menu button context menus and ensure that
     // they have the proper views attached.
     let shownPromise = bookmarksMenuPanelShown();
-    let dropmarker = document.getAnonymousElementByAttribute(bookmarksMenuButton,
-                                                             "anonid", "dropmarker");
-    EventUtils.synthesizeMouseAtCenter(dropmarker, {});
+    if (!AppConstants.MOZ_PHOTON_THEME) {
+      bookmarksMenuButton = document.getAnonymousElementByAttribute(bookmarksMenuButton,
+                                                                    "anonid", "dropmarker");
+    }
+    EventUtils.synthesizeMouseAtCenter(bookmarksMenuButton, {});
     info("Waiting for bookmarks menu popup to show after clicking dropmarker.")
     await shownPromise;
 
     for (let menuID in kSpecialItemIDs) {
       let menuItem = document.getElementById(menuID);
       let menuPopup = document.getElementById(kSpecialItemIDs[menuID]);
       info("Waiting to open menu for " + menuID);
       shownPromise = popupShown(menuPopup);
--- a/browser/components/places/tests/browser/browser_toolbarbutton_menu_context.js
+++ b/browser/components/places/tests/browser/browser_toolbarbutton_menu_context.js
@@ -13,26 +13,30 @@ add_task(async function testPopup() {
                                 : CustomizableUI.AREA_PANEL;
   CustomizableUI.addWidgetToArea("bookmarks-menu-button", target);
   CustomizableUI.addWidgetToArea("bookmarks-menu-button", CustomizableUI.AREA_NAVBAR, pos);
   info("Checking popup context menu after moving the bookmarks button");
   await checkPopupContextMenu();
 });
 
 async function checkPopupContextMenu() {
-  let dropmarker = document.getAnonymousElementByAttribute(bookmarksMenuButton, "anonid", "dropmarker");
+  let clickTarget = bookmarksMenuButton;
+  if (!AppConstants.MOZ_PHOTON_THEME) {
+    clickTarget = document.getAnonymousElementByAttribute(bookmarksMenuButton, "anonid", "dropmarker");
+  }
   BMB_menuPopup.setAttribute("style", "transition: none;");
   let popupShownPromise = onPopupEvent(BMB_menuPopup, "shown");
-  EventUtils.synthesizeMouseAtCenter(dropmarker, {});
+  EventUtils.synthesizeMouseAtCenter(clickTarget, {});
   info("Waiting for bookmarks menu to be shown.");
   await popupShownPromise;
   let contextMenuShownPromise = onPopupEvent(contextMenu, "shown");
   EventUtils.synthesizeMouseAtCenter(BMB_showAllBookmarks, {type: "contextmenu", button: 2 });
   info("Waiting for context menu on bookmarks menu to be shown.");
   await contextMenuShownPromise;
+  await new Promise(r => setTimeout(r, 5000));
   ok(!newBookmarkItem.hasAttribute("disabled"), "New bookmark item shouldn't be disabled");
   let contextMenuHiddenPromise = onPopupEvent(contextMenu, "hidden");
   contextMenu.hidePopup();
   BMB_menuPopup.removeAttribute("style");
   info("Waiting for context menu on bookmarks menu to be hidden.");
   await contextMenuHiddenPromise;
   let popupHiddenPromise = onPopupEvent(BMB_menuPopup, "hidden");
   // Can't use synthesizeMouseAtCenter because the dropdown panel is in the way
--- a/testing/firefox-ui/tests/puppeteer/test_places.py
+++ b/testing/firefox-ui/tests/puppeteer/test_places.py
@@ -42,17 +42,17 @@ class TestPlaces(PuppeteerMixin, Marione
           return urls;
         """)
 
     def test_plugins(self):
         # TODO: Once we use a plugin, add a test case to verify that the data will be removed
         self.puppeteer.places.clear_plugin_data()
 
     def test_bookmarks(self):
-        star_button = self.marionette.find_element(By.ID, 'bookmarks-menu-button')
+        star_button = self.marionette.execute_script("return BookmarkingUI.star");
 
         # Visit URLs and bookmark them all
         for url in self.urls:
             with self.marionette.using_context('content'):
                 self.marionette.navigate(url)
 
             Wait(self.marionette).until(
                 lambda _: self.puppeteer.places.is_bookmark_star_button_ready())