Skip to content

Commit 058cbe6

Browse files
add files to new branch (#939)
* add files to new branch * re-order the line to where it makes sense to be
1 parent e2d1db5 commit 058cbe6

File tree

6 files changed

+277
-1
lines changed

6 files changed

+277
-1
lines changed

SELECTOR_INFO.md

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,27 @@ Location: Any history item in the Hamburger history list
17061706
Path to .json: modules/data/context_menu.components.json
17071707
```
17081708
```
1709+
Selector Name: context-move-tab-to-new-group
1710+
Selector Data: "context_moveTabToNewGroup"
1711+
Description: Tab context click option "Add Tab to New Group"
1712+
Location: In the tabbed browser
1713+
Path to .json: modules/data/context_menu.components.json
1714+
```
1715+
```
1716+
Selector Name: context-move-tab-to-group
1717+
Selector Data: "context_moveTabToGroup"
1718+
Description: Tab context click option "Add Tab to Group"
1719+
Location: In the tabbed browser
1720+
Path to .json: modules/data/context_menu.components.json
1721+
```
1722+
```
1723+
Selector Name: context-remove-tab-from-group
1724+
Selector Data: "context_ungroupTab"
1725+
Description: Tab context click option "Remove from Group"
1726+
Location: In the tabbed browser
1727+
Path to .json: modules/data/context_menu.components.json
1728+
```
1729+
```
17091730
Selector Name: context-menu-pin-tab
17101731
Selector Data: "context_pinTab"
17111732
Description: Tab context click option "Pin Tab"
@@ -4059,7 +4080,62 @@ Description: A tab's Close (X) button
40594080
Location: In the tabbed browser.
40604081
Path to .json: modules/data/tab_bar.components.json
40614082
```
4062-
4083+
```
4084+
Selector name: tabgroup-menu
4085+
Selector Data: "tab-group-editor"
4086+
Description: Adding tabs to a group menu
4087+
Location: Menu that opens when adding tabs to a group
4088+
Path to .json: modules/data/tab_bar.components.json
4089+
```
4090+
```
4091+
Selector Name: tabgroup-input
4092+
Selector Data: "[data-l10n-id='tab-group-editor-name-field']"
4093+
Description: Name field
4094+
Location: Menu that opens when adding tabs to a group
4095+
Path to .json: modules/data/tab_bar.components.json
4096+
```
4097+
```
4098+
Selector Name: tabgroup-create-button
4099+
Selector Data: "tab-group-editor-button-create"
4100+
Description: Create button
4101+
Location: Menu that opens when adding tabs to a group
4102+
Path to .json: modules/data/tab_bar.components.json
4103+
```
4104+
```
4105+
Selector Name: tabgroup-label
4106+
Selector Data: "tab-group-label"
4107+
Description: The label of tab group
4108+
Location: In the tabbed browser
4109+
Path to .json: modules/data/tab_bar.components.json
4110+
```
4111+
```
4112+
Selector Name: tabgroup-menuitem
4113+
Selector Data: "tab-group-icon"
4114+
Description: Icon related to tab group
4115+
Location: In the tabbed browser
4116+
Path to .json: modules/data/tab_bar.components.json
4117+
```
4118+
```
4119+
Selector Name: tabgroup-overflow-count
4120+
Selector Data: "tab-group-overflow-count"
4121+
Description: Numbers of tabs in tab group
4122+
Location: In the tabbed browser
4123+
Path to .json: modules/data/tab_bar.components.json
4124+
```
4125+
```
4126+
Selector Name: tabgroup-line
4127+
Selector Data: "tab-group-line"
4128+
Description: Line indicator of tab group
4129+
Location: In the tabbed browser
4130+
Path to .json: modules/data/tab_bar.components.json
4131+
```
4132+
```
4133+
Selector Name: tabgroup-ungroup-tabs
4134+
Selector Data: "tabGroupEditor_ungroupTabs"
4135+
Description: Ungroup the tab group
4136+
Location: Menu that opens when right click on the tab group label
4137+
Path to .json: modules/data/tab_bar.components.json
4138+
```
40634139
#### text_area_form_autofill
40644140
```
40654141
Selector Name: street-address-textarea

manifests/key.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,10 @@ tabs:
11561156
splits:
11571157
- smoke
11581158
- ci-extended
1159+
test_ungroup_tabs:
1160+
result: pass
1161+
splits:
1162+
- functional1
11591163
theme_and_toolbar:
11601164
test_customize_themes_and_redirect:
11611165
result: pass

modules/browser_object_tabbar.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from selenium.webdriver.remote.webelement import WebElement
88
from selenium.webdriver.support import expected_conditions as EC
99

10+
from modules.browser_object import ContextMenu
1011
from modules.page_base import BasePage
1112

1213

@@ -419,3 +420,35 @@ def reload_tab(self, nav, mod_key=None, extra_key=None):
419420
self.perform_key_combo(extra_key)
420421
else:
421422
raise ValueError("You must provide extra_key to perform reload.")
423+
424+
@BasePage.context_chrome
425+
def create_tab_group(
426+
self, num_tabs: int, group_name: str, tab_context_menu: ContextMenu
427+
) -> BasePage:
428+
"""Create a new tab group"""
429+
430+
# Open few tabs
431+
for i in range(num_tabs):
432+
self.new_tab_by_button()
433+
434+
# Add the first tab into a New Group
435+
first_tab = self.get_tab(1)
436+
self.context_click(first_tab)
437+
tab_context_menu.click_and_hide_menu("context-move-tab-to-new-group")
438+
439+
# Wait for tab group menu to open
440+
self.element_visible("tabgroup-input")
441+
442+
# Enter a group Name and create group
443+
self.fill("tabgroup-input", group_name, clear_first=False)
444+
445+
# Make sure the group is created
446+
self.element_visible("tabgroup-label")
447+
448+
# Add the second tab into existing Group
449+
second_tab = self.get_tab(2)
450+
self.context_click(second_tab)
451+
tab_context_menu.click_on("context-move-tab-to-group")
452+
self.click_and_hide_menu("tabgroup-menuitem")
453+
454+
return self

modules/data/context_menu.components.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,24 @@
5555
"groups": []
5656
},
5757

