Bug 1583043 - Wait for telemetry events before asserting in browser_entry_point_telemetry. r=jaws
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Wed, 25 Sep 2019 15:38:52 +0000
changeset 494927 dc5363b6f3142a0be0cd2a72fd6abd07ee470000
parent 494926 c6cdd18f14022f0f808da0142b2180b3bef9b266
child 494928 2b7c5d0a5fe2698312875d36b4c5858d05eac596
push id114131
push userdluca@mozilla.com
push dateThu, 26 Sep 2019 09:47:34 +0000
treeherdermozilla-inbound@1dc1a755079a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1583043
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1583043 - Wait for telemetry events before asserting in browser_entry_point_telemetry. r=jaws Differential Revision: https://phabricator.services.mozilla.com/D47101
toolkit/components/passwordmgr/test/LoginTestUtils.jsm
toolkit/components/passwordmgr/test/browser/browser_entry_point_telemetry.js
--- a/toolkit/components/passwordmgr/test/LoginTestUtils.jsm
+++ b/toolkit/components/passwordmgr/test/LoginTestUtils.jsm
@@ -533,19 +533,20 @@ this.LoginTestUtils.generation = {
 
 this.LoginTestUtils.telemetry = {
   async waitForEventCount(count, process = "content", category = "pwmgr") {
     let events = await TestUtils.waitForCondition(() => {
       let events = Services.telemetry.snapshotEvents(
         Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
         false
       )[process];
-      dump(`events: ${JSON.stringify(events, null, 2)}\n`);
+
       if (!events) {
         return null;
       }
+
       events = events.filter(e => e[1] == category);
       return events.length == count ? events : null;
     }, "waiting for telemetry event count of: " + count);
     Assert.equal(events.length, count, "waiting for telemetry event count");
     return events;
   },
 };
--- a/toolkit/components/passwordmgr/test/browser/browser_entry_point_telemetry.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_entry_point_telemetry.js
@@ -38,16 +38,17 @@ add_task(async function mainMenu_entryPo
     "Logins and passwords button is visible."
   );
 
   info("mainMenu_entryPoint, clicking on Logins and passwords button");
   let openingFunc = () => EventUtils.synthesizeMouseAtCenter(item, {});
   let passwordManager = await openPasswordManager(openingFunc);
   info("mainMenu_entryPoint, password manager dialog shown");
 
+  await LoginTestUtils.telemetry.waitForEventCount(1);
   TelemetryTestUtils.assertEvents(
     [["pwmgr", "open_management", "mainmenu"]],
     {
       category: "pwmgr",
       method: "open_management",
     },
     { clear: true, process: "content" }
   );