Bug 1379292 - Added filtering for pings based on type and reason draft
authorJohn Dorlus <jsdorlus@gmail.com>
Mon, 10 Jul 2017 16:13:37 -0400
changeset 606303 24bc769495def157ab4bb940f2a5ea4b85e93a36
parent 602911 587daa4bdc4b40b7053f4ca3b74723ca747f3b52
child 606304 a1debf063e356e0a066ac722747dd3a0251d1c8f
child 606973 7bd1e425b70aad5f3a287ce1ce1f679d958fda77
push id67673
push userbmo:jdorlus@mozilla.com
push dateMon, 10 Jul 2017 21:15:39 +0000
bugs1379292
milestone56.0a1
Bug 1379292 - Added filtering for pings based on type and reason Added change to testcase class to filter pings based on type and reason and also to ensure that only one ping matches the criteria. MozReview-Commit-ID: 8xyjbX0R8lt
toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py
--- a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py
+++ b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py
@@ -45,22 +45,26 @@ class TelemetryTestCase(PuppeteerMixin, 
             'toolkit.telemetry.log.level': 0,
             'toolkit.telemetry.log.dump': True,
             'toolkit.telemetry.send.overrideOfficialCheck': True
         }
 
         # Firefox will be forced to restart with the prefs enforced.
         self.marionette.enforce_gecko_prefs(telemetry_prefs)
 
-    def wait_for_ping(self):
+    def wait_for_ping(self, ping_filter_func):
         if len(self.ping_list) == 0:
             try:
                 Wait(self.marionette, 60).until(lambda t: len(self.ping_list) > 0)
             except Exception as e:
                 self.fail('Error generating ping: {}'.format(e.message))
+
+        # Filter pings based on type and reason to make sure right ping is captured.
+        self.ping_list = [p for p in self.ping_list if ping_filter_func(p)]
+        assert len(self.ping_list) == 1
         return self.ping_list.pop()
 
     def toggle_update_pref(self):
         value = self.marionette.get_pref('app.update.enabled')
         self.marionette.enforce_gecko_prefs({'app.update.enabled': not value})
 
     def restart_browser(self):
         """Restarts browser while maintaining the same profile and session."""