Bug 1802564 - Toggle showSearchTerms to true on Nightly - r=adw

Differential Revision: https://phabricator.services.mozilla.com/D163221
This commit is contained in:
James Teow 2022-12-03 02:24:49 +00:00
parent 987d74f58e
commit 49a56597a4
7 changed files with 55 additions and 0 deletions

View file

@ -512,7 +512,11 @@ pref("browser.urlbar.sponsoredTopSites", false);
// Global toggle for whether the show search terms feature
// can be used at all, and enabled/disabled by the user.
#ifdef NIGHTLY_BUILD
pref("browser.urlbar.showSearchTerms.featureGate", true);
#else
pref("browser.urlbar.showSearchTerms.featureGate", false);
#endif
// If true, show the search term in the Urlbar while on
// a default search engine results page.

View file

@ -23,6 +23,9 @@ const PREF_FEATUREGATE = "browser.urlbar.showSearchTerms.featureGate";
If Nimbus experiment is enabled, check option visibility.
*/
add_task(async function showSearchTermsVisibility_experiment_beforeOpen() {
await SpecialPowers.pushPrefEnv({
set: [[PREF_FEATUREGATE, false]],
});
await QuickSuggestTestUtils.withExperiment({
valueOverrides: {
showSearchTermsFeatureGate: true,
@ -40,6 +43,7 @@ add_task(async function showSearchTermsVisibility_experiment_beforeOpen() {
gBrowser.removeCurrentTab();
},
});
await SpecialPowers.popPrefEnv();
});
/*
@ -47,6 +51,9 @@ add_task(async function showSearchTermsVisibility_experiment_beforeOpen() {
check option visibility on Preferences page.
*/
add_task(async function showSearchTermsVisibility_experiment_afterOpen() {
await SpecialPowers.pushPrefEnv({
set: [[PREF_FEATUREGATE, false]],
});
await openPreferencesViaOpenPreferencesAPI("search", { leaveOpen: true });
let doc = gBrowser.selectedBrowser.contentDocument;
let container = doc.getElementById(CHECKBOX_ID);
@ -74,6 +81,7 @@ add_task(async function showSearchTermsVisibility_experiment_afterOpen() {
);
gBrowser.removeCurrentTab();
await SpecialPowers.popPrefEnv();
});
/*

View file

@ -93,6 +93,12 @@ add_task(async function altGrReturnKeypress() {
add_task(async function searchOnEnterNoPick() {
info("Search on Enter without picking a urlbar result");
await SpecialPowers.pushPrefEnv({
// The test checks that the untrimmed value is equal to the spec.
// When using showSearchTerms, the untrimmed value becomes
// the search terms.
set: [["browser.urlbar.showSearchTerms.featureGate", false]],
});
// Why is BrowserTestUtils.openNewForegroundTab not causing the bug?
let promiseTabOpened = BrowserTestUtils.waitForEvent(
@ -126,6 +132,7 @@ add_task(async function searchOnEnterNoPick() {
// Cleanup.
BrowserTestUtils.removeTab(tab);
await SpecialPowers.popPrefEnv();
});
add_task(async function searchOnEnterSoon() {

View file

@ -101,6 +101,14 @@ add_task(async function interaction_restarted() {
});
add_task(async function interaction_refined() {
// The following tests do a second search immediately
// after an initial search. The showSearchTerms feature has to be
// disabled as subsequent searches from a default SERP are a
// a persisted_search_terms interaction.
await SpecialPowers.pushPrefEnv({
set: [["browser.urlbar.showSearchTerms.featureGate", false]],
});
await doTest(async browser => {
await openPopup("x");
await doEnter();
@ -140,6 +148,8 @@ add_task(async function interaction_refined() {
assertAbandonmentTelemetry([{ interaction: "typed" }]);
});
await SpecialPowers.popPrefEnv();
});
add_task(async function interaction_persisted_search_terms() {

View file

@ -127,6 +127,14 @@ add_task(async function interaction_restarted() {
});
add_task(async function interaction_refined() {
// The following tests do a second search immediately
// after an initial search. The showSearchTerms feature has to be
// disabled as subsequent searches from a default SERP are a
// a persisted_search_terms interaction.
await SpecialPowers.pushPrefEnv({
set: [["browser.urlbar.showSearchTerms.featureGate", false]],
});
await doTest(async browser => {
await openPopup("x");
await doEnter();
@ -178,6 +186,8 @@ add_task(async function interaction_refined() {
{ interaction: "typed" },
]);
});
await SpecialPowers.popPrefEnv();
});
add_task(async function interaction_persisted_search_terms() {

View file

@ -881,6 +881,12 @@ const tests = [
async function(win) {
info("Open search mode with a keyboard shortcut.");
// Bug 1797801: If the search mode used is the same as the default engine and
// showSearchTerms is enabled, the chiclet will remain in the urlbar on the search.
// Subsequent tests rely on search mode not already been selected.
await SpecialPowers.pushPrefEnv({
set: [["browser.urlbar.showSearchTerms.featureGate", false]],
});
let defaultEngine = await Services.search.getDefault();
win.gURLBar.select();
EventUtils.synthesizeKey("k", { accelKey: true }, win);
@ -900,6 +906,8 @@ const tests = [
EventUtils.synthesizeKey("VK_RETURN", {}, win);
await promise;
await SpecialPowers.popPrefEnv();
return {
category: "urlbar",
method: "engagement",

View file

@ -1022,6 +1022,13 @@ add_task(async function test_formHistory_enterSelection() {
});
add_task(async function test_privateWindow() {
// This test assumes the showSearchTerms feature is not enabled,
// as multiple searches are made one after another, relying on
// urlbar as the keyed scalar SAP, not urlbar_persisted.
await SpecialPowers.pushPrefEnv({
set: [["browser.urlbar.showSearchTerms.featureGate", false]],
});
// Override the search telemetry search provider info to
// count in-content SEARCH_COUNTs telemetry for our test engine.
SearchSERPTelemetry.overrideSearchTelemetryForTests([
@ -1217,4 +1224,5 @@ add_task(async function test_privateWindow() {
// Reset the search provider info.
SearchSERPTelemetry.overrideSearchTelemetryForTests();
await UrlbarTestUtils.formHistory.clear();
await SpecialPowers.popPrefEnv();
});