Skip to content

Commit aed48d7

Browse files
authored
Merge pull request #166 from mozilla/tw/legacy_search_test_refactor
Remove usages of legacy search bar
2 parents 77fd28b + aea99a2 commit aed48d7

File tree

4 files changed

+3
-106
lines changed

4 files changed

+3
-106
lines changed

tests/address_bar_and_search/test_search_bar_result.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

tests/address_bar_and_search/test_search_code_google_non_us.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,16 @@ def overwrite_prefs():
1616

1717
# Set constants
1818
FX_SEARCH_CODE = "client=firefox-b-d"
19-
SEARCH_BAR_PREF = "browser.search.widget.inNavBar"
2019

2120

22-
# NOTE: Need to fix, failing in 130+ Firefox due to legacy search bar being deprecated
23-
@pytest.mark.unstable
2421
def test_search_code_google_non_us(driver: Firefox):
2522
"""
2623
C1365269 - Default Search Code: Google - non-US
27-
This tests multiple ways of sending a search; Awesome bar,
28-
Search bar and selected text
24+
This tests searching via Awesomebar and selected text
2925
"""
3026

3127
# Create objects
3228
nav = Navigation(driver).open()
33-
ac = AboutConfig(driver)
3429
context_menu = ContextMenu(driver)
3530
tab = TabBar(driver)
3631
example = ExamplePage(driver)
@@ -47,16 +42,6 @@ def search_code_assert():
4742
tab.expect_title_contains("Google Search")
4843
search_code_assert()
4944

50-
# Check code generated from the Search bar search
51-
# First enable search bar via about:config
52-
ac.toggle_true_false_config(SEARCH_BAR_PREF)
53-
nav.clear_awesome_bar()
54-
55-
# Then run the code check
56-
nav.search_bar_search("soccer")
57-
tab.expect_title_contains("Google Search")
58-
search_code_assert()
59-
6045
# Check code generated from the context click of selected text
6146
with driver.context(driver.CONTEXT_CONTENT):
6247
example.open()

tests/address_bar_and_search/test_search_code_google_us.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import pytest
21
from selenium.webdriver import Firefox
32
from selenium.webdriver.common.by import By
43

@@ -7,20 +6,16 @@
76

87
# Set constant
98
FX_SEARCH_CODE = "client=firefox-b-1-d"
10-
SEARCH_BAR_PREF = "browser.search.widget.inNavBar"
119

1210

13-
@pytest.mark.unstable
1411
def test_search_code_google_us(driver: Firefox):
1512
"""
1613
C1365268 - Default Search Code: Google - US
17-
This tests multiple ways of sending a search; Awesome bar,
18-
Search bar and selected text
14+
This tests searching via Awesomebar and selected text
1915
"""
2016

2117
# Create objects
2218
nav = Navigation(driver).open()
23-
ac = AboutConfig(driver)
2419
context_menu = ContextMenu(driver)
2520
tab = TabBar(driver)
2621
example = ExamplePage(driver)
@@ -37,16 +32,6 @@ def search_code_assert():
3732
tab.expect_title_contains("Google Search")
3833
search_code_assert()
3934

40-
# Check code generated from the Search bar search
41-
# First enable search bar via about:config
42-
ac.toggle_true_false_config(SEARCH_BAR_PREF)
43-
nav.clear_awesome_bar()
44-
45-
# Then run the code check
46-
nav.search_bar_search("soccer")
47-
tab.expect_title_contains("Google Search")
48-
search_code_assert()
49-
5035
# Check code generated from the context click of selected text
5136
with driver.context(driver.CONTEXT_CONTENT):
5237
example.open()

tests/address_bar_and_search/test_search_term_persists.py

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ def add_prefs():
1818
FIRST_SEARCH = "cheetah"
1919
FIRST_RESULT = "https://www.google.com/search?client=firefox-b-1-d&q=cheetah"
2020
SECOND_SEARCH = "lion"
21-
SECOND_RESULT = "https://www.google.com/search?client=firefox-b-1-d&q=lion"
22-
SEARCH_BAR_PREF = "browser.search.widget.inNavBar"
2321

2422

25-
# NOTE: Need to fix, failing in 130+ Firefox due to legacy search bar being deprecated
26-
@pytest.mark.unstable
2723
def test_search_term_persists(driver: Firefox):
2824
"""
2925
C2153943 - Persist search term basic functionality
@@ -33,35 +29,13 @@ def test_search_term_persists(driver: Firefox):
3329
nav = Navigation(driver).open()
3430
tab = TabBar(driver)
3531

36-
def toggle_legacy_search_bar():
37-
# This test requires that the old search bar is added while retaining search results.
38-
# First, open a new tab and switch to it
39-
tab.new_tab_by_button()
40-
window_handles = driver.window_handles
41-
driver.switch_to.window(window_handles[-1])
42-
# Then, toggle the old search bar via about:config
43-
ac = AboutConfig(driver)
44-
ac.toggle_true_false_config(SEARCH_BAR_PREF)
45-
# Finally, close the about:config tab and switch context back to the original tab
46-
nav.set_chrome_context()
47-
x_icon = tab.get_element("tab-x-icon", multiple=True)
48-
x_icon[1].click()
49-
driver.switch_to.window(window_handles[0])
5032

5133
# Perform a search using the URL bar.
5234
nav.search(FIRST_SEARCH)
5335
tab.expect_title_contains("Google Search")
5436
address_bar_text = nav.get_awesome_bar_text()
5537
assert FIRST_SEARCH == address_bar_text
5638

57-
# Add the search bar to toolbar
58-
toggle_legacy_search_bar()
59-
60-
# Search term should be replaced with full url
61-
address_bar_text = nav.get_awesome_bar_text()
62-
assert FIRST_RESULT == address_bar_text
63-
nav.clear_awesome_bar()
64-
6539
# Perform a new awesome bar search, full url should be present
6640
# First, navigate away from Google
6741
nav.set_content_context()
@@ -70,13 +44,4 @@ def toggle_legacy_search_bar():
7044
nav.search(SECOND_SEARCH)
7145
tab.expect_title_contains("Google Search")
7246
address_bar_text = nav.get_awesome_bar_text()
73-
assert SECOND_RESULT == address_bar_text
74-
75-
# Disable the old search bar
76-
toggle_legacy_search_bar()
77-
78-
# Again, perform a search using the URL bar.
79-
nav.search(FIRST_SEARCH)
80-
tab.expect_title_contains("Google Search")
81-
address_bar_text = nav.get_awesome_bar_text()
82-
assert FIRST_SEARCH == address_bar_text
47+
assert SECOND_SEARCH == address_bar_text

0 commit comments

Comments
 (0)