Skip to content

Commit 143fafa

Browse files
committed
Add test to verify middle-mouse click closes tab
1 parent b118750 commit 143fafa

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
4+
from modules.browser_object_tabbar import TabBar
5+
from modules.page_object import ExamplePage
6+
7+
8+
@pytest.fixture()
9+
def test_case():
10+
return "134645"
11+
12+
13+
@pytest.mark.headed
14+
def test_close_tab_through_middle_mouse_click(driver: Firefox):
15+
"""
16+
C134645 - Verify that middle clicking a tab will close it
17+
"""
18+
19+
example = ExamplePage(driver)
20+
tabs = TabBar(driver)
21+
example.open()
22+
23+
# Open 2 additional tabs for a total of 3
24+
for _ in range(2):
25+
tabs.new_tab_by_button()
26+
tabs.wait_for_num_tabs(3)
27+
28+
# Ensure each tab exists and middle-click to close it
29+
for i in range(3, 1, -1):
30+
with driver.context(driver.CONTEXT_CHROME):
31+
tab_to_close = tabs.get_tab(i)
32+
assert tab_to_close is not None, f"Expected tab index {i} to exist"
33+
tabs.middle_click(tab_to_close)
34+
tabs.wait_for_num_tabs(i - 1)

0 commit comments

Comments
 (0)