summaryrefslogtreecommitdiffstats
path: root/browser/components/preferences/tests/browser_search_subdialog_tooltip_saved_addresses.js
blob: 8235f8dd19e78af6f243012c4d824c0e5e4774c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"use strict";

add_task(async function () {
  await SpecialPowers.pushPrefEnv({
    set: [["browser.preferences.search", true]],
  });
});

add_task(async function test_show_search_term_tooltip_in_subdialog() {
  await openPreferencesViaOpenPreferencesAPI("paneGeneral", {
    leaveOpen: true,
  });

  let keyword = "organization";
  await runSearchInput(keyword);

  let formAutofillGroupBox = gBrowser.contentDocument.getElementById(
    "formAutofillGroupBox"
  );
  let savedAddressesButton =
    formAutofillGroupBox.querySelector(".accessory-button");

  info("Clicking saved addresses button to open subdialog");
  savedAddressesButton.click();
  info("Waiting for addresses subdialog to appear");
  await BrowserTestUtils.waitForCondition(() => {
    let dialogBox = gBrowser.contentDocument.querySelector(".dialogBox");
    return !!dialogBox;
  });
  let tooltip = gBrowser.contentDocument.querySelector(".search-tooltip");

  is_element_visible(
    tooltip,
    "Tooltip with search term should be visible in subdialog"
  );
  is(tooltip.textContent, keyword, "Tooltip should have correct search term");

  BrowserTestUtils.removeTab(gBrowser.selectedTab);
});