Bug 1557369 - Disable extension recommendations in discopane tests r=mstriemer,zombie,mixedpuppy

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Rob Wu 2019-06-06 16:45:16 +00:00
parent 1a1341430b
commit b43139b7b6
3 changed files with 30 additions and 0 deletions

View File

@ -282,6 +282,9 @@ add_task(async function setup() {
// Enable HTML for all because some tests load non-discopane views.
["extensions.htmlaboutaddons.enabled", true],
["extensions.htmlaboutaddons.discover.enabled", true],
// Disable non-discopane recommendations to avoid unexpected discovery
// API requests.
["extensions.htmlaboutaddons.recommendations.enabled", false],
// Disable the telemetry client ID (and its associated UI warning).
// browser_html_discover_view_clientid.js covers this functionality.
["browser.discovery.enabled", false],

View File

@ -54,6 +54,11 @@ add_task(async function setup() {
["app.support.baseURL", `${serverBaseUrl}sumo/`],
["extensions.htmlaboutaddons.discover.enabled", true],
["extensions.htmlaboutaddons.enabled", true],
// Discovery API requests can be triggered by the discopane and the
// recommendations in the list view. To make sure that the every test
// checks the behavior of the view they're testing, ensure that only one
// of the two views is enabled at a time.
["extensions.htmlaboutaddons.recommendations.enabled", false],
],
});
});
@ -143,6 +148,14 @@ add_task(async function clientid_from_private_window() {
});
add_task(async function clientid_enabled_from_extension_list() {
await SpecialPowers.pushPrefEnv({
// Override prefs from setup to enable recommendations.
set: [
["extensions.htmlaboutaddons.discover.enabled", false],
["extensions.htmlaboutaddons.recommendations.enabled", true],
],
});
// Force the extension list to be the first load. This pref will be
// overwritten once the view loads.
Services.prefs.setCharPref(PREF_UI_LASTCATEGORY, "addons://list/extension");
@ -164,9 +177,18 @@ add_task(async function clientid_enabled_from_extension_list() {
await recommendations.loadCardsIfNeeded();
await closeView(win);
await SpecialPowers.popPrefEnv();
});
add_task(async function clientid_enabled_from_theme_list() {
await SpecialPowers.pushPrefEnv({
// Override prefs from setup to enable recommendations.
set: [
["extensions.htmlaboutaddons.discover.enabled", false],
["extensions.htmlaboutaddons.recommendations.enabled", true],
],
});
// Force the theme list to be the first load. This pref will be overwritten
// once the view loads.
Services.prefs.setCharPref(PREF_UI_LASTCATEGORY, "addons://list/theme");
@ -188,4 +210,5 @@ add_task(async function clientid_enabled_from_theme_list() {
"Moz-Client-Id is now sent for extensions");
await closeView(win);
await SpecialPowers.popPrefEnv();
});

View File

@ -48,6 +48,10 @@ add_task(async function setup() {
set: [
["extensions.getAddons.discovery.api_url", TEST_API_URL],
["extensions.htmlaboutaddons.discover.enabled", true],
// Disable recommendations at the HTML about:addons view to avoid sending
// a discovery API request from the fallback view (extension list) in the
// showPane_false test.
["extensions.htmlaboutaddons.recommendations.enabled", false],
],
});
});