diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /browser/components/urlbar/tests/quicksuggest | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/urlbar/tests/quicksuggest')
7 files changed, 64 insertions, 76 deletions
diff --git a/browser/components/urlbar/tests/quicksuggest/browser/browser_quicksuggest.js b/browser/components/urlbar/tests/quicksuggest/browser/browser_quicksuggest.js index 98f6ba6117..87f94a641b 100644 --- a/browser/components/urlbar/tests/quicksuggest/browser/browser_quicksuggest.js +++ b/browser/components/urlbar/tests/quicksuggest/browser/browser_quicksuggest.js @@ -34,6 +34,27 @@ const REMOTE_SETTINGS_RESULTS = [ }, ]; +const MERINO_NAVIGATIONAL_SUGGESTION = { + url: "https://example.com/navigational-suggestion", + title: "Navigational suggestion", + provider: "top_picks", + is_sponsored: false, + score: 0.25, + block_id: 0, + is_top_pick: true, +}; + +const MERINO_DYNAMIC_WIKIPEDIA_SUGGESTION = { + url: "https://example.com/dynamic-wikipedia", + title: "Dynamic Wikipedia suggestion", + click_url: "https://example.com/click", + impression_url: "https://example.com/impression", + advertiser: "dynamic-wikipedia", + provider: "wikipedia", + iab_category: "5 - Education", + block_id: 1, +}; + add_setup(async function () { await PlacesUtils.history.clear(); await PlacesUtils.bookmarks.eraseEverything(); @@ -46,7 +67,11 @@ add_setup(async function () { attachment: REMOTE_SETTINGS_RESULTS, }, ], + merinoSuggestions: [], }); + + // Disable Merino so we trigger only remote settings suggestions. + UrlbarPrefs.set("quicksuggest.dataCollection.enabled", false); }); // Tests a sponsored result and keyword highlighting. @@ -167,30 +192,9 @@ add_tasks_with_rust( // Tests the "Manage" result menu for sponsored suggestion. add_tasks_with_rust(async function resultMenu_manage_sponsored() { - await BrowserTestUtils.withNewTab({ gBrowser }, async browser => { - await UrlbarTestUtils.promiseAutocompleteResultPopup({ - window, - value: "fra", - }); - - const managePage = "about:preferences#search"; - let onManagePageLoaded = BrowserTestUtils.browserLoaded( - browser, - false, - managePage - ); - // Click the command. - await UrlbarTestUtils.openResultMenuAndClickItem(window, "manage", { - resultIndex: 1, - }); - await onManagePageLoaded; - Assert.equal( - browser.currentURI.spec, - managePage, - "The manage page is loaded" - ); - - await UrlbarTestUtils.promisePopupClose(window); + await doManageTest({ + input: "fra", + index: 1, }); }); @@ -201,3 +205,35 @@ add_tasks_with_rust(async function resultMenu_manage_nonSponsored() { index: 1, }); }); + +// Tests the "Manage" result menu for Navigational suggestion. +add_tasks_with_rust(async function resultMenu_manage_navigational() { + // Enable Merino. + UrlbarPrefs.set("quicksuggest.dataCollection.enabled", true); + MerinoTestUtils.server.response.body.suggestions = [ + MERINO_NAVIGATIONAL_SUGGESTION, + ]; + + await doManageTest({ + input: "test", + index: 1, + }); + + UrlbarPrefs.clear("quicksuggest.dataCollection.enabled"); +}); + +// Tests the "Manage" result menu for Dynamic Wikipedia suggestion. +add_tasks_with_rust(async function resultMenu_manage_dynamicWikipedia() { + // Enable Merino. + UrlbarPrefs.set("quicksuggest.dataCollection.enabled", true); + MerinoTestUtils.server.response.body.suggestions = [ + MERINO_DYNAMIC_WIKIPEDIA_SUGGESTION, + ]; + + await doManageTest({ + input: "test", + index: 1, + }); + + UrlbarPrefs.clear("quicksuggest.dataCollection.enabled"); +}); diff --git a/browser/components/urlbar/tests/quicksuggest/browser/browser_telemetry_dynamicWikipedia.js b/browser/components/urlbar/tests/quicksuggest/browser/browser_telemetry_dynamicWikipedia.js index 71c289e0ef..c659eee268 100644 --- a/browser/components/urlbar/tests/quicksuggest/browser/browser_telemetry_dynamicWikipedia.js +++ b/browser/components/urlbar/tests/quicksuggest/browser/browser_telemetry_dynamicWikipedia.js @@ -88,24 +88,6 @@ add_task(async function () { }, }, }, - // help - { - command: "help", - scalars: { - [TELEMETRY_SCALARS.IMPRESSION_DYNAMIC_WIKIPEDIA]: position, - [TELEMETRY_SCALARS.HELP_DYNAMIC_WIKIPEDIA]: position, - }, - event: { - category: QuickSuggest.TELEMETRY_EVENT_CATEGORY, - method: "engagement", - object: "help", - extra: { - suggestion_type, - match_type, - position: position.toString(), - }, - }, - }, ], }); }); diff --git a/browser/components/urlbar/tests/quicksuggest/browser/browser_telemetry_weather.js b/browser/components/urlbar/tests/quicksuggest/browser/browser_telemetry_weather.js index e87c64740f..90044a95bd 100644 --- a/browser/components/urlbar/tests/quicksuggest/browser/browser_telemetry_weather.js +++ b/browser/components/urlbar/tests/quicksuggest/browser/browser_telemetry_weather.js @@ -121,24 +121,6 @@ add_task(async function () { }, }, }, - // help - { - command: "help", - scalars: { - [WEATHER_SCALARS.IMPRESSION]: position, - [WEATHER_SCALARS.HELP]: position, - }, - event: { - category: QuickSuggest.TELEMETRY_EVENT_CATEGORY, - method: "engagement", - object: "help", - extra: { - suggestion_type, - match_type, - position: position.toString(), - }, - }, - }, ], }); }); diff --git a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_dynamicWikipedia.js b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_dynamicWikipedia.js index a9f339c324..7fc687d3df 100644 --- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_dynamicWikipedia.js +++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_dynamicWikipedia.js @@ -90,14 +90,11 @@ function makeExpectedResult() { qsSuggestion: "full_keyword", source: "merino", provider: "wikipedia", - helpUrl: QuickSuggest.HELP_URL, - helpL10n: { - id: "urlbar-result-menu-learn-more-about-firefox-suggest", - }, isBlockable: true, blockL10n: { id: "urlbar-result-menu-dismiss-firefox-suggest", }, + isManageable: true, }, }; } diff --git a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_merino.js b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_merino.js index 64f4991236..b88e14e0e0 100644 --- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_merino.js +++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_merino.js @@ -549,14 +549,11 @@ add_task(async function bestMatch() { url: "url", icon: null, qsSuggestion: "full_keyword", - helpUrl: QuickSuggest.HELP_URL, - helpL10n: { - id: "urlbar-result-menu-learn-more-about-firefox-suggest", - }, isBlockable: true, blockL10n: { id: "urlbar-result-menu-dismiss-firefox-suggest", }, + isManageable: true, displayUrl: "url", source: "merino", provider: "some_top_pick_provider", diff --git a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_scoreMap.js b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_scoreMap.js index 224dd6cb22..89fefd3163 100644 --- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_scoreMap.js +++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_scoreMap.js @@ -657,14 +657,11 @@ function makeExpectedDefaultResult({ suggestion }) { ? { id: "urlbar-result-action-sponsored" } : undefined, shouldShowUrl: true, - helpUrl: QuickSuggest.HELP_URL, - helpL10n: { - id: "urlbar-result-menu-learn-more-about-firefox-suggest", - }, isBlockable: true, blockL10n: { id: "urlbar-result-menu-dismiss-firefox-suggest", }, + isManageable: true, }, }; } diff --git a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_topPicks.js b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_topPicks.js index 1b8da54920..468cedbe0b 100644 --- a/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_topPicks.js +++ b/browser/components/urlbar/tests/quicksuggest/unit/test_quicksuggest_topPicks.js @@ -175,14 +175,11 @@ function makeExpectedResult({ shouldShowUrl: true, source: "merino", provider: telemetryType, - helpUrl: QuickSuggest.HELP_URL, - helpL10n: { - id: "urlbar-result-menu-learn-more-about-firefox-suggest", - }, isBlockable: true, blockL10n: { id: "urlbar-result-menu-dismiss-firefox-suggest", }, + isManageable: true, }, }; if (typeof dupedHeuristic == "boolean") { |