Skip to content

Commit 850fe77

Browse files
Sangie50sv-hyacoubHani YacoubTracy-Walker
authored
Sangie/move multi selected tabs (#868)
* 2/3 test cases work * all 3 sub-tests pass locally * 2/3 test cases work * Mark Test test_auto_saved_generated_password_context_menu unstable (#864) Co-authored-by: Hani Yacoub <[email protected]> * Hani/ Searchmode change tab (#861) * test searchmode change tab * Test searchmode change tab --------- Co-authored-by: Hani Yacoub <[email protected]> * Hani/addressbar search engine keywords (#865) * Test addressbar search engine keywords * Test addressbar search engine keyword --------- Co-authored-by: Hani Yacoub <[email protected]> * works after rebasing * test added to manifest/key.yaml * for linux systems * fix for linux system * fix for linux system * testing for linux system (CI Smoke Test) * runs locally * Swap in built-in new window switching * Put hide conbtext menu back --------- Co-authored-by: Hani Yacoub <[email protected]> Co-authored-by: Hani Yacoub <[email protected]> Co-authored-by: Tracy <[email protected]>
1 parent cf9f91a commit 850fe77

File tree

5 files changed

+151
-3
lines changed

5 files changed

+151
-3
lines changed

SELECTOR_INFO.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,6 +1923,20 @@ Location: Context menu - Tab
19231923
Path to .json: modules/data/context_menu.components.json
19241924
```
19251925
```
1926+
Selector Name: context-menu-move-tab-to-end
1927+
Selector Data: menuitem[data-l10n-id='move-to-end']
1928+
Description: Context menu option to move a tab to the end of the tab bar.
1929+
Location: Context menu - Tab
1930+
Path to .json: modules/data/context_menu.components.json
1931+
```
1932+
```
1933+
Selector Name: context-menu-move-to-new-window
1934+
Selector Data: menuitem[data-l10n-id='move-to-new-window']
1935+
Description: Context menu option to move a tab to a new window.
1936+
Location: Context menu - Tab
1937+
Path to .json: modules/data/context_menu.components.json
1938+
```
1939+
```
19261940
Selector Name: context-menu-bookmark-link
19271941
Selector Data: context-bookmarklink
19281942
Description: Context menu option to bookmark a link
@@ -1934,7 +1948,6 @@ Selector Name: context-menu-search-select
19341948
Selector Data: coontext-searchselect
19351949
Description: Context menu option to search selected text with the engine set as default
19361950
Location: Context menu - topsite context menu
1937-
Path to .json: modules/data/context_menu.components.json
19381951
```
19391952
```
19401953
Selector Name: context-menu-open-link-in-new_container_tab
@@ -3305,14 +3318,14 @@ Path to .json: modules/data/navigation.components.json
33053318
Selector Name: selected_searchbar-search-engine
33063319
Selector Data: button.searchbar-engine-one-off-item[tooltiptext='{engine}'][selected]
33073320
Description: Searchbar-search-engine
3308-
Location: Selected search bar search engine
3321+
Location: Selected search bar search engine
33093322
Path to .json: modules/data/navigation.components.json
33103323
```
33113324
```
33123325
Selector Name: searchbar-suggestions
33133326
Selector Data: hbox.search-one-offs
33143327
Description: Searchbar suggestions
3315-
Location: Searchbar results
3328+
Location: Searchbar results
33163329
Path to .json: modules/data/navigation.components.json
33173330
```
33183331
```

manifests/key.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,10 @@ tabs:
10841084
result: pass
10851085
splits:
10861086
- smoke
1087+
test_move_multi_selected_tabs:
1088+
result: pass
1089+
splits:
1090+
- functional1
10871091
test_mute_tabs:
10881092
result:
10891093
linux: pass

modules/data/context_menu.components.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,19 @@
133133
"groups": []
134134
},
135135

136+
"context-menu-move-tab-to-end": {
137+
"selectorData": "menuitem[data-l10n-id='move-to-end']",
138+
"strategy": "css",
139+
"groups": []
140+
},
141+
142+
"context-menu-move-to-new-window": {
143+
"selectorData": "menuitem[data-l10n-id='move-to-new-window']",
144+
"strategy": "css",
145+
"groups": []
146+
},
147+
148+
136149
"context-menu-open-link-in-tab": {
137150
"selectorData": "context-openlinkintab",
138151
"strategy": "id",

tests/password_manager/test_auto_saved_generated_password_context_menu.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def add_to_prefs_list():
1919
return [("signon.rememberSignons", True)]
2020

2121

22+
@pytest.mark.unstable(reason="Bug 1996838")
2223
def test_auto_saved_generated_password_context_menu(driver: Firefox):
2324
"""
2425
C2248176 - Securely Generated Password is auto-saved when generated from password field context menu
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
4+
from modules.browser_object import ContextMenu, TabBar
5+
6+
# Title Constants
7+
EXPECTED_ROBOT_TITLE = "Gort!"
8+
EXPECTED_WELCOME_TITLE = "Welcome"
9+
10+
# Move options
11+
MOVE_TO_END = "context-menu-move-tab-to-end"
12+
MOVE_TO_START = "context-menu-move-tab-to-start"
13+
MOVE_TO_NEW_WINDOW = "context-menu-move-to-new-window"
14+
15+
# Tab Positions (4 tabs in total)
16+
FIRST_TAB_POSITION = 0
17+
SECOND_TAB_POSITION = 1
18+
THIRD_TAB_POSITION = 2
19+
LAST_TAB_POSITION = 3
20+
21+
22+
@pytest.fixture()
23+
def test_case():
24+
return "246989"
25+
26+
27+
@pytest.mark.parametrize(
28+
"move_option,expected_titles,expected_positions",
29+
[
30+
(
31+
MOVE_TO_END,
32+
(EXPECTED_ROBOT_TITLE, EXPECTED_WELCOME_TITLE),
33+
(THIRD_TAB_POSITION, LAST_TAB_POSITION),
34+
),
35+
(
36+
MOVE_TO_START,
37+
(EXPECTED_ROBOT_TITLE, EXPECTED_WELCOME_TITLE),
38+
(FIRST_TAB_POSITION, SECOND_TAB_POSITION),
39+
),
40+
(
41+
MOVE_TO_NEW_WINDOW,
42+
None,
43+
None,
44+
),
45+
],
46+
)
47+
def test_move_multi_selected_tabs(
48+
driver: Firefox, sys_platform: str, move_option, expected_titles, expected_positions
49+
):
50+
"""Test all tab movement operations in separate test runs"""
51+
tab_movements(
52+
driver, sys_platform, move_option, expected_titles, expected_positions
53+
)
54+
55+
56+
def tab_movements(
57+
driver: Firefox, sys_platform: str, move_option, expected_titles, expected_positions
58+
):
59+
tabs = TabBar(driver)
60+
tab_context_menu = ContextMenu(driver)
61+
62+
tab_titles = []
63+
url_list = ["about:logo", "about:robots", "about:welcome", "https://mozilla.org"]
64+
65+
# Open 4 tabs
66+
driver.get(url_list[0])
67+
tab_titles.append(driver.title)
68+
69+
for i in range(1, len(url_list)):
70+
tabs.new_tab_by_button()
71+
driver.switch_to.window(driver.window_handles[-1])
72+
driver.get(url_list[i])
73+
tab_titles.append(driver.title)
74+
75+
# Specific tabs we want to move
76+
selected_tab_indices = [2, 3] # Here indices start from 1
77+
selected_tabs = tabs.select_multiple_tabs_by_indices(
78+
selected_tab_indices, sys_platform
79+
)
80+
81+
if move_option == MOVE_TO_NEW_WINDOW:
82+
tabs.context_click(selected_tabs[1])
83+
tab_context_menu.click_and_hide_menu(move_option)
84+
tabs.hide_popup("tabContextMenu")
85+
86+
driver.switch_to.window(driver.window_handles[-1])
87+
new_window_tab_title = driver.title
88+
89+
assert EXPECTED_ROBOT_TITLE in new_window_tab_title, (
90+
"Robot should now be a new window"
91+
)
92+
93+
elif move_option in (MOVE_TO_END, MOVE_TO_START):
94+
assert expected_positions is not None
95+
assert expected_titles is not None
96+
97+
# Move-to-end/start
98+
tabs.context_click(selected_tabs[1])
99+
tab_context_menu.click_and_hide_menu(move_option)
100+
tabs.hide_popup("tabContextMenu")
101+
102+
# Verify for move-to-end/move-to-start
103+
104+
for expected_title, expected_position in zip(
105+
expected_titles, expected_positions
106+
):
107+
# Switch to the window handle at the expected index
108+
# NOTE: driver.window_handles are the HANDLES, the index is the order they APPEAR
109+
driver.switch_to.window(driver.window_handles[expected_position])
110+
111+
actual_title = driver.title
112+
113+
# Assert the title is correct
114+
assert expected_title in actual_title, (
115+
f"Verification failed for tab at index {expected_position}: "
116+
f"Expected title '{expected_title}' but found '{actual_title}'."
117+
)

0 commit comments

Comments
 (0)