58+
"context-move-tab-to-new-group": {
59+
"selectorData": "context_moveTabToNewGroup",
60+
"strategy": "id",
61+
"groups": []
62+
},
63+
64+
"context-move-tab-to-group": {
65+
"selectorData": "context_moveTabToGroup",
66+
"strategy": "id",
67+
"groups": []
68+
},
69+
70+
"context-remove-tab-from-group": {
71+
"selectorData": "context_ungroupTab",
72+
"strategy": "id",
73+
"groups": []
74+
},
75+
5876
"context-menu-pin-tab": {
5977
"selectorData": "context_pinTab",
6078
"strategy": "id",

modules/data/tab_bar.components.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,66 @@
113113
"groups": [
114114
"doNotCache"
115115
]
116+
},
117+
118+
"tabgroup-menu": {
119+
"selectorData": "tab-group-editor",
120+
"strategy": "id",
121+
"groups": [
122+
"doNotCache"
123+
]
124+
},
125+
126+
"tabgroup-input": {
127+
"selectorData": "[data-l10n-id='tab-group-editor-name-field']",
128+
"strategy": "css",
129+
"groups": [
130+
"doNotCache"
131+
]
132+
},
133+
134+
"tabgroup-create-button": {
135+
"selectorData": "tab-group-editor-button-create",
136+
"strategy": "id",
137+
"groups": []
138+
},
139+
140+
"tabgroup-label": {
141+
"selectorData": "tab-group-label",
142+
"strategy": "class",
143+
"groups": [
144+
"doNotCache"
145+
]
146+
},
147+
148+
"tabgroup-menuitem": {
149+
"selectorData": "tab-group-icon",
150+
"strategy": "class",
151+
"groups": [
152+
"doNotCache"
153+
]
154+
},
155+
156+
"tabgroup-overflow-count": {
157+
"selectorData": "tab-group-overflow-count",
158+
"strategy": "class",
159+
"groups": [
160+
"doNotCache"
161+
]
162+
},
163+
164+
"tabgroup-line": {
165+
"selectorData": "tab-group-line",
166+
"strategy": "class",
167+
"groups": [
168+
"doNotCache"
169+
]
170+
},
171+
172+
"tabgroup-ungroup-tabs": {
173+
"selectorData": "tabGroupEditor_ungroupTabs",
174+
"strategy": "id",
175+
"groups": []
116176
}
117177

