Skip to content

Commit 994af7f

Browse files
authored
Merge pull request #755 from mozilla/pr-740
Pr 740 re-do
2 parents c44ffb5 + ab782a5 commit 994af7f

File tree

5 files changed

+74
-1
lines changed

5 files changed

+74
-1
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
/.vscode/
22
/venv/
33
.env
44
.report.json

SELECTOR_INFO.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,6 +1775,13 @@ Location: Toolbar - any bookmark context menu
17751775
Path to .json: modules/data/context_menu.components.json
17761776
```
17771777
```
1778+
Selector Name: context-menu-toolbar-open-in-new-tab
1779+
Selector Data: selectorData": "placesContext_open:newtab"
1780+
Description: Context menu option from a Toolbar bookmark
1781+
Location: Toolbar - any bookmark context menu
1782+
Path to .json: modules/data/context_menu.components.json
1783+
```
1784+
```
17781785
Selector Name: context-menu-toolbar-open-all-bookmarks
17791786
Selector Data: placesContext_openBookmarkContainer:tabs
17801787
Description: Open all bookmarks from the context menu option from a Toolbar bookmark

modules/browser_object_navigation.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,23 @@ def open_bookmark_from_toolbar(self, bookmark_title: str) -> BasePage:
569569
self.panel_ui.click_on("bookmark-by-title", labels=[bookmark_title])
570570
return self
571571

572+
@BasePage.context_chrome
573+
def open_bookmark_in_new_tab_via_context_menu(
574+
self, bookmark_title: str
575+
) -> BasePage:
576+
"""
577+
Right-click bookmark and opens it in a new tab via context menu
578+
579+
Argument:
580+
bookmark_title: The title of the bookmark to open
581+
"""
582+
# Right-click the bookmark and open it in new tabe via context menu item
583+
self.panel_ui.element_clickable("bookmark-by-title", labels=[bookmark_title])
584+
self.panel_ui.context_click("bookmark-by-title", labels=[bookmark_title])
585+
self.context_menu.click_on("context-menu-toolbar-open-in-new-tab")
586+
587+
return self
588+
572589
@BasePage.context_chrome
573590
def open_bookmark_in_new_window_via_context_menu(
574591
self, bookmark_title: str

modules/data/context_menu.components.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@
115115
"groups": []
116116
},
117117

118+
"context-menu-toolbar-open-in-new-tab": {
119+
"selectorData": "placesContext_open:newtab",
120+
"strategy": "id",
121+
"groups": ["doNotCache"]
122+
},
123+
118124
"context-menu-open-link-in-new-window": {
119125
"selectorData": "context-openlink",
120126
"strategy": "id",
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
from selenium.webdriver.support import expected_conditions as EC
4+
from selenium.webdriver.support.ui import WebDriverWait
5+
6+
from modules.browser_object import Navigation, TabBar
7+
from modules.page_object_generics import GenericPage
8+
9+
10+
@pytest.fixture()
11+
def test_case():
12+
return "134460"
13+
14+
15+
BOOKMARK_URL = "https://www.youtube.com/"
16+
BOOKMARK_TITLE = "YouTube"
17+
18+
19+
def test_open_bookmark_in_new_tab(driver: Firefox):
20+
"""
21+
C134460: Verify that New Tabs can be opened by right clicking and selecting new tab from the bookmarks.
22+
"""
23+
24+
# Instantiate objects
25+
nav = Navigation(driver)
26+
tabs = TabBar(driver)
27+
page = GenericPage(driver, url=BOOKMARK_URL)
28+
29+
# Bookmark the test page via star button
30+
page.open()
31+
nav.add_bookmark_via_star_icon()
32+
33+
# In a new tab, right-click the bookmarked page in the toolbar and select Open in New Tab from the context menu
34+
tabs.new_tab_by_button()
35+
nav.open_bookmark_in_new_tab_via_context_menu(BOOKMARK_TITLE)
36+
37+
# Verify that the test page is opened in a new normal tab
38+
tabs.wait_for_num_tabs(3)
39+
driver.switch_to.window(driver.window_handles[-1])
40+
41+
WebDriverWait(driver, 5).until(EC.url_contains("youtube"))
42+
assert "youtube" in driver.current_url
43+
page.url_contains("youtube")

0 commit comments

Comments
 (0)