From edd1c9c933b2d83796f475dca7720f3dde8ebfa7 Mon Sep 17 00:00:00 2001 From: Tracy Date: Mon, 13 Oct 2025 14:42:00 -0500 Subject: [PATCH 1/3] Update example.com hyperlink --- SELECTOR_INFO.md | 4 +- modules/data/example_page.components.json | 2 +- modules/page_object_autofill.py | 24 ++++-- tests/menus/test_hyperlink_context_menu.py | 6 +- .../test_improved_type_control_panel.py | 77 ++++++++++++++----- 5 files changed, 81 insertions(+), 32 deletions(-) diff --git a/SELECTOR_INFO.md b/SELECTOR_INFO.md index 70e467847..62cc69a4d 100644 --- a/SELECTOR_INFO.md +++ b/SELECTOR_INFO.md @@ -1834,8 +1834,8 @@ Path to .json: modules/data/exemple_page.components.json ``` ``` Selector Name: more-information -Selector Data: "More information..." -Description: More information..." link +Selector Data: "Learn more" +Description: "Learn more" link Location: The hyperlink positioned in the middle of example.com page Path to .json: modules/data/exemple_page.components.json ``` diff --git a/modules/data/example_page.components.json b/modules/data/example_page.components.json index d8cc5339f..404fb7bfa 100644 --- a/modules/data/example_page.components.json +++ b/modules/data/example_page.components.json @@ -15,7 +15,7 @@ }, "more-information": { - "selectorData": "More information...", + "selectorData": "Learn more", "strategy": "link_text", "groups": [] } diff --git a/modules/page_object_autofill.py b/modules/page_object_autofill.py index 146711485..bb198ac54 100644 --- a/modules/page_object_autofill.py +++ b/modules/page_object_autofill.py @@ -807,22 +807,34 @@ def submit(self) -> None: self.submit_button = self.parent.get_element("submit-button-login") self.submit_button.click() - def verify_password_value(self, expected_password: str, field: str = "password-login-field"): + def verify_password_value( + self, expected_password: str, field: str = "password-login-field" + ): """Wait until the password field contains the expected value.""" element = self.parent.get_element(field) - self.parent.wait.until(lambda _: element.get_attribute("value") == expected_password) + self.parent.wait.until( + lambda _: element.get_attribute("value") == expected_password + ) return element - def verify_username_value(self, expected_username: str, field: str = "username-login-field"): + def verify_username_value( + self, expected_username: str, field: str = "username-login-field" + ): """Wait until the username field contains the expected value.""" element = self.parent.get_element(field) - self.parent.wait.until(lambda _: element.get_attribute("value") == expected_username) + self.parent.wait.until( + lambda _: element.get_attribute("value") == expected_username + ) return element - def verify_password_length(self, expected_length: int = 8, field: str = "password-login-field"): + def verify_password_length( + self, expected_length: int = 8, field: str = "password-login-field" + ): """Wait until the password field contains the expected number of characters.""" element = self.parent.get_element(field) - self.parent.wait.until(lambda _: len(element.get_attribute("value")) == expected_length) + self.parent.wait.until( + lambda _: len(element.get_attribute("value")) == expected_length + ) return element def verify_field_empty(self, field: str): diff --git a/tests/menus/test_hyperlink_context_menu.py b/tests/menus/test_hyperlink_context_menu.py index c58f77b79..1d3979860 100644 --- a/tests/menus/test_hyperlink_context_menu.py +++ b/tests/menus/test_hyperlink_context_menu.py @@ -19,13 +19,13 @@ def test_open_link_in_new_window(driver: Firefox): example = ExamplePage(driver) example.open() - # right click the hyperlink + # Right-click the hyperlink example.context_click("more-information") - # click on the open in new window option + # Click on the open in new window option hyperlink_context.click_and_hide_menu("context-menu-open-link-in-new-window") - # verify there are two instances (two windows) + # Verify there are two instances (two windows) tabs.wait_for_num_windows(2) driver.switch_to.window(driver.window_handles[1]) diff --git a/tests/reader_view/test_improved_type_control_panel.py b/tests/reader_view/test_improved_type_control_panel.py index f253a2d91..b94c4d0d8 100644 --- a/tests/reader_view/test_improved_type_control_panel.py +++ b/tests/reader_view/test_improved_type_control_panel.py @@ -1,6 +1,6 @@ -import pytest from typing import Literal +import pytest from selenium.webdriver import Firefox from modules.browser_object import ReaderView @@ -25,8 +25,16 @@ def test_case() -> str: SliderDirection = Literal["decrease", "increase"] SIZE_CONTROLS: list[SizeControl] = ["minus", "plus"] -FONTS: list[Literal["sans-serif", "serif", "monospace"]] = ["sans-serif", "serif", "monospace"] -ALIGNMENTS: list[tuple[AlignKey, AlignCSS]] = [("left", "start"), ("right", "right"), ("center", "center")] +FONTS: list[Literal["sans-serif", "serif", "monospace"]] = [ + "sans-serif", + "serif", + "monospace", +] +ALIGNMENTS: list[tuple[AlignKey, AlignCSS]] = [ + ("left", "start"), + ("right", "right"), + ("center", "center"), +] SLIDER_DIRS: list[SliderDirection] = ["decrease", "increase"] @@ -49,7 +57,9 @@ def _css_int(util: Utilities, element, prop: str) -> int: @pytest.mark.ci @pytest.mark.parametrize("font", FONTS) -def test_type_control_panel_font(driver: Firefox, font: Literal["sans-serif", "serif", "monospace"]) -> None: +def test_type_control_panel_font( + driver: Firefox, font: Literal["sans-serif", "serif", "monospace"] +) -> None: """ C130919.1: Ensure the functionality of the type control panels works (font family). """ @@ -61,10 +71,14 @@ def test_type_control_panel_font(driver: Firefox, font: Literal["sans-serif", "s body = web_page.get_element("page-body") # Ensure default is sans-serif first so the next wait has a stable baseline - reader_view.wait.until(lambda _: "sans-serif" in body.value_of_css_property("font-family")) + reader_view.wait.until( + lambda _: "sans-serif" in body.value_of_css_property("font-family") + ) font_dropdown_root = reader_view.get_element("toolbar-font-selector") - font_dropdown = Dropdown(page=reader_view, require_shadow=False, root=font_dropdown_root) + font_dropdown = Dropdown( + page=reader_view, require_shadow=False, root=font_dropdown_root + ) font_dropdown.select_option( f"about-reader-font-type-{font}", option_tag="option", @@ -91,16 +105,20 @@ def test_type_control_panel_size(driver: Firefox, control: SizeControl) -> None: reader_view.get_element(f"toolbar-textsize-{control}").click() if control == "minus": - reader_view.wait.until(lambda _: _css_int(util, body, "--font-size") < size_before) + reader_view.wait.until( + lambda _: _css_int(util, body, "--font-size") < size_before + ) else: - reader_view.wait.until(lambda _: _css_int(util, body, "--font-size") > size_before) + reader_view.wait.until( + lambda _: _css_int(util, body, "--font-size") > size_before + ) @pytest.mark.parametrize("alignment,intended_alignment", ALIGNMENTS) def test_type_control_panel_text_alignment( - driver: Firefox, - alignment: AlignKey, - intended_alignment: AlignCSS, + driver: Firefox, + alignment: AlignKey, + intended_alignment: AlignCSS, ) -> None: """ C130919.3: Ensure the functionality of the type control panels works (text alignment). @@ -114,11 +132,16 @@ def test_type_control_panel_text_alignment( reader_view.open_advanced_options() reader_view.get_element(f"toolbar-text-align-{alignment}").click() - reader_view.wait.until(lambda _: container.value_of_css_property("--text-alignment") == intended_alignment) + reader_view.wait.until( + lambda _: container.value_of_css_property("--text-alignment") + == intended_alignment + ) @pytest.mark.parametrize("direction", SLIDER_DIRS) -def test_type_control_panel_content_width(driver: Firefox, direction: SliderDirection) -> None: +def test_type_control_panel_content_width( + driver: Firefox, direction: SliderDirection +) -> None: """ C130919.4: Ensure the functionality of the type control panels works (content width slider). """ @@ -137,13 +160,19 @@ def test_type_control_panel_content_width(driver: Firefox, direction: SliderDire reader_view.change_slider_value(slider, increase=(direction == "increase")) if direction == "decrease": - reader_view.wait.until(lambda _: _css_int(util, body, "--content-width") < width_before) + reader_view.wait.until( + lambda _: _css_int(util, body, "--content-width") < width_before + ) else: - reader_view.wait.until(lambda _: _css_int(util, body, "--content-width") > width_before) + reader_view.wait.until( + lambda _: _css_int(util, body, "--content-width") > width_before + ) @pytest.mark.parametrize("direction", SLIDER_DIRS) -def test_type_control_panel_line_spacing(driver: Firefox, direction: SliderDirection) -> None: +def test_type_control_panel_line_spacing( + driver: Firefox, direction: SliderDirection +) -> None: """ C130919.5: Ensure the functionality of the type control panels works (line spacing slider). """ @@ -162,9 +191,13 @@ def test_type_control_panel_line_spacing(driver: Firefox, direction: SliderDirec reader_view.change_slider_value(slider, increase=(direction == "increase")) if direction == "decrease": - reader_view.wait.until(lambda _: _css_int(util, body, "block-size") < block_before) + reader_view.wait.until( + lambda _: _css_int(util, body, "block-size") < block_before + ) else: - reader_view.wait.until(lambda _: _css_int(util, body, "block-size") > block_before) + reader_view.wait.until( + lambda _: _css_int(util, body, "block-size") > block_before + ) def test_type_control_panel_character_spacing(driver: Firefox) -> None: @@ -186,7 +219,9 @@ def test_type_control_panel_character_spacing(driver: Firefox) -> None: reader_view.change_slider_value(slider, increase=True) - reader_view.wait.until(lambda _: _css_int(util, container, "--letter-spacing") > letter_before) + reader_view.wait.until( + lambda _: _css_int(util, container, "--letter-spacing") > letter_before + ) def test_type_control_panel_word_spacing(driver: Firefox) -> None: @@ -208,4 +243,6 @@ def test_type_control_panel_word_spacing(driver: Firefox) -> None: reader_view.change_slider_value(slider, increase=True) - reader_view.wait.until(lambda _: _css_int(util, container, "--word-spacing") > word_before) + reader_view.wait.until( + lambda _: _css_int(util, container, "--word-spacing") > word_before + ) From bf7c3280c26c35824f4a30c772a6550408070477 Mon Sep 17 00:00:00 2001 From: Tracy Date: Mon, 13 Oct 2025 14:42:00 -0500 Subject: [PATCH 2/3] Update example.com hyperlink --- SELECTOR_INFO.md | 4 ++-- modules/data/example_page.components.json | 2 +- tests/menus/test_hyperlink_context_menu.py | 2 +- tests/menus/test_tab_context_menu_close.py | 14 ++++++++------ 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/SELECTOR_INFO.md b/SELECTOR_INFO.md index 7da6df8d4..54fea6f27 100644 --- a/SELECTOR_INFO.md +++ b/SELECTOR_INFO.md @@ -1833,7 +1833,7 @@ Location: Any non-linked content space inside example.com page Path to .json: modules/data/exemple_page.components.json ``` ``` -Selector Name: more-information +Selector Name: learn-more Selector Data: "Learn more" Description: "Learn more" link Location: The hyperlink positioned in the middle of example.com page @@ -3238,7 +3238,7 @@ Path to .json: modules/data/panel_ui.components.json ``` ``` Selector name: panel-ui-history-recently-closed-reopen-tabs -Selector Data: toolbarbutton[class='subviewbutton subviewbutton-nav'][label='Recently closed tabs'] +Selector Data: toolbarbutton[class='restoreallitem subviewbutton panel-subview-footer-button'] Description: Recently closed reopen tabs Location: On the hamburger menu > History Path to .json: modules/data/panel_ui.components.json diff --git a/modules/data/example_page.components.json b/modules/data/example_page.components.json index 404fb7bfa..1333ea853 100644 --- a/modules/data/example_page.components.json +++ b/modules/data/example_page.components.json @@ -14,7 +14,7 @@ ] }, - "more-information": { + "learn-more": { "selectorData": "Learn more", "strategy": "link_text", "groups": [] diff --git a/tests/menus/test_hyperlink_context_menu.py b/tests/menus/test_hyperlink_context_menu.py index 1d3979860..362eaae88 100644 --- a/tests/menus/test_hyperlink_context_menu.py +++ b/tests/menus/test_hyperlink_context_menu.py @@ -20,7 +20,7 @@ def test_open_link_in_new_window(driver: Firefox): example.open() # Right-click the hyperlink - example.context_click("more-information") + example.context_click("learn-more") # Click on the open in new window option hyperlink_context.click_and_hide_menu("context-menu-open-link-in-new-window") diff --git a/tests/menus/test_tab_context_menu_close.py b/tests/menus/test_tab_context_menu_close.py index 9f14c41a0..195932b70 100644 --- a/tests/menus/test_tab_context_menu_close.py +++ b/tests/menus/test_tab_context_menu_close.py @@ -93,27 +93,29 @@ def test_copy_link(driver: Firefox): nav = Navigation(driver) hyperlink_context = ContextMenu(driver) tabs = TabBar(driver) - example = ExamplePage(driver).open() + example = ExamplePage(driver) - # right click the hyperlink + example.open() + + # Right-click the hyperlink sleep(1) example.context_click("learn-more") - # click on the open in new window option + # Click on the open in new window option sleep(1) hyperlink_context.click_and_hide_menu("context-menu-copy-link") - # open a new tab + # Open a new tab tabs.new_tab_by_button() tabs.wait_for_num_tabs(2) sleep(1) driver.switch_to.window(driver.window_handles[1]) - # # context click and paste + # Context click and paste search_bar = nav.get_awesome_bar() nav.context_click(search_bar) - # paste and go + # Paste and go nav.click_and_hide_menu("context-menu-paste-and-go") example.title_contains(example.MORE_INFO_TITLE) From ed9cfdde447aa5cff85a885e2f8884d74ab9e0d4 Mon Sep 17 00:00:00 2001 From: Tracy Date: Tue, 14 Oct 2025 09:40:51 -0500 Subject: [PATCH 3/3] Update example.com hyperlink --- tests/menus/test_tab_context_menu_actions.py | 8 ++++---- tests/tabs/test_open_new_tab_via_hyperlink.py | 1 - tests/tabs/test_pin_tab.py | 2 +- tests/tabs/test_reopen_tab_through_context_menu.py | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/menus/test_tab_context_menu_actions.py b/tests/menus/test_tab_context_menu_actions.py index 7da28305b..1eae831da 100644 --- a/tests/menus/test_tab_context_menu_actions.py +++ b/tests/menus/test_tab_context_menu_actions.py @@ -28,18 +28,18 @@ def test_duplicate_tab(driver: Firefox): tabs_to_open = 4 - # open some tabs + # Open some tabs for i in range(tabs_to_open): driver.get(links[i]) tabs.new_tab_by_button() driver.switch_to.window(driver.window_handles[i + 1]) - # context click + # Context click first_tab = tabs.get_tab(1) tabs.context_click(first_tab) tab_context_menu.click_and_hide_menu("context-menu-duplicate-tab") - # get the current tab and assert the url + # Get the current tab and assert the url driver.switch_to.window(driver.window_handles[tabs_to_open + 1]) current_page = driver.current_url assert current_page == links[0] @@ -54,7 +54,7 @@ def test_close_multiple_tabs_to_right(driver: Firefox): tabs_to_open = 4 - # open some tabs + # Open some tabs for i in range(tabs_to_open): driver.get(links[i]) tabs.new_tab_by_button() diff --git a/tests/tabs/test_open_new_tab_via_hyperlink.py b/tests/tabs/test_open_new_tab_via_hyperlink.py index 2c4a15b7c..24932323d 100644 --- a/tests/tabs/test_open_new_tab_via_hyperlink.py +++ b/tests/tabs/test_open_new_tab_via_hyperlink.py @@ -4,7 +4,6 @@ from modules.browser_object import ContextMenu from modules.page_object import ExamplePage - URL = "https://www.iana.org/help/example-domains" diff --git a/tests/tabs/test_pin_tab.py b/tests/tabs/test_pin_tab.py index 62f613ef6..94f94809a 100644 --- a/tests/tabs/test_pin_tab.py +++ b/tests/tabs/test_pin_tab.py @@ -3,9 +3,9 @@ from modules.browser_object import ContextMenu, TabBar - NUM_TABS = 5 + @pytest.fixture() def test_case(): return "134722" diff --git a/tests/tabs/test_reopen_tab_through_context_menu.py b/tests/tabs/test_reopen_tab_through_context_menu.py index 7af5ba868..cf33e00a5 100644 --- a/tests/tabs/test_reopen_tab_through_context_menu.py +++ b/tests/tabs/test_reopen_tab_through_context_menu.py @@ -3,11 +3,11 @@ from modules.browser_object import ContextMenu, TabBar - TABS_TO_OPEN = 4 FIRST_URL = "about:about" SECOND_URL = "about:robots" + @pytest.fixture() def test_case(): return "134648"