Bug 1521016 - adjust test expectations now that "reset" only resets order, not actual state. r+a=jorgk
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Fri, 08 Feb 2019 12:51:35 +0200
changeset 34329 2d307b1bc4a3fb68e0b19f7b66c1bba2acb490f5
parent 34328 86cb9d0c8982cc11dc6e85f8f3471675b9739037
child 34330 6dbb5631f6aef9ce800b7715dafd332c8a043910
push id389
push userclokep@gmail.com
push dateMon, 18 Mar 2019 19:01:53 +0000
bugs1521016
Bug 1521016 - adjust test expectations now that "reset" only resets order, not actual state. r+a=jorgk
mail/test/mozmill/folder-display/test-columns.js
--- a/mail/test/mozmill/folder-display/test-columns.js
+++ b/mail/test/mozmill/folder-display/test-columns.js
@@ -5,24 +5,23 @@
 "use strict";
 
 var elib = {};
 ChromeUtils.import("chrome://mozmill/content/modules/elementslib.js", elib);
 
 // needed to zero inter-folder processing delay
 ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
-
 /*
  * Test column default logic and persistence logic.  Persistence comes in both
  *  tab-switching (because of the multiplexed implementation) and
  *  folder-switching forms.
  */
 
-// make SOLO_TEST=folder-display/test-columns.js mozmill-one
+// make mozmill-one SOLO_TEST=folder-display/test-columns.js
 
 var MODULE_NAME = 'test-columns';
 
 var RELATIVE_ROOT = '../shared-modules';
 var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers'];
 
 var folderInbox, folderSent, folderVirtual, folderA, folderB;
 // INBOX_DEFAULTS sans 'dateCol' but gains 'tagsCol'
@@ -86,16 +85,30 @@ function setupModule(module) {
     "subjectCol",
     useCorrespondent ? "correspondentCol" : "senderCol",
     "dateCol",
     "locationCol"
   ];
 }
 
 /**
+ * Get the currently visible threadTree columns.
+ */
+function get_visible_threadtree_columns() {
+  let cols = mc.e("threadTree").columns;
+  let visibleColumnIds = [];
+  for (let col = cols.getFirstColumn(); col != null; col = col.getNext()) {
+    if (col.element.getAttribute("hidden") != "true") {
+      visibleColumnIds.push(col.id);
+    }
+  }
+  return visibleColumnIds;
+}
+
+/**
  * Verify that the provided list of columns is visible in the given order,
  *  throwing an exception if it is not the case.
  *
  * @param aDesiredColumns A list of column ID strings for columns that should be
  *     visible in the order that they should be visisble.
  */
 function assert_visible_columns(aDesiredColumns) {
   let cols = mc.e("threadTree").columns;
@@ -440,54 +453,55 @@ function test_apply_to_folder_no_childre
  *  Make sure the folder and its children change.
  */
 function test_apply_to_folder_and_children() {
   // no need to throttle ourselves during testing.
   MailUtils.INTER_FOLDER_PROCESSING_DELAY_MS = 0;
 
   be_in_folder(folderSource);
 
-  // reset!
-  invoke_column_picker_option([{anonid: "menuitem"}]);
+  invoke_column_picker_option([{anonid: "menuitem"}]); // reset order!
+  let cols = get_visible_threadtree_columns();
 
   // permute!
-  let conExtra = INBOX_DEFAULTS.concat(["tagsCol"]);
+  let conExtra = cols.concat(["tagsCol"]);
   show_column("tagsCol");
   assert_visible_columns(conExtra);
 
   // apply to the dude and his offspring
   _apply_to_folder_common(true, folderParent);
 
   // make sure it copied to the parent and his children
   be_in_folder(folderParent);
   assert_visible_columns(conExtra);
   be_in_folder(folderChild1);
   assert_visible_columns(conExtra);
   be_in_folder(folderChild2);
   assert_visible_columns(conExtra);
 }
-test_apply_to_folder_and_children.EXCLUDED_PLATFORMS = ['linux'];  // See bug 1406717.
-test_apply_to_folder_and_children.__force_skip__ = true;  // See bug 1521016.
 
 /**
  * Change settings in an incoming folder, apply them to an outgoing folder that
  * also has children. Make sure the folder changes but the children do not.
  */
 function test_apply_to_folder_no_children_swapped() {
   folderParent = create_folder("ColumnsApplyParentOutgoing");
   folderParent.setFlag(Ci.nsMsgFolderFlags.SentMail);
   folderParent.createSubfolder("Child1", null);
   folderChild1 = folderParent.getChildNamed("Child1");
   folderParent.createSubfolder("Child2", null);
   folderChild2 = folderParent.getChildNamed("Child2");
 
   be_in_folder(folderSource);
 
-  // reset!
-  invoke_column_picker_option([{anonid: "menuitem"}]);
+  invoke_column_picker_option([{anonid: "menuitem"}]); // reset order!
+  // Hide the columns that were added in other tests, since reset now
+  // only resets the order.
+  hide_column("tagsCol");
+  hide_column("sizeCol")
 
   // permute!
   let conExtra = [...INBOX_DEFAULTS];
   if (useCorrespondent) {
     conExtra[5] = "senderCol";
     hide_column("correspondentCol");
     show_column("senderCol");
   } else {
@@ -507,31 +521,28 @@ function test_apply_to_folder_no_childre
   assert_visible_columns(conExtraSwapped);
 
   // But not the children.
   be_in_folder(folderChild1);
   assert_visible_columns(SENT_DEFAULTS);
   be_in_folder(folderChild2);
   assert_visible_columns(SENT_DEFAULTS);
 }
-test_apply_to_folder_no_children_swapped.EXCLUDED_PLATFORMS = ['linux'];  // See bug 1406717.
-test_apply_to_folder_no_children_swapped.__force_skip__ = true;  // See bug 1521016.
 
 /**
  * Change settings in an incoming folder, apply them to an outgoing folder and
  * its children. Make sure the folder and its children change.
  */
 function test_apply_to_folder_and_children_swapped() {
   // No need to throttle ourselves during testing.
   MailUtils.INTER_FOLDER_PROCESSING_DELAY_MS = 0;
 
   be_in_folder(folderSource);
 
-  // reset!
-  invoke_column_picker_option([{anonid: "menuitem"}]);
+  invoke_column_picker_option([{anonid: "menuitem"}]); // reset order!
 
   // permute!
   let conExtra = [...INBOX_DEFAULTS];
   if (useCorrespondent) {
     conExtra[5] = "senderCol";
     hide_column("correspondentCol");
     show_column("senderCol");
   } else {
@@ -549,18 +560,16 @@ function test_apply_to_folder_and_childr
   conExtraSwapped[5] = useCorrespondent ? "recipientCol" : "correspondentCol";
   be_in_folder(folderParent);
   assert_visible_columns(conExtraSwapped);
   be_in_folder(folderChild1);
   assert_visible_columns(conExtraSwapped);
   be_in_folder(folderChild2);
   assert_visible_columns(conExtraSwapped);
 }
-test_apply_to_folder_and_children_swapped.EXCLUDED_PLATFORMS = ['linux'];  // See bug 1406717.
-test_apply_to_folder_and_children_swapped.__force_skip__ = true;  // See bug 1521016.
 
 /**
  * Create a fake gloda collection.
  */
 function FakeCollection() {
   this.items = [];
 }