118178
}

tests/tabs/test_ungroup_tabs.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
from selenium.webdriver.common.action_chains import ActionChains
4+
5+
from modules.browser_object import ContextMenu, TabBar
6+
7+
NUM_TABS = 2
8+
GROUP_NAME = ["group1", "group2", "group3"]
9+
10+
11+
@pytest.fixture()
12+
def test_case():
13+
return "2796550"
14+
15+
16+
@pytest.fixture()
17+
def add_to_prefs_list():
18+
"""Add to list of prefs to set"""
19+
return [
20+
("browser.tabs.groups.enabled", True),
21+
("browser.tabs.groups.dragOverThresholdPercent", 20),
22+
]
23+
24+
25+
def test_ungroup_tabs(driver: Firefox):
26+
"""
27+
C2796550, verify that grouped tab can be ungrouped.
28+
Since in the step2 a tab group still remains,
29+
it is executed after step3 to avoid tests
30+
dependency.
31+
"""
32+
33+
"""
34+
Step 1
35+
Action: Right click on one of the grouped Tabs and select Remove from Group.
36+
Verification: The Selected Tab is removed from the group.
37+
"""
38+
39+
tabs = TabBar(driver)
40+
tab_context_menu = ContextMenu(driver)
41+
42+
# Create a tab group
43+
tabs.create_tab_group(NUM_TABS, GROUP_NAME[0], tab_context_menu)
44+
45+
# Remove first tab from the tab group
46+
first_tab = tabs.get_tab(1)
47+
tabs.context_click(first_tab)
48+
tab_context_menu.click_and_hide_menu("context-remove-tab-from-group")
49+
50+
# Verify tab is removed from the tab group
51+
tabs.element_not_visible("tabgroup-overflow-count")
52+
53+
"""
54+
Step 3
55+
Action: Right-click the created Tab Group and select Ungroup Tabs.
56+
Verification: The Tab Group name and color is no longer displayed and all
57+
tabs are no longer part of any group.
58+
"""
59+
60+
# Create a tab group
61+
tabs.create_tab_group(NUM_TABS, GROUP_NAME[2], tab_context_menu)
62+
63+
# Right-click on the group and select Ungroup Tabs.
64+
tabs.context_click("tabgroup-label")
65+
tabs.click_and_hide_menu("tabgroup-ungroup-tabs")
66+
67+
# Verify tab group is no longer there
68+
tabs.element_not_visible("tabgroup-label")
69+
70+
"""
71+
Step 2
72+
Action: Grab another tab and move it beyond a Tab that is outside the group.
73+
Verification: The selected tab is no longer part of that Tab group.
74+
"""
75+
76+
# Create a tab group
77+
tabs.create_tab_group(NUM_TABS, GROUP_NAME[1], tab_context_menu)
78+
79+
# Click the first tab, hold, move by offset, and then release
80+
first_tab = tabs.get_tab(1)
81+
tabs.set_chrome_context()
82+
tabs.actions.click_and_hold(first_tab).move_by_offset(120, 0).release().perform()
83+
84+
# Verify tab is removed from the tab group
85+
tabs.element_not_visible("tabgroup-overflow-count")

0 commit comments

Comments
 (0)