Skip to content

Commit 92f268d

Browse files
authored
Merge pull request #568 from mozilla/tracy/fix_search_suggests_test
Tracy/fix search suggests test
2 parents 3f5e6ac + e972b3b commit 92f268d

22 files changed

+113
-50
lines changed

SELECTOR_INFO.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2616,7 +2616,7 @@ Path to .json: modules/data/navigation.components.json
26162616
```
26172617
```
26182618
Selector name: sponsored-suggestion
2619-
Selector Data: urlbarView-row-body-description
2619+
Selector Data: urlbarView-group-aria-label
26202620
Description: Sponsored search results
26212621
Location: URL bar search results
26222622
Path to .json: modules/data/navigation.components.json
@@ -2629,6 +2629,13 @@ Location: URL bar search results
26292629
Path to .json: modules/data/navigation.components.json
26302630
```
26312631
```
2632+
Selector name: suggestion-titles
2633+
Selector Data: urlbarView-title
2634+
Description: Firefox suggestion search results item titles
2635+
Location: URL bar suggestion results
2636+
Path to .json: modules/data/navigation.components.json
2637+
```
2638+
```
26322639
Selector name: search-result-autofill-adaptive-element
26332640
Selector Data: .//*[@type='autofill_adaptive']
26342641
Description: Search result autofill adaptive element

modules/data/navigation.components.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165

166166
"sponsored-suggestion": {
167167
"doNotCache": true,
168-
"selectorData": "urlbarView-row-body-description",
168+
"selectorData": "urlbarView-group-aria-label",
169169
"strategy": "class",
170170
"groups": []
171171
},
@@ -177,6 +177,13 @@
177177
"groups": []
178178
},
179179

