Bug 1557018 - Teach Mozmill about shadow DOM and fix broken calendar tests; rs=bustage-fix
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 06 Jun 2019 17:01:27 +1200
changeset 35787 53cdd29d9280a6c00b5a96ccc470c15e5de8992f
parent 35786 8aec6a4a364f83f339a27a4735a110874c84c180
child 35788 832d8eca475e442d2c51aa23f81d26a6cffffc0b
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersbustage-fix
bugs1557018
Bug 1557018 - Teach Mozmill about shadow DOM and fix broken calendar tests; rs=bustage-fix
calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js
calendar/test/mozmill/shared-modules/test-item-editing-helpers.js
mail/test/resources/mozmill/mozmill/extension/content/modules/elementslib.jsm
mail/test/resources/mozmill/setup.py
--- a/calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js
+++ b/calendar/test/mozmill/eventDialog/testEventDialogModificationPrompt.js
@@ -157,17 +157,17 @@ function handleSavePrompt(controller) {
     let { lookup: cdlglookup } = helpersForController(controller);
     // Unexpected prompt, thus the test has already failed.
     // Can't trigger a failure though, because the following click wouldn't
     // be executed. So remembering it.
     savePromptAppeared = true;
 
     // application close is blocked without it
     controller.waitThenClick(cdlglookup(`
-        /id("commonDialog")/anon({"anonid":"buttons"})/{"dlgtype":"extra1"}
+        /id("commonDialog")/shadow/{"class":"dialog-button-box"}/{"dlgtype":"extra1"}
     `));
 }
 
 function setupData() {
     return {
         date1: new Date(2009, 0, 1, 8, 0),
         date2: new Date(2009, 0, 2, 9, 0),
         date3: new Date(2009, 0, 3, 10, 0),
--- a/calendar/test/mozmill/shared-modules/test-item-editing-helpers.js
+++ b/calendar/test/mozmill/shared-modules/test-item-editing-helpers.js
@@ -60,17 +60,18 @@ var DATE_INPUT = `
     anon({"class":"datepicker-menulist"})/anon({"class":"menulist-input"})
 `;
 var TIME_INPUT = `
     anon({"class":"timepicker-menulist"})/anon({"class":"menulist-input"})
 `;
 
 // The following can be used as is.
 var REC_DLG_ACCEPT = `
-    /id("calendar-event-dialog-recurrence")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}
+    /id("calendar-event-dialog-recurrence")/shadow/
+    {"class":"dialog-button-box"}/{"dlgtype":"accept"}
 `;
 var REC_DLG_DAYS = `
     /id("calendar-event-dialog-recurrence")/id("recurrence-pattern-groupbox")/
     id("recurrence-pattern-grid")/id("recurrence-pattern-rows")/id("recurrence-pattern-period-row")/
     id("period-deck")/id("period-deck-weekly-box")/[1]/id("daypicker-weekday")
 `;
 var REC_DLG_UNTIL_INPUT = `
     /id("calendar-event-dialog-recurrence")/id("recurrence-range-groupbox")/[1]/
@@ -486,17 +487,17 @@ function setCategories(dialog, iframe, c
  */
 function handleAddingAttachment(controller, url) {
     let { eid } = helpersForController(controller);
     plan_for_modal_dialog("commonDialog", (attachment) => {
         let { lookup: cdlglookup, eid: cdlgid } = helpersForController(attachment);
         attachment.waitForElement(cdlgid("loginTextbox"));
         cdlgid("loginTextbox").getNode().value = url;
         attachment.click(cdlglookup(`
-            /id("commonDialog")/anon({"anonid":"buttons"})/{"dlgtype":"accept"}
+            /id("commonDialog")/shadow/{"class":"dialog-button-box"}/{"dlgtype":"accept"}
         `));
     });
     controller.click(eid("button-url"));
 
     wait_for_modal_dialog("commonDialog", TIMEOUT_MODAL_DIALOG);
 }
 
 /**
@@ -527,18 +528,18 @@ function addAttendees(dialog, innerFrame
                 );
                 attDialog.keypress(input, "VK_TAB", {});
                 attDialog.waitFor(() =>
                     attDialog.window.document.activeElement.getAttribute("class") == "textbox-input" &&
                     attDialog.window.document.activeElement.getAttribute("value") == null
                 );
                 attDialog.type(input, attendee);
                 attDialog.click(attlookup(`
-                    /id("calendar-event-dialog-attendees-v2")/anon({"anonid":"buttons"})/
-                    {"dlgtype":"accept"}
+                    /id("calendar-event-dialog-attendees-v2")/shadow/
+                    {"class":"dialog-button-box"}/{"dlgtype":"accept"}
                 `));
             });
             dialog.click(dlgid("button-attendees"));
             wait_for_modal_dialog("Calendar:EventDialog:Attendees", TIMEOUT_MODAL_DIALOG);
         }
     }
 }
 
@@ -581,18 +582,18 @@ function setTimezone(event, timezone) {
 
         let item = tzpath(`
             /*[name()='dialog']/*[name()='menulist'][1]/*[name()='menupopup'][1]/
             *[@value='${zone}']
         `);
         tzcontroller.waitForElement(item);
         tzcontroller.click(item);
         tzcontroller.click(tzlookup(`
-            /id("calendar-event-dialog-timezone")/anon({"anonid":"buttons"})/
-            {"dlgtype":"accept"}
+            /id("calendar-event-dialog-timezone")/shadow/
+            {"class":"dialog-button-box"}/{"dlgtype":"accept"}
         `));
     };
 
     if (eventid("timezone-starttime").getNode().collapsed) {
         let menuitem = eventid("options-timezones-menuitem");
         event.click(menuitem);
     }
 
--- a/mail/test/resources/mozmill/mozmill/extension/content/modules/elementslib.jsm
+++ b/mail/test/resources/mozmill/mozmill/extension/content/modules/elementslib.jsm
@@ -410,16 +410,21 @@ Lookup.prototype.getNode = function() {
   expSplit.unshift(this._view.document);
   var _document = this._view.document;
   var nCases = {"id": _byID, "name": _byName, "attrib": _byAttrib, "index": _byIndex};
   var aCases = {"name": _anonByName, "attrib": _anonByAttrib, "index": _anonByIndex};
   var reduceLookup = function(parent, exp) {
     // Handle case where only index is provided
     var cases = nCases;
 
+    // Handle custom elements shadow DOM
+    if (exp == "shadow") {
+      return parent.shadowRoot;
+    }
+
     // Handle ending index before any of the expression gets mangled
     if (exp.endsWith("]")) {
       var expIndex = JSON.parse(strings.vslice(exp, "[", "]"));
     }
     // Handle anon
     if (exp.startsWith("anon")) {
       exp = strings.vslice(exp, "(", ")");
       cases = aCases;
--- a/mail/test/resources/mozmill/setup.py
+++ b/mail/test/resources/mozmill/setup.py
@@ -36,17 +36,17 @@
 # ***** END LICENSE BLOCK *****
 
 from setuptools import setup, find_packages
 
 desc = """UI Automation tool for Mozilla applications."""
 summ = """A tool for full UI automation of Mozilla applications."""
 
 PACKAGE_NAME = "mozmill_thunderbird"
-PACKAGE_VERSION = "1.6.2"
+PACKAGE_VERSION = "1.6.3"
 
 setup(name=PACKAGE_NAME,
       version=PACKAGE_VERSION,
       description=desc,
       long_description=summ,
       author='Mozilla, Mikeal Rogers',
       author_email='mikeal.rogers@gmail.com',
       url='http://github.com/mozautomation/mozmill',