Skip to content

Commit 199d953

Browse files
committed
adaptive history autofill
1 parent f95867a commit 199d953

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

modules/data/navigation.components.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,11 @@
146146
"groups": [
147147
"doNotCache"
148148
]
149+
},
150+
151+
"firefox-suggest": {
152+
"selectorData": "div.urlbarView-row[label=\"Firefox Suggest\"] > span.urlbarView-row-inner",
153+
"strategy": "css",
154+
"groups": []
149155
}
150156
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
from selenium.webdriver.support import expected_conditions as EC
4+
from selenium.webdriver.support.wait import WebDriverWait
5+
6+
from modules.browser_object import Navigation
7+
from modules.browser_object_tabbar import TabBar
8+
9+
10+
@pytest.fixture()
11+
def add_prefs():
12+
return [
13+
("browser.search.region", "US"),
14+
("browser.urlbar.autoFill.adaptiveHistory.enabled", True),
15+
]
16+
17+
18+
def test_add_adaptive_history_autofill(driver: Firefox):
19+
"""
20+
C1814373 - Test to verify that typing the first three characters of a previously visited URL in the address bar
21+
triggers the adaptive history autofill.
22+
"""
23+
24+
nav = Navigation(driver).open()
25+
tabs = TabBar(driver)
26+
27+
nav.search("https://news.google.com/home?hl=en-US&gl=US&ceid=US:en")
28+
WebDriverWait(driver, 10).until(
29+
lambda d: tabs.get_tab_title(tabs.get_tab(1)) == "Google News"
30+
)
31+
32+
tabs.new_tab_by_button()
33+
tabs.wait_for_num_tabs(2)
34+
driver.switch_to.window(driver.window_handles[1])
35+
36+
with driver.context(driver.CONTEXT_CHROME):
37+
x_icon = tabs.get_element("tab-x-icon", multiple=True)
38+
x_icon[0].click()
39+
40+
# Type the first 3 characters of the visited URL in the address bar and select the suggested URL
41+
nav.type_in_awesome_bar("new")
42+
nav.get_element("firefox-suggest").click()
43+
nav.expect_in_content(
44+
EC.url_contains("https://news.google.com/home?hl=en-US&gl=US&ceid=US:en")
45+
)
46+
47+
# Open a new tab, type the first 3 characters of the visited URL and see that it is autofilled directly
48+
tabs.new_tab_by_button()
49+
nav.type_in_awesome_bar("new")
50+
nav.expect_in_content(
51+
EC.url_contains("https://news.google.com/home?hl=en-US&gl=US&ceid=US:en")
52+
)

0 commit comments

Comments
 (0)