summaryrefslogtreecommitdiffstats
path: root/browser/components/preferences/tests/browser_experimental_features.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /browser/components/preferences/tests/browser_experimental_features.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/preferences/tests/browser_experimental_features.js')
-rw-r--r--browser/components/preferences/tests/browser_experimental_features.js74
1 files changed, 74 insertions, 0 deletions
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);
+});