Bug 1352120 - to fold: test changes, r?mak draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 21 Jun 2017 15:06:32 +0100
changeset 599779 9ce29c693a37a314f6583826ffec3ad300dc7be5
parent 599778 29f4339cb03f3b63f7effd1162f1d246b7d4e151
child 599780 6e3b75f439804e15a3626c217edeffbeba5cc209
push id65603
push userbmo:gijskruitbosch+bugs@gmail.com
push dateFri, 23 Jun 2017 16:41:40 +0000
reviewersmak
bugs1352120
milestone56.0a1
Bug 1352120 - to fold: test changes, r?mak 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,17 @@
 
 "use strict";
 
 /**
  * Test opening and closing the bookmarks panel.
  */
 
 let bookmarkPanel = document.getElementById("editBookmarkPanel");
-let bookmarkStar = document.getElementById("bookmarks-menu-button");
+let bookmarkStar = BookmarkingUI.star;
 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,20 +13,23 @@ 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;
   ok(!newBookmarkItem.hasAttribute("disabled"), "New bookmark item shouldn't be disabled");
   let contextMenuHiddenPromise = onPopupEvent(contextMenu, "hidden");
--- a/testing/firefox-ui/tests/puppeteer/test_places.py
+++ b/testing/firefox-ui/tests/puppeteer/test_places.py
@@ -1,14 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from firefox_puppeteer import PuppeteerMixin
-from marionette_driver import By, Wait
+from marionette_driver import Wait
 from marionette_harness import MarionetteTestCase
 
 
 class TestPlaces(PuppeteerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestPlaces, self).setUp()
 
@@ -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())