Bug 1706381 - fix osx perma failures in test_viewWrapper_realFolder.js. r=darktrojan
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Sat, 21 May 2022 13:21:32 +0300
changeset 35790 dc0336a84ef2321bd4ae7ecf46635e0f8f273631
parent 35789 a0ca652319d8767d25810e448b05c6efa0f9c964
child 35791 be1c2780ec012a2e3c3721c92b7283584667172f
push id19941
push usermkmelin@iki.fi
push dateSat, 21 May 2022 10:26:59 +0000
treeherdercomm-central@be1c2780ec01 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdarktrojan
bugs1706381
Bug 1706381 - fix osx perma failures in test_viewWrapper_realFolder.js. r=darktrojan Differential Revision: https://phabricator.services.mozilla.com/D146587
mail/base/test/unit/test_viewWrapper_realFolder.js
--- a/mail/base/test/unit/test_viewWrapper_realFolder.js
+++ b/mail/base/test/unit/test_viewWrapper_realFolder.js
@@ -11,16 +11,17 @@
 /* import-globals-from resources/viewWrapperTestUtils.js */
 load("resources/viewWrapperTestUtils.js");
 initViewWrapperTestUtils({ mode: "local" });
 
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { SyntheticMessageSet } = ChromeUtils.import(
   "resource://testing-common/mailnews/MessageGenerator.jsm"
 );
+var { setTimeout } = ChromeUtils.import("resource://gre/modules/Timer.jsm");
 
 /* ===== Real Folder, no features ===== */
 
 /**
  * Open a pre-populated real folder, make sure all the messages show up.
  */
 add_task(async function test_real_folder_load() {
   let viewWrapper = make_view_wrapper();
@@ -375,16 +376,17 @@ add_task(async function test_real_folder
 
   let [[folder], setOne, setTwo] = await messageInjection.makeFoldersWithSets(
     1,
     [{}, {}]
   );
 
   // everything is unread to start with! #1
   viewWrapper.open(folder);
+  await new Promise(resolve => setTimeout(resolve));
   viewWrapper.setMailView(MailViewConstants.kViewItemUnread, null);
   verify_messages_in_view([setOne, setTwo], viewWrapper);
 
   // add some more things (unread!), make sure they appear. #2
   let [setThree] = await messageInjection.makeNewSetsInFolders([folder], [{}]);
   verify_messages_in_view([setOne, setTwo, setThree], viewWrapper);
 
   // make some things read, make sure they disappear. #3 (after refresh)
@@ -405,16 +407,17 @@ add_task(async function test_real_folder
   let [[folder], setOne, setTwo] = await messageInjection.makeFoldersWithSets(
     1,
     [{}, {}]
   );
   setOne.addTag("$label1");
 
   // open, apply mail view constraint, see those messages
   viewWrapper.open(folder);
+  await new Promise(resolve => setTimeout(resolve));
   viewWrapper.setMailView(MailViewConstants.kViewItemTags, "$label1");
   verify_messages_in_view(setOne, viewWrapper);
 
   // add some more with the tag
   setTwo.addTag("$label1");
 
   // make sure they showed up
   viewWrapper.refresh(); // QUICKSEARCH-VIEW-LIMITATION-REMOVE
@@ -447,16 +450,17 @@ add_task(async function test_real_folder
   // create a set that meets the threshold and a set that does not
   let [[folder], setRecent] = await messageInjection.makeFoldersWithSets(1, [
     { age: { mins: 0 } },
     { age: { days: 2 }, age_incr: { mins: 1 } },
   ]);
 
   // open the folder, ensure only the recent guys show. #1
   viewWrapper.open(folder);
+  await new Promise(resolve => setTimeout(resolve));
   viewWrapper.setMailView("Recent Mail", null);
   verify_messages_in_view(setRecent, viewWrapper);
 
   // add two more sets, one that meets, and one that doesn't. #2
   let [setMoreRecent] = await messageInjection.makeNewSetsInFolders(
     [folder],
     [
       { age: { mins: 0 } },
@@ -477,16 +481,17 @@ add_task(async function test_real_folder
   // create a set that meets the threshold and a set that does not
   let [[folder], setRecent] = await messageInjection.makeFoldersWithSets(1, [
     { age: { days: 2 }, age_incr: { mins: 1 } },
     { age: { days: 6 }, age_incr: { mins: 1 } },
   ]);
 
   // open the folder, ensure only the recent guys show. #1
   viewWrapper.open(folder);
+  await new Promise(resolve => setTimeout(resolve));
   viewWrapper.setMailView("Last 5 Days", null);
   verify_messages_in_view(setRecent, viewWrapper);
 
   // add two more sets, one that meets, and one that doesn't. #2
   let [setMoreRecent] = await messageInjection.makeNewSetsInFolders(
     [folder],
     [
       { age: { mins: 0 } },
@@ -509,16 +514,17 @@ add_task(async function test_real_folder
     setJunk,
     setNotJunk,
   ] = await messageInjection.makeFoldersWithSets(1, [{}, {}]);
   setJunk.setJunk(true);
   setNotJunk.setJunk(false);
 
   // open, see non-junk messages. #1
   viewWrapper.open(folder);
+  await new Promise(resolve => setTimeout(resolve));
   viewWrapper.setMailView("Not Junk", null);
   verify_messages_in_view(setNotJunk, viewWrapper);
 
   // add some more messages, have them be non-junk for now. #2
   let [setFlippy] = await messageInjection.makeNewSetsInFolders([folder], [{}]);
   setFlippy.setJunk(false);
   viewWrapper.refresh(); // QUICKSEARCH-VIEW-LIMITATION-REMOVE
   verify_messages_in_view([setNotJunk, setFlippy], viewWrapper);
@@ -546,16 +552,17 @@ add_task(async function test_real_folder
   };
   let noAttachSetDef = {};
 
   let [[folder], , setAttach] = await messageInjection.makeFoldersWithSets(1, [
     noAttachSetDef,
     attachSetDef,
   ]);
   viewWrapper.open(folder);
+  await new Promise(resolve => setTimeout(resolve));
   viewWrapper.setMailView("Has Attachments", null);
   verify_messages_in_view(setAttach, viewWrapper);
 
   let [setMoreAttach] = await messageInjection.makeNewSetsInFolders(
     [folder],
     [attachSetDef, noAttachSetDef]
   );
   verify_messages_in_view([setAttach, setMoreAttach], viewWrapper);