@@ -24,9 +24,9 @@ def test_add_adaptive_history_autofill(driver: Firefox):
24
24
nav = Navigation (driver ).open ()
25
25
tabs = TabBar (driver )
26
26
27
- nav .search ("https://news.google .com/home?hl=en-US&gl=US&ceid=US:en " )
27
+ nav .search ("https://www.nationalgeographic .com/science/ " )
28
28
WebDriverWait (driver , 10 ).until (
29
- lambda d : tabs .get_tab_title (tabs .get_tab (1 )) == "Google News "
29
+ lambda d : tabs .get_tab_title (tabs .get_tab (1 )) == "Science "
30
30
)
31
31
32
32
tabs .new_tab_by_button ()
@@ -38,15 +38,27 @@ def test_add_adaptive_history_autofill(driver: Firefox):
38
38
x_icon [0 ].click ()
39
39
40
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 " )
41
+ nav .type_in_awesome_bar ("nat " )
42
42
nav .get_element ("firefox-suggest" ).click ()
43
43
nav .expect_in_content (
44
- EC .url_contains ("https://news.google .com/home?hl=en-US&gl=US&ceid=US:en " )
44
+ EC .url_contains ("https://www.nationalgeographic .com/science/ " )
45
45
)
46
46
47
- # Open a new tab, type the first 3 characters of the visited URL and see that it is autofilled directly
47
+ # Open a new tab, type the first 3 characters of the visited URL
48
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" )
49
+ driver .switch_to .window (driver .window_handles [- 1 ])
50
+ nav .type_in_awesome_bar ("nat" )
51
+
52
+ autofill_adaptive_element = nav .get_element (
53
+ "search-result-autofill-adaptive-element"
52
54
)
55
+
56
+ # Assertion to verify that the 'autofill_adaptive' type is found
57
+ assert (
58
+ autofill_adaptive_element .get_attribute ("type" ) == "autofill_adaptive"
59
+ ), f"Expected element type to be 'autofill_adaptive' but found '{ autofill_adaptive_element .get_attribute ('type' )} '"
60
+
61
+ # Assertion to check the autofilled URL is the expected one
62
+ assert (
63
+ "nationalgeographic.com/science" in autofill_adaptive_element .text
64
+ ), "URL 'https://www.nationalgeographic.com/science' not found in autofill suggestions."
0 commit comments