Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions SELECTOR_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/browser_object_panel_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions modules/data/example_page.components.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
]
},

"more-information": {
"selectorData": "More information...",
"learn-more": {
"selectorData": "Learn more",
"strategy": "link_text",
"groups": []
}
Expand Down
2 changes: 1 addition & 1 deletion modules/data/panel_ui.components.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": []
},
Expand Down
2 changes: 1 addition & 1 deletion tests/menus/test_hyperlink_context_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion tests/menus/test_tab_context_menu_close.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions tests/tabs/test_open_new_bg_tab_via_mouse_and_keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()

Expand Down
17 changes: 11 additions & 6 deletions tests/tabs/test_open_new_tab_via_hyperlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
16 changes: 9 additions & 7 deletions tests/tabs/test_pin_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from modules.browser_object import ContextMenu, TabBar


NUM_TABS = 5

@pytest.fixture()
def test_case():
return "134722"
Expand All @@ -13,28 +15,28 @@ 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")

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")

Expand Down
23 changes: 14 additions & 9 deletions tests/tabs/test_reopen_tab_through_context_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,39 @@
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"


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")
24 changes: 13 additions & 11 deletions tests/tabs/test_reopen_tab_through_history_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_case():
return "134650"


links = [
LINKS = [
"about:about",
"about:addons",
"about:cache",
Expand All @@ -22,35 +22,37 @@ def test_case():
"about:blank",
]

link_set = set(links)
LINK_SET = set(LINKS)
NUM_TABS = 6


@pytest.mark.skipif(
system().lower().startswith("linux"), reason="Currently unstable in linux"
)
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