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
--- 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."""