Bug 1595076 - Fix tests to deal with the newly introduced timeout between loading a page and counting ads. r=Standard8

Depends on D52640

Differential Revision: https://phabricator.services.mozilla.com/D54484

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike de Boer 2019-11-25 13:52:07 +00:00
Родитель 8f48d37dad
Коммит ffcf2404fd
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -10,6 +10,9 @@
const { SearchTelemetry } = ChromeUtils.import(
"resource:///modules/SearchTelemetry.jsm"
);
const { ADLINK_CHECK_TIMEOUT_MS } = ChromeUtils.import(
"resource:///actors/SearchTelemetryChild.jsm"
);
const TEST_PROVIDER_INFO = {
example: {
@ -255,6 +258,8 @@ add_task(async function test_track_ad_click() {
content.document.getElementById("ad1").click();
});
await pageLoadPromise;
/* eslint-disable-next-line mozilla/no-arbitrary-setTimeout */
await new Promise(resolve => setTimeout(resolve, ADLINK_CHECK_TIMEOUT_MS));
await assertTelemetry(
{ "example.in-content:sap:ff": 1 },
@ -268,6 +273,8 @@ add_task(async function test_track_ad_click() {
pageLoadPromise = BrowserTestUtils.waitForLocationChange(gBrowser);
gBrowser.goBack();
await pageLoadPromise;
/* eslint-disable-next-line mozilla/no-arbitrary-setTimeout */
await new Promise(resolve => setTimeout(resolve, ADLINK_CHECK_TIMEOUT_MS));
// We've gone back, so we register an extra display & if it is with ads or not.
await assertTelemetry(
@ -283,6 +290,8 @@ add_task(async function test_track_ad_click() {
content.document.getElementById("ad1").click();
});
await pageLoadPromise;
/* eslint-disable-next-line mozilla/no-arbitrary-setTimeout */
await new Promise(resolve => setTimeout(resolve, ADLINK_CHECK_TIMEOUT_MS));
await assertTelemetry(
{ "example.in-content:sap:ff": 2 },