From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../tests/browser_experimental_features.js | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 browser/components/preferences/tests/browser_experimental_features.js (limited to 'browser/components/preferences/tests/browser_experimental_features.js') diff --git a/browser/components/preferences/tests/browser_experimental_features.js b/browser/components/preferences/tests/browser_experimental_features.js new file mode 100644 index 0000000000..cecbb60893 --- /dev/null +++ b/browser/components/preferences/tests/browser_experimental_features.js @@ -0,0 +1,74 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +add_task(async function testPrefRequired() { + await SpecialPowers.pushPrefEnv({ + set: [["browser.preferences.experimental", false]], + }); + + await openPreferencesViaOpenPreferencesAPI("paneHome", { leaveOpen: true }); + let doc = gBrowser.contentDocument; + + let experimentalCategory = doc.getElementById("category-experimental"); + ok(experimentalCategory, "The category exists"); + ok(experimentalCategory.hidden, "The category is hidden"); + + BrowserTestUtils.removeTab(gBrowser.selectedTab); +}); + +add_task(async function testCanOpenWithPref() { + await SpecialPowers.pushPrefEnv({ + set: [["browser.preferences.experimental", true]], + }); + + await openPreferencesViaOpenPreferencesAPI("paneHome", { leaveOpen: true }); + let doc = gBrowser.contentDocument; + + let experimentalCategory = doc.getElementById("category-experimental"); + ok(experimentalCategory, "The category exists"); + ok(!experimentalCategory.hidden, "The category is not hidden"); + + let categoryHeader = await TestUtils.waitForCondition( + () => doc.getElementById("firefoxExperimentalCategory"), + "Waiting for experimental features category to get initialized" + ); + ok( + categoryHeader.hidden, + "The category header should be hidden when Home is selected" + ); + + EventUtils.synthesizeMouseAtCenter(experimentalCategory, {}, doc.ownerGlobal); + await TestUtils.waitForCondition( + () => !categoryHeader.hidden, + "Waiting until category is visible" + ); + + BrowserTestUtils.removeTab(gBrowser.selectedTab); +}); + +add_task(async function testSearchFindsExperiments() { + await SpecialPowers.pushPrefEnv({ + set: [["browser.preferences.experimental", true]], + }); + + await openPreferencesViaOpenPreferencesAPI("paneHome", { leaveOpen: true }); + let doc = gBrowser.contentDocument; + + let experimentalCategory = doc.getElementById("category-experimental"); + ok(experimentalCategory, "The category exists"); + ok(!experimentalCategory.hidden, "The category is not hidden"); + + await TestUtils.waitForCondition( + () => doc.getElementById("firefoxExperimentalCategory"), + "Waiting for experimental features category to get initialized" + ); + await evaluateSearchResults( + "advanced configuration", + ["pane-experimental-featureGates"], + /* include experiments */ true + ); + + BrowserTestUtils.removeTab(gBrowser.selectedTab); +}); -- cgit v1.2.3