diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /browser/base/content/test/about/browser_aboutSupport.js | |
parent | Initial commit. (diff) | |
download | firefox-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 '')
-rw-r--r-- | browser/base/content/test/about/browser_aboutSupport.js | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/browser/base/content/test/about/browser_aboutSupport.js b/browser/base/content/test/about/browser_aboutSupport.js new file mode 100644 index 0000000000..e846a2b493 --- /dev/null +++ b/browser/base/content/test/about/browser_aboutSupport.js @@ -0,0 +1,146 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const { ExperimentAPI } = ChromeUtils.importESModule( + "resource://nimbus/ExperimentAPI.sys.mjs" +); +const { ExperimentFakes } = ChromeUtils.importESModule( + "resource://testing-common/NimbusTestUtils.sys.mjs" +); + +add_task(async function () { + await BrowserTestUtils.withNewTab( + { gBrowser, url: "about:support" }, + async function (browser) { + let keyLocationServiceGoogleStatus = await SpecialPowers.spawn( + browser, + [], + async function () { + let textBox = content.document.getElementById( + "key-location-service-google-box" + ); + await ContentTaskUtils.waitForCondition( + () => content.document.l10n.getAttributes(textBox).id, + "Google location service API key status loaded" + ); + return content.document.l10n.getAttributes(textBox).id; + } + ); + ok( + keyLocationServiceGoogleStatus, + "Google location service API key status shown" + ); + + let keySafebrowsingGoogleStatus = await SpecialPowers.spawn( + browser, + [], + async function () { + let textBox = content.document.getElementById( + "key-safebrowsing-google-box" + ); + await ContentTaskUtils.waitForCondition( + () => content.document.l10n.getAttributes(textBox).id, + "Google Safebrowsing API key status loaded" + ); + return content.document.l10n.getAttributes(textBox).id; + } + ); + ok( + keySafebrowsingGoogleStatus, + "Google Safebrowsing API key status shown" + ); + + let keyMozillaStatus = await SpecialPowers.spawn( + browser, + [], + async function () { + let textBox = content.document.getElementById("key-mozilla-box"); + await ContentTaskUtils.waitForCondition( + () => content.document.l10n.getAttributes(textBox).id, + "Mozilla API key status loaded" + ); + return content.document.l10n.getAttributes(textBox).id; + } + ); + ok(keyMozillaStatus, "Mozilla API key status shown"); + } + ); +}); + +add_task(async function test_nimbus_experiments() { + await ExperimentAPI.ready(); + let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({ + featureId: "aboutwelcome", + value: { enabled: true }, + }); + + await BrowserTestUtils.withNewTab( + { gBrowser, url: "about:support" }, + async function (browser) { + let experimentName = await SpecialPowers.spawn( + browser, + [], + async function () { + await ContentTaskUtils.waitForCondition( + () => + content.document.querySelector( + "#remote-experiments-tbody tr:first-child td" + )?.innerText + ); + return content.document.querySelector( + "#remote-experiments-tbody tr:first-child td" + ).innerText; + } + ); + ok( + experimentName.match("Nimbus"), + "Rendered the expected experiment slug" + ); + } + ); + + await doExperimentCleanup(); +}); + +add_task(async function test_remote_configuration() { + await ExperimentAPI.ready(); + let doCleanup = await ExperimentFakes.enrollWithRollout({ + featureId: NimbusFeatures.aboutwelcome.featureId, + value: { enabled: true }, + }); + + await BrowserTestUtils.withNewTab( + { gBrowser, url: "about:support" }, + async function (browser) { + let [userFacingName, branch] = await SpecialPowers.spawn( + browser, + [], + async function () { + await ContentTaskUtils.waitForCondition( + () => + content.document.querySelector( + "#remote-features-tbody tr:first-child td" + )?.innerText + ); + let rolloutName = content.document.querySelector( + "#remote-features-tbody tr:first-child td" + ).innerText; + let branchName = content.document.querySelector( + "#remote-features-tbody tr:first-child td:nth-child(2)" + ).innerText; + + return [rolloutName, branchName]; + } + ); + ok( + userFacingName.match("NimbusTestUtils"), + "Rendered the expected rollout" + ); + ok(branch.match("aboutwelcome"), "Rendered the expected rollout branch"); + } + ); + + await doCleanup(); +}); |