diff --git a/SELECTOR_INFO.md b/SELECTOR_INFO.md index 70e467847..9d6279573 100644 --- a/SELECTOR_INFO.md +++ b/SELECTOR_INFO.md @@ -1833,8 +1833,8 @@ Location: Any non-linked content space inside example.com page Path to .json: modules/data/exemple_page.components.json ``` ``` -Selector Name: more-information -Selector Data: "More information..." +Selector Name: learn-more +Selector Data: "Learn more" Description: More information..." link Location: The hyperlink positioned in the middle of example.com page Path to .json: modules/data/exemple_page.components.json @@ -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='restoreallitem subviewbutton panel-subview-footer-button'] +Selector Data: toolbarbutton[class='subviewbutton subviewbutton-nav'][label='Recently closed tabs'] Description: Recently closed reopen tabs Location: On the hamburger menu > History Path to .json: modules/data/panel_ui.components.json diff --git a/modules/browser_object_panel_ui.py b/modules/browser_object_panel_ui.py index 711509fb9..d64527f7c 100644 --- a/modules/browser_object_panel_ui.py +++ b/modules/browser_object_panel_ui.py @@ -171,7 +171,7 @@ def reopen_recently_closed_tabs(self) -> BasePage: self.click_on("panel-ui-history") self.click_on("panel-ui-history-recently-closed") - if self.sys_platform() == "Linux": + if self.sys_platform() in ("Linux", "Darwin"): sleep(2) self.click_on("panel-ui-history-recently-closed-reopen-tabs") diff --git a/modules/data/example_page.components.json b/modules/data/example_page.components.json index d8cc5339f..1333ea853 100644 --- a/modules/data/example_page.components.json +++ b/modules/data/example_page.components.json @@ -14,8 +14,8 @@ ] }, - "more-information": { - "selectorData": "More information...", + "learn-more": { + "selectorData": "Learn more", "strategy": "link_text", "groups": [] } diff --git a/modules/data/panel_ui.components.json b/modules/data/panel_ui.components.json index 4be365c5e..8011674e1 100644 --- a/modules/data/panel_ui.components.json +++ b/modules/data/panel_ui.components.json @@ -133,7 +133,7 @@ }, "panel-ui-history-recently-closed-reopen-tabs": { - "selectorData": "toolbarbutton[class='restoreallitem subviewbutton panel-subview-footer-button']", + "selectorData": "toolbarbutton[class='subviewbutton subviewbutton-nav'][label='Recently closed tabs']", "strategy": "css", "groups": [] }, diff --git a/tests/menus/test_hyperlink_context_menu.py b/tests/menus/test_hyperlink_context_menu.py index c58f77b79..360b3980c 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 4957ec51f..9f14c41a0 100644 --- a/tests/menus/test_tab_context_menu_close.py +++ b/tests/menus/test_tab_context_menu_close.py @@ -97,7 +97,7 @@ def test_copy_link(driver: Firefox): # right click the hyperlink sleep(1) - example.context_click("more-information") + example.context_click("learn-more") # click on the open in new window option sleep(1) diff --git a/tests/security_and_privacy/test_open_link_in_private_window.py b/tests/security_and_privacy/test_open_link_in_private_window.py index ee6f5aa5a..f2c4004a6 100644 --- a/tests/security_and_privacy/test_open_link_in_private_window.py +++ b/tests/security_and_privacy/test_open_link_in_private_window.py @@ -20,7 +20,7 @@ def test_open_link_in_private_window(driver: Firefox): nav = Navigation(driver) sleep(1) - example.context_click("more-information") + example.context_click("learn-more") sleep(1) context_menu.click_and_hide_menu("context-menu-open-link-in-new-private-window") diff --git a/tests/tabs/test_open_new_bg_tab_via_mouse_and_keyboard.py b/tests/tabs/test_open_new_bg_tab_via_mouse_and_keyboard.py index 6f7369044..45d726dc3 100644 --- a/tests/tabs/test_open_new_bg_tab_via_mouse_and_keyboard.py +++ b/tests/tabs/test_open_new_bg_tab_via_mouse_and_keyboard.py @@ -21,7 +21,7 @@ def test_open_new_bg_tab_via_mouse_and_keyboard(driver: Firefox): example.open() # Middle click link, verify new background tab opens with correct URL - example.middle_click("more-information") + example.middle_click("learn-more") example.wait_for_num_tabs(2) example.switch_to_new_tab() @@ -32,7 +32,7 @@ def test_open_new_bg_tab_via_mouse_and_keyboard(driver: Firefox): example.switch_to_new_tab() # Control click link, verify new background tab opens with correct URL - example.control_click("more-information") + example.control_click("learn-more") example.wait_for_num_tabs(2) example.switch_to_new_tab() diff --git a/tests/tabs/test_open_new_tab_via_hyperlink.py b/tests/tabs/test_open_new_tab_via_hyperlink.py index 6377aced0..2c4a15b7c 100644 --- a/tests/tabs/test_open_new_tab_via_hyperlink.py +++ b/tests/tabs/test_open_new_tab_via_hyperlink.py @@ -5,6 +5,9 @@ from modules.page_object import ExamplePage +URL = "https://www.iana.org/help/example-domains" + + @pytest.fixture() def test_case(): return "134444" @@ -14,15 +17,17 @@ def test_open_new_via_hyperlink(driver: Firefox): """ C134444 - A hyperlink can be opened in a new tab """ - example = ExamplePage(driver).open() - # Use context menu option to open link in new tab - example.context_click("more-information") + # Instantiate objects + example = ExamplePage(driver) context_menu = ContextMenu(driver) - with driver.context(driver.CONTEXT_CHROME): - context_menu.click_and_hide_menu("context-menu-open-link-in-tab") + + # Use context menu option to open link in new tab + example.open() + example.context_click("learn-more") + context_menu.click_and_hide_menu("context-menu-open-link-in-tab") # Get the title of the new tab example.wait_for_num_tabs(2) example.switch_to_new_tab() - example.url_contains("https://www.iana.org/help/example-domains") + example.url_contains(URL) diff --git a/tests/tabs/test_pin_tab.py b/tests/tabs/test_pin_tab.py index 619ecd9e0..62f613ef6 100644 --- a/tests/tabs/test_pin_tab.py +++ b/tests/tabs/test_pin_tab.py @@ -4,6 +4,8 @@ from modules.browser_object import ContextMenu, TabBar +NUM_TABS = 5 + @pytest.fixture() def test_case(): return "134722" @@ -13,16 +15,16 @@ def test_pin_tab(driver: Firefox): """ C134722, ensures that tabs can be pinned """ + + # Instantiate objects tabs = TabBar(driver) tab_context_menu = ContextMenu(driver) - num_tabs = 5 - - # opening some tabs - for _ in range(num_tabs): + # Opening some tabs + for _ in range(NUM_TABS): tabs.new_tab_by_button() - # pin the 1st tab + # Pin the 1st tab first_tab = tabs.get_tab(1) tabs.context_click(first_tab) tab_context_menu.click_and_hide_menu("context-menu-pin-tab") @@ -30,11 +32,11 @@ def test_pin_tab(driver: Firefox): assert tabs.is_pinned(first_tab) # ensuring all the other tabs are not pinned - for i in range(2, num_tabs + 2): + for i in range(2, NUM_TABS + 2): tab = tabs.get_tab(i) assert not tabs.is_pinned(tab) - # unpinning the tab and ensuring it is no longer pinned + # Unpinning the tab and ensuring it is no longer pinned tabs.context_click(first_tab) tab_context_menu.click_and_hide_menu("context-menu-unpin-tab") diff --git a/tests/tabs/test_reopen_tab_through_context_menu.py b/tests/tabs/test_reopen_tab_through_context_menu.py index b28dd7e56..7af5ba868 100644 --- a/tests/tabs/test_reopen_tab_through_context_menu.py +++ b/tests/tabs/test_reopen_tab_through_context_menu.py @@ -4,6 +4,10 @@ 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" @@ -11,27 +15,28 @@ def test_case(): def test_reopen_tab_through_context_menu(driver: Firefox): """C134648: Reopen tab through context menu""" + + # Instantiate objects tabs = TabBar(driver) tab_context_menu = ContextMenu(driver) - tabs_to_open = 4 - - driver.get("about:about") - for _ in range(1, tabs_to_open): + # Open several different tabs and close them + driver.get(FIRST_URL) + for _ in range(1, TABS_TO_OPEN): tabs.new_tab_by_button() driver.switch_to.window(driver.window_handles[-1]) - driver.get("about:robots") + driver.get(SECOND_URL) remaining_tab = tabs.get_tab(1) - closing_tab = tabs.get_tab(tabs_to_open) + closing_tab = tabs.get_tab(TABS_TO_OPEN) - with driver.context(driver.CONTEXT_CHROME): - assert tabs.get_tab_title(closing_tab).startswith("Gort") + assert tabs.get_tab_title(closing_tab).startswith("Gort") driver.close() driver.switch_to.window(driver.window_handles[0]) + # Right click on the remaining tab and reopen previously closed tab tabs.context_click(remaining_tab) tab_context_menu.click_and_hide_menu("context-menu-reopen-closed-tab") - reopened_tab = tabs.get_tab(tabs_to_open + 1) + reopened_tab = tabs.get_tab(TABS_TO_OPEN + 1) assert tabs.get_tab_title(reopened_tab).startswith("Gort") diff --git a/tests/tabs/test_reopen_tab_through_history_menu.py b/tests/tabs/test_reopen_tab_through_history_menu.py index bf7a40f63..53b8f37ab 100644 --- a/tests/tabs/test_reopen_tab_through_history_menu.py +++ b/tests/tabs/test_reopen_tab_through_history_menu.py @@ -12,7 +12,7 @@ def test_case(): return "134650" -links = [ +LINKS = [ "about:about", "about:addons", "about:cache", @@ -22,7 +22,8 @@ def test_case(): "about:blank", ] -link_set = set(links) +LINK_SET = set(LINKS) +NUM_TABS = 6 @pytest.mark.skipif( @@ -30,27 +31,28 @@ def test_case(): ) def test_reopen_tab_through_history_menu(driver: Firefox): """C134650 - Verify that the recently closed tab can be reopened from the history menu""" - # open 6 tabs + + # Instantiate objects tabs = TabBar(driver) panel = PanelUi(driver) - num_tabs = 6 - for i in range(num_tabs): - driver.get(links[i]) + # open 6 tabs + for i in range(NUM_TABS): + driver.get(LINKS[i]) tabs.new_tab_by_button() driver.switch_to.window(driver.window_handles[i + 1]) # close the first 6 tabs - for i in range(num_tabs): - tabs.close_tab(tabs.get_tab(num_tabs - i)) + for i in range(NUM_TABS): + tabs.close_tab(tabs.get_tab(NUM_TABS - i)) # open menu bar and reopen recently closed tabs panel.open() panel.reopen_recently_closed_tabs() # go through all the tabs and ensure they were the ones that were opened previously - for i in range(num_tabs): - driver.switch_to.window(driver.window_handles[i + 1]) + for i in range(NUM_TABS): + driver.switch_to.window(driver.window_handles[-1]) current_page = driver.current_url logging.info(f"The current URL is: {current_page}") - assert current_page in link_set + assert current_page in LINK_SET