browser_experimental_features_studies_disabled.js (1422B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 const { EnterprisePolicyTesting } = ChromeUtils.importESModule( 7 "resource://testing-common/EnterprisePolicyTesting.sys.mjs" 8 ); 9 10 add_task(async function testHiddenWhenLabsDisabled() { 11 const cleanup = await setupLabsTest(); 12 await SpecialPowers.pushPrefEnv({ 13 set: [["browser.preferences.experimental.hidden", false]], 14 }); 15 16 await EnterprisePolicyTesting.setupPolicyEngineWithJson({ 17 policies: { 18 UserMessaging: { FirefoxLabs: false }, 19 }, 20 }); 21 22 await BrowserTestUtils.openNewForegroundTab( 23 gBrowser, 24 "about:preferences#paneExperimental" 25 ); 26 27 const doc = gBrowser.contentDocument; 28 29 await TestUtils.waitForCondition( 30 () => doc.getElementById("category-experimental").hidden, 31 "Wait for Experimental Features section label to become hidden" 32 ); 33 34 is( 35 doc.getElementById("pane-experimental-featureGates"), 36 null, 37 "Experimental Features section not added to the DOM" 38 ); 39 40 is( 41 doc.querySelector(".category[selected]").id, 42 "category-general", 43 "When the experimental features section is hidden, navigating to #experimental should redirect to #general" 44 ); 45 46 BrowserTestUtils.removeTab(gBrowser.selectedTab); 47 48 await SpecialPowers.popPrefEnv(); 49 await cleanup(); 50 51 await EnterprisePolicyTesting.setupPolicyEngineWithJson({}); 52 });