Skip to content

Commit 168c243

Browse files
authored
Merge pull request #752 from krishpdev/close-pinned-tabs-via-mouse
Add Test to Verify Pinned Tab Closes via Mouse Middle-Click
2 parents 5e9a7a5 + 960ea33 commit 168c243

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
4+
from modules.browser_object import ContextMenu, TabBar
5+
from modules.page_object import ExamplePage
6+
7+
8+
@pytest.fixture()
9+
def test_case():
10+
return "134726"
11+
12+
13+
@pytest.mark.headed
14+
def test_close_pinned_tab_via_middle_click(driver: Firefox):
15+
"""
16+
C134726 - Verify middle-clicking pinned tab will close it
17+
"""
18+
19+
example = ExamplePage(driver)
20+
example.open()
21+
tabs = TabBar(driver)
22+
tab_menu = ContextMenu(driver)
23+
24+
# Open 2 new tabs
25+
for _ in range(2):
26+
tabs.new_tab_by_button()
27+
tabs.wait_for_num_tabs(3)
28+
29+
# Pin the first tab
30+
with driver.context(driver.CONTEXT_CHROME):
31+
first_tab = tabs.get_tab(1)
32+
tabs.context_click(first_tab)
33+
tab_menu.click_and_hide_menu("context-menu-pin-tab")
34+
assert tabs.is_pinned(first_tab), "Expected the first tab to be pinned"
35+
36+
# Middle-click the pinned tab to close it
37+
tabs.middle_click(first_tab)
38+
39+
# Verify pinned tab was closed and 2 tabs remain
40+
tabs.wait_for_num_tabs(2)

0 commit comments

Comments
 (0)