diff --git a/SELECTOR_INFO.md b/SELECTOR_INFO.md index 2e5d54090..e64ae96da 100644 --- a/SELECTOR_INFO.md +++ b/SELECTOR_INFO.md @@ -3769,9 +3769,9 @@ Location: Bookmark panel Path to .json: modules/data/pane_ui.components.json ``` ``` -Selector Name: toolbar-blank-space -Selector Data: customizableui-special-spring1 -Description: Blank space in the toolbar +Selector Name: toolbarspring +Selector Data: customizableui-special-spring2 +Description: toolbarspring Location: Toolbar Path to .json: modules/data/navigation.components.json ``` @@ -4156,13 +4156,6 @@ Description: Ungroup the tab group Location: Menu that opens when right click on the tab group label Path to .json: modules/data/tab_bar.components.json ``` -``` -Selector Name: tabgroup-save-and-close-group -Selector Data: "tabGroupEditor_saveAndCloseGroup" -Description: Save and close the tab group -Location: Menu that opens when right click on the tab group label -Path to .json: modules/data/tab_bar.components.json -``` #### text_area_form_autofill ``` Selector Name: street-address-textarea diff --git a/manifests/key.yaml b/manifests/key.yaml index 6650fdb3f..256242547 100644 --- a/manifests/key.yaml +++ b/manifests/key.yaml @@ -161,6 +161,10 @@ address_bar_and_search: result: pass splits: - functional1 + test_searchengine_result_page_load_on_reload_or_back: + result: pass + splits: + - functional1 test_searchbar_results_shown_in_a_new_tab: result: unstable splits: diff --git a/modules/browser_object_navigation.py b/modules/browser_object_navigation.py index b96d3655f..57c30f92d 100644 --- a/modules/browser_object_navigation.py +++ b/modules/browser_object_navigation.py @@ -1232,3 +1232,15 @@ def expect_container_label(self, label_expected: str): """ actual_label = self.get_element("tab-container-label").text assert actual_label == label_expected + + @BasePage.context_chrome + def click_back_button(self) -> None: + """ + Click the 'Back' button. + Waits until the button is visible and clickable before performing the click. + """ + # Wait until the element is visible and clickable + self.expect(lambda _: self.get_element("back-button").is_displayed()) + + # Click the button + self.get_element("back-button").click() diff --git a/modules/data/navigation.components.json b/modules/data/navigation.components.json index 8eebf756f..915e6518f 100644 --- a/modules/data/navigation.components.json +++ b/modules/data/navigation.components.json @@ -687,5 +687,13 @@ "selectorData": "customizableui-special-spring1", "strategy": "id", "groups": [] + }, + + "back-button": { + "selectorData": "back-button", + "strategy": "id", + "groups": [ + "doNotCache" + ] } } diff --git a/modules/page_object_about_pages.py b/modules/page_object_about_pages.py index 95224294e..3fec34ec8 100644 --- a/modules/page_object_about_pages.py +++ b/modules/page_object_about_pages.py @@ -286,6 +286,23 @@ class AboutTelemetry(BasePage): URL_TEMPLATE = "about:telemetry" + def open_raw_json_data(self): + """ + Opens the Raw JSON telemetry view: + - Click Raw category + - Switch to the new tab + - Click the Raw Data tab + """ + + # Click "Raw" category + self.get_element("category-raw").click() + + # Switching to the new tab opened by Raw + self.switch_to_new_tab() + + # Click "Raw Data" tab + self.get_element("rawdata-tab").click() + class AboutNetworking(BasePage): """ diff --git a/tests/address_bar_and_search/test_google_search_counts_us.py b/tests/address_bar_and_search/test_google_search_counts_us.py index c1b4974d0..26472fc57 100644 --- a/tests/address_bar_and_search/test_google_search_counts_us.py +++ b/tests/address_bar_and_search/test_google_search_counts_us.py @@ -36,9 +36,7 @@ def test_google_search_counts_us(driver: Firefox): telemetry = AboutTelemetry(driver).open() sleep(WAIT_TELEMETRY_LOAD) - telemetry.get_element("category-raw").click() - telemetry.switch_to_new_tab() - telemetry.get_element("rawdata-tab").click() + telemetry.open_raw_json_data() json_data = utils.decode_url(driver) diff --git a/tests/address_bar_and_search/test_google_withads_url_bar_us.py b/tests/address_bar_and_search/test_google_withads_url_bar_us.py index 501548b30..484b8836a 100644 --- a/tests/address_bar_and_search/test_google_withads_url_bar_us.py +++ b/tests/address_bar_and_search/test_google_withads_url_bar_us.py @@ -46,9 +46,7 @@ def test_google_withads_url_bar_us(driver): about_telemetry = AboutTelemetry(driver).open() sleep(5) - about_telemetry.get_element("category-raw").click() - about_telemetry.switch_to_new_tab() - about_telemetry.get_element("rawdata-tab").click() + about_telemetry.open_raw_json_data() json_data = util.decode_url(driver) if util.assert_json_value(json_data, path, 1): diff --git a/tests/address_bar_and_search/test_sap_google_adclick.py b/tests/address_bar_and_search/test_sap_google_adclick.py index 395b643db..ca6bf28dd 100644 --- a/tests/address_bar_and_search/test_sap_google_adclick.py +++ b/tests/address_bar_and_search/test_sap_google_adclick.py @@ -34,9 +34,7 @@ def test_sap_google_adclick(driver: Firefox): telemetry = AboutTelemetry(driver).open() sleep(SLEEP_BEFORE_VERIFICATION) - telemetry.get_element("category-raw").click() - telemetry.switch_to_new_tab() - telemetry.get_element("rawdata-tab").click() + telemetry.open_raw_json_data() json_data = utils.decode_url(driver) assert utils.assert_json_value( diff --git a/tests/address_bar_and_search/test_searchengine_result_page_load_on_reload_or_back.py b/tests/address_bar_and_search/test_searchengine_result_page_load_on_reload_or_back.py new file mode 100644 index 000000000..dd9e9d0a1 --- /dev/null +++ b/tests/address_bar_and_search/test_searchengine_result_page_load_on_reload_or_back.py @@ -0,0 +1,67 @@ +from time import sleep + +import pytest +from selenium.webdriver import Firefox + +from modules.browser_object_navigation import Navigation +from modules.browser_object_tabbar import TabBar +from modules.page_object_about_pages import AboutTelemetry +from modules.util import Utilities + +TEXT = "Firefox" +SEARCHBAR_PATH = ( + '$..["browser.search.content.searchbar"].["google:tagged:firefox-b-1-d"]' +) + + +@pytest.fixture() +def test_case(): + return "3028909" + + +def test_searchengine_result_page_load_on_reload_or_back(driver: Firefox): + """ + C3028909 - Search Engine Result Page loads as a result of a reload or a back-button press + """ + + # Instantiate objects + nav = Navigation(driver) + telemetry = AboutTelemetry(driver) + utils = Utilities() + tab = TabBar(driver) + + # Go to "Customize Toolbar", drag Search bar to Toolbar and click Done + nav.add_search_bar_to_toolbar() + + # Using the search bar perform a search + nav.search_bar_search(TEXT) + sleep(5) + + # Press back button from the browser menu + nav.click_back_button() + + # Go to about:telemetry -> Raw JSON -> Raw data + telemetry.open() + telemetry.open_raw_json_data() + + # Verify "browser.search.content.searchbar": { "google:tagged:firefox-b-d": 1}* + json_data = utils.decode_url(driver) + searchbar_ping = utils.assert_json_value(json_data, SEARCHBAR_PATH, 1) + assert searchbar_ping, f"Telemetry path not found: {SEARCHBAR_PATH}" + + # Open new tab and perform a new search in the search bar + tab.new_tab_by_button() + nav.search_bar_search(TEXT) + + # Press reload button + nav.refresh_page() + + # Go back to raw data page and reload it + driver.switch_to.window(driver.window_handles[1]) + nav.refresh_page() + telemetry.get_element("rawdata-tab").click() + + # Verify "browser.search.content.searchbar": { "google:tagged:firefox-b-d": 2}* + json_data = utils.decode_url(driver) + ping_value = utils.assert_json_value(json_data, SEARCHBAR_PATH, 2) + assert ping_value, f"Telemetry path not found or value mismatch: {SEARCHBAR_PATH}"