Skip to content

Commit b6baa04

Browse files
committed
test 1976534 - moving pinned tabs
1 parent 3aad3bf commit b6baa04

File tree

5 files changed

+99
-7
lines changed

5 files changed

+99
-7
lines changed

SELECTOR_INFO.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,6 +1788,13 @@ Description: Open all bookmarks from the context menu option from a Toolbar book
17881788
Location: Context menu - Toolbar
17891789
Path to .json: modules/data/context_menu.components.json
17901790
```
1791+
```
1792+
Selector Name: context-menu-move-tab-to-start
1793+
Selector Data: menuitem[data-l10n-id='move-to-start']
1794+
Description: Context menu option to move a tab to the start of the tab bar.
1795+
Location: Context menu - Tab
1796+
Path to .json: modules/data/context_menu.components.json
1797+
```
17911798
#### credit_card_fill
17921799
```
17931800
Selector Name: form-field

modules/data/context_menu.components.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@
109109
"groups": []
110110
},
111111

112+
"context-menu-move-tab-to-start": {
113+
"selectorData": "menuitem[data-l10n-id='move-to-start']",
114+
"strategy": "css",
115+
"groups": []
116+
},
117+
112118
"context-menu-open-link-in-tab": {
113119
"selectorData": "context-openlinkintab",
114120
"strategy": "id",
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import logging
2+
3+
import pytest
4+
from selenium.webdriver import Firefox
5+
6+
from modules.browser_object import ContextMenu, TabBar
7+
8+
9+
@pytest.fixture()
10+
def test_case():
11+
return "134723"
12+
13+
14+
def test_change_position_of_pinned_tabs(driver: Firefox):
15+
tabs = TabBar(driver)
16+
tab_context_menu = ContextMenu(driver)
17+
18+
tab_titles = []
19+
url_list = ["about:logo", "about:robots", "https://mozilla.org"]
20+
21+
driver.get(url_list[0])
22+
tab_titles.append(driver.title)
23+
24+
# Open 3 tabs
25+
for i in range(1, len(url_list)):
26+
tabs.new_tab_by_button()
27+
driver.switch_to.window(driver.window_handles[-1])
28+
driver.get(url_list[i])
29+
tab_titles.append(driver.title)
30+
31+
# Specific tabs we want to work with
32+
robot_title = tab_titles[1]
33+
mozilla_title = tab_titles[2]
34+
35+
# Pin the 'Robots' tab by its title
36+
driver.switch_to.window(driver.window_handles[0])
37+
robot_tab = tabs.get_tab(robot_title)
38+
assert robot_tab is not None, "Robot tab should exist"
39+
tabs.context_click(robot_tab)
40+
tab_context_menu.click_and_hide_menu("context-menu-pin-tab")
41+
pinned_tab_one = tabs.get_tab(robot_title)
42+
assert pinned_tab_one is not None, "Pinned Robot tab should exist"
43+
assert tabs.is_pinned(pinned_tab_one)
44+
45+
# Pin the 'Mozilla' tab by its title
46+
mozilla_tab = tabs.get_tab(mozilla_title)
47+
assert mozilla_tab is not None, "Mozilla tab should exist"
48+
tabs.context_click(mozilla_tab)
49+
tab_context_menu.click_and_hide_menu("context-menu-pin-tab")
50+
pinned_tab_two = tabs.get_tab(mozilla_title)
51+
assert pinned_tab_two is not None, "Pinned Robot tab should exist"
52+
assert tabs.is_pinned(pinned_tab_two)
53+
54+
# Move second pinned tab to the left
55+
tabs.context_click(pinned_tab_two)
56+
tab_context_menu.click_and_hide_menu("context-menu-move-tab-to-start")
57+
# Click-and-hide won't hide the parent popup
58+
tabs.hide_popup("tabContextMenu")
59+
60+
# Get the titles for each of the rearranged pinned tabs
61+
driver.switch_to.window(driver.window_handles[0])
62+
new_pinned_tab_one_title = driver.title
63+
logging.info("Tab title: %s", new_pinned_tab_one_title)
64+
65+
driver.switch_to.window(driver.window_handles[1])
66+
new_pinned_tab_two_title = driver.title
67+
logging.info("Tab title: %s", new_pinned_tab_two_title)
68+
69+
assert "Mozilla" in new_pinned_tab_one_title, (
70+
"Mozilla should now be the first pinned tab"
71+
)
72+
assert "Gort!" in new_pinned_tab_two_title, (
73+
"Robot should now be the second pinned tab"
74+
)

tests/theme_and_toolbar/test_customize_themes_and_redirect.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
from selenium.webdriver import Firefox
3+
34
from modules.browser_object import Navigation, PanelUi
45
from modules.page_object import AboutAddons
56

@@ -11,7 +12,7 @@ def test_case():
1112

1213
THEMES: dict[str, list[str]] = {
1314
"firefox-compact-dark_mozilla_org-heading": [
14-
"rgb(43, 42, 51)", # classic darker tone
15+
"rgb(43, 42, 51)", # classic darker tone
1516
"rgb(143, 143, 148)", # focused dark
1617
"rgb(120, 119, 126)", # dark without focus
1718
],
@@ -82,7 +83,9 @@ def test_redirect_to_addons(driver: Firefox) -> None:
8283

8384

8485
@pytest.mark.parametrize("theme_name", list(THEMES.keys()))
85-
def test_activate_theme_background_matches_expected(driver: Firefox, theme_name: str) -> None:
86+
def test_activate_theme_background_matches_expected(
87+
driver: Firefox, theme_name: str
88+
) -> None:
8689
"""
8790
C118173: Ensure that activating each theme in about:addons applies the expected background color.
8891
Handles Developer Edition vs standard Firefox defaults.
@@ -100,9 +103,7 @@ def test_activate_theme_background_matches_expected(driver: Firefox, theme_name:
100103
if theme_name == "firefox-compact-light_mozilla_org-heading":
101104
pytest.skip("Compact Light is default on Firefox, skipping.")
102105

103-
current_bg = abt_addons.activate_theme(
104-
nav, theme_name, "", perform_assert=False
105-
)
106+
current_bg = abt_addons.activate_theme(nav, theme_name, "", perform_assert=False)
106107

107108
expected_list = THEMES[theme_name]
108109
assert any(colors_match(current_bg, exp) for exp in expected_list), (

tests/theme_and_toolbar/test_installed_theme_enabled.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ def test_case():
1212
return "118174"
1313

1414

15-
MAC_GHA: bool = environ.get("GITHUB_ACTIONS") == "true" and sys.platform.startswith("darwin")
15+
MAC_GHA: bool = environ.get("GITHUB_ACTIONS") == "true" and sys.platform.startswith(
16+
"darwin"
17+
)
1618

1719
AMO_HOST: str = "addons.mozilla.org"
1820
AMO_THEMES_PATH: str = "firefox/themes"
@@ -44,7 +46,9 @@ def test_installed_theme_enabled(driver: Firefox) -> None:
4446
about_addons.choose_sidebar_option("theme")
4547

4648
# Capture currently enabled theme title
47-
starting_theme = about_addons.get_element("enabled-theme-title").get_attribute("innerText")
49+
starting_theme = about_addons.get_element("enabled-theme-title").get_attribute(
50+
"innerText"
51+
)
4852

4953
# Go to AMO and install a recommended theme (POM encapsulates waits and flows)
5054
AmoThemes(driver).open().install_recommended_theme()

0 commit comments

Comments
 (0)