Bug 1428631 - Follow-up: fix composer focus tests. r=jorgk
authoraceman <acelists@atlas.sk>
Sun, 11 Mar 2018 15:34:00 +0100
changeset 30456 59c0f6e4825c4db83eb64c4dbd6ed11aee7be98e
parent 30455 be57cca86031e6b25598cdc7d05dc50d3f54c319
child 30457 c5590822b9cde4b5993edc556899c8b2275a3d1d
push id2140
push userclokep@gmail.com
push dateMon, 12 Mar 2018 19:42:51 +0000
treeherdercomm-beta@2d485f0d3723 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs1428631
Bug 1428631 - Follow-up: fix composer focus tests. r=jorgk
mail/test/mozmill/composition/test-focus.js
--- a/mail/test/mozmill/composition/test-focus.js
+++ b/mail/test/mozmill/composition/test-focus.js
@@ -3,27 +3,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * Test that cycling through the focus of the 3pane's panes works correctly.
  */
 var MODULE_NAME = "test-focus";
 
 var RELATIVE_ROOT = "../shared-modules";
-var MODULE_REQUIRES = ["compose-helpers", "folder-display-helpers",
+var MODULE_REQUIRES = ["folder-display-helpers", "compose-helpers",
                        "window-helpers"];
 
-
 function setupModule(module) {
-  let fdh = collector.getModule("folder-display-helpers");
-  fdh.installInto(module);
-  let ch = collector.getModule("compose-helpers");
-  ch.installInto(module);
-  let wh = collector.getModule("window-helpers");
-  wh.installInto(module);
+  for (let lib of MODULE_REQUIRES) {
+    collector.getModule(lib).installInto(module);
+  }
 }
 
 /**
  * Check that it's possible to cycle through the compose window's important
  * elements forward and backward.
  *
  * @param controller the compose window controller
  * @param attachmentsExpanded true if the attachment pane is expanded
@@ -34,17 +30,23 @@ function check_element_cycling(controlle
   let addressingElement = controller.e("addressingWidget");
   let subjectElement    = controller.e("msgSubject");
   let attachmentElement = controller.e("attachmentBucket");
   let contentElement    = controller.window.content;
   let identityElement   = controller.e("msgIdentity");
 
   let key = ctrlTab ? "VK_TAB" : "VK_F6";
 
-  // We start on the addressing widget and go from there...
+  // We start on the addressing widget and go from there.
+  // If we added an attachment, the attachment bucket got focused so
+  // we need to fix this first.
+  if (attachmentsExpanded) {
+    assert_equals(attachmentElement, controller.window.WhichElementHasFocus());
+    controller.window.SetMsgAddressingWidgetTreeElementFocus();
+  }
 
   controller.keypress(null, key, {ctrlKey: ctrlTab});
   assert_equals(subjectElement, controller.window.WhichElementHasFocus());
   if (attachmentsExpanded) {
     controller.keypress(null, key, {ctrlKey: ctrlTab});
     assert_equals(attachmentElement, controller.window.WhichElementHasFocus());
   }
   controller.keypress(null, key, {ctrlKey: ctrlTab});