180+
"suggestion-titles": {
181+
"doNotCache": true,
182+
"selectorData": "urlbarView-title",
183+
"strategy": "class",
184+
"groups": []
185+
},
186+
180187
"search-result-autofill-adaptive-element": {
181188
"selectorData": ".//*[@type='autofill_adaptive']",
182189
"strategy": "xpath",

tests/address_bar_and_search/test_add_engine_address_bar.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
TEST_URL = "https://youtube.com"
77
EXPECTED_ENGINE = "YouTube"
88

9+
910
@pytest.fixture()
1011
def test_case():
1112
return "1365478"

tests/address_bar_and_search/test_addon_suggestion.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def test_addon_suggestion_based_on_search_input(driver: Firefox):
4242
nav.type_in_awesome_bar(input_text)
4343

4444
if not nav.element_visible("addon-suggestion"):
45-
raise AssertionError(f"Addon suggestion not visible for input: '{input_text}'")
45+
raise AssertionError(
46+
f"Addon suggestion not visible for input: '{input_text}'"
47+
)
4648

4749
nav.select_element_in_nav("addon-suggestion")
4850
expected_url = f"{ADDONS_BASE_URL}{addon_slug}/"

tests/address_bar_and_search/test_default_search_provider_change_awesome_bar.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ def test_default_search_provider_change_awesome_bar(driver: Firefox):
2828
prefs.search_engine_dropdown().select_option(SEARCH_ENGINE)
2929

3030
driver.get("about:newtab")
31-
nav.expect_element_attribute_contains("awesome-bar", "placeholder", EXPECTED_PLACEHOLDER)
31+
nav.expect_element_attribute_contains(
32+
"awesome-bar", "placeholder", EXPECTED_PLACEHOLDER
33+
)

tests/address_bar_and_search/test_glean_basic.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from werkzeug.wrappers import Request, Response
1212

1313
from modules.browser_object import Navigation
14-
from modules.page_object import AboutGlean, AboutPrefs, GenericPage, AboutConfig
14+
from modules.page_object import AboutConfig, AboutGlean, AboutPrefs, GenericPage
1515
from modules.util import Utilities
1616

1717
# Constants
@@ -34,7 +34,9 @@ def test_case():
3434
return "2234689"
3535

3636

37-
def _verify_glean_ping(ping_actual: str, ping_expected: str, engine_actual: str, engine_expected: str):
37+
def _verify_glean_ping(
38+
ping_actual: str, ping_expected: str, engine_actual: str, engine_expected: str
39+
):
3840
assert ping_actual == ping_expected
3941
assert engine_actual.lower() == engine_expected.lower()
4042

@@ -50,7 +52,9 @@ def glean_handler(request: Request) -> Response:
5052
engine_name = body
5153
for key in PING_METRIC_PATH:
5254
engine_name = engine_name[key]
53-
expected_engine = ENGINE_NAME_INITIAL if pings_with_id == 0 else ENGINE_NAME_UPDATED
55+
expected_engine = (
56+
ENGINE_NAME_INITIAL if pings_with_id == 0 else ENGINE_NAME_UPDATED
57+
)
5458
_verify_glean_ping(
5559
ping_actual=incoming_ping_id,
5660
ping_expected=ping_id_global,

tests/address_bar_and_search/test_google_search_counts_us.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from modules.page_object import AboutTelemetry
1010
from modules.util import Utilities
1111

12-
1312
# Constants
1413
SEARCH_TERM = "festival"
1514
SEARCH_PROVIDER_PATH = '$..SEARCH_COUNTS.["google-b-1-d.urlbar"].sum'
@@ -48,10 +47,10 @@ def test_google_search_counts_us(driver: Firefox):
4847
# === Decode telemetry and validate search provider data ===
4948
json_data = utils.decode_url(driver)
5049

51-
assert utils.assert_json_value(
52-
json_data, SEARCH_PROVIDER_PATH, 1
53-
), f"Expected 1 Google search in path: {SEARCH_PROVIDER_PATH}"
50+
assert utils.assert_json_value(json_data, SEARCH_PROVIDER_PATH, 1), (
51+
f"Expected 1 Google search in path: {SEARCH_PROVIDER_PATH}"
52+
)
5453

55-
assert utils.assert_json_value(
56-
json_data, SEARCH_TAG_PATH, 1
57-
), f"Expected 1 tagged Google search in path: {SEARCH_TAG_PATH}"
54+
assert utils.assert_json_value(json_data, SEARCH_TAG_PATH, 1), (
55+
f"Expected 1 tagged Google search in path: {SEARCH_TAG_PATH}"
56+
)

tests/address_bar_and_search/test_sap_google_adclick.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import pytest
21
from time import sleep
2+
3+
import pytest
34
from selenium.webdriver import Firefox
45

56
from modules.browser_object_navigation import Navigation

tests/address_bar_and_search/test_search_engine_selector.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
from modules.browser_object import Navigation
66

77
SEARCH_TERM = "soccer"
8-
SEARCH_ENGINES = ["Google", "Amazon.com", "Bing", "DuckDuckGo", "eBay", "Wikipedia (en)"]
8+
SEARCH_ENGINES = [
9+
"Google",
10+
"Amazon.com",
11+
"Bing",
12+
"DuckDuckGo",
13+
"eBay",
14+
"Wikipedia (en)",
15+
]
916

1017

1118
@pytest.fixture()
@@ -27,6 +34,5 @@ def test_search_engine_selector_and_validator(driver: Firefox, search_engine: st
2734
nav.search(SEARCH_TERM)
2835
nav.expect_in_content(lambda d: expected_url_fragment in d.current_url)
2936

30-
3137
assert expected_url_fragment in driver.current_url
3238
nav.clear_awesome_bar()

tests/address_bar_and_search/test_search_modes_for_sites.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ def test_case():
1818

1919

2020
@pytest.mark.parametrize("search_engine, prefix, url", SEARCH_MODES)
21-
def test_search_modes_for_sites(driver: Firefox, search_engine: str, prefix: str, url: str):
21+
def test_search_modes_for_sites(
22+
driver: Firefox, search_engine: str, prefix: str, url: str
23+
):
2224
"""
2325
C2234690 - Verify that typing the first two letters of a search engine activates its mode in the address bar.
2426
"""

0 commit comments

Comments
 (0)