Skip to content

Commit 880635c

Browse files
committed
Test stabilization - multiple tabs navigation
1 parent 88e4da7 commit 880635c

File tree

1 file changed

+33
-19
lines changed

1 file changed

+33
-19
lines changed
Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import logging
2-
import sys
3-
from os import environ
42

53
import pytest
64
from selenium.webdriver import Firefox
@@ -13,37 +11,53 @@ def test_case():
1311
return "134647"
1412

1513

16-
WIN_GHA = environ.get("GITHUB_ACTIONS") == "true" and sys.platform.startswith("win")
17-
18-
19-
@pytest.mark.skipif(WIN_GHA, reason="Test unstable in Windows Github Actions")
2014
def test_navigation_multiple_tabs(driver: Firefox):
21-
"""C134647 - Verify that Multiple Tabs can be closed via the context menu"""
22-
# open 20 tabs
15+
"""C134647 - Verify that multiple tabs can be navigated via the scroll buttons"""
16+
2317
tabs = TabBar(driver)
2418
num_tabs = 20
2519

20+
# Open multiple tabs
2621
for _ in range(num_tabs):
2722
tabs.new_tab_by_button()
2823

29-
# after opening 20 tabs, should be at the right most tab
3024
with driver.context(driver.CONTEXT_CHROME):
31-
# get the last tab, verify that upon double clicking the left scroll position decreased
25+
# Get the last tab's initial position (x-axis)
3226
last_tab = tabs.get_tab(21)
3327
original_location_pre_left = last_tab.location["x"]
28+
29+
# Scroll left via double click
3430
tabs.double_click("tab-scrollbox-left-button", labels=[])
35-
new_location_post_left = last_tab.location["x"]
3631

37-
logging.info(f"The original position: {original_location_pre_left}")
38-
logging.info(f"The new position: {new_location_post_left}")
39-
assert new_location_post_left < original_location_pre_left
32+
# Wait for left scroll to change position (x should increase)
33+
def tab_scrolled_left(d):
34+
current_pos = tabs.get_tab(21).location["x"]
35+
return current_pos > original_location_pre_left
36+
37+
tabs.custom_wait(timeout=2).until(tab_scrolled_left)
4038

41-
# get the first tab, verify that upon clicking the right scroll position increased
39+
# Log and assert the position after left scroll
40+
new_location_post_left = tabs.get_tab(21).location["x"]
41+
logging.info(f"Left scroll - original x: {original_location_pre_left}")
42+
logging.info(f"Left scroll - new x: {new_location_post_left}")
43+
assert new_location_post_left > original_location_pre_left
44+
45+
# Get the first tab's initial position (x-axis)
4246
first_tab = tabs.get_tab(1)
4347
original_location_pre_right = first_tab.location["x"]
48+
49+
# Scroll right via double click
4450
tabs.double_click("tab-scrollbox-right-button", labels=[])
45-
new_location_post_right = first_tab.location["x"]
4651

47-
logging.info(f"The original position: {original_location_pre_right}")
48-
logging.info(f"The new position: {new_location_post_right}")
49-
assert new_location_post_right > original_location_pre_right
52+
# Wait for right scroll to change position (x should decrease)
53+
def tab_scrolled_right(d):
54+
current_pos = tabs.get_tab(1).location["x"]
55+
return current_pos < original_location_pre_right
56+
57+
tabs.custom_wait(timeout=2).until(tab_scrolled_right)
58+
59+
# Log and assert the position after right scroll
60+
new_location_post_right = tabs.get_tab(1).location["x"]
61+
logging.info(f"Right scroll - original x: {original_location_pre_right}")
62+
logging.info(f"Right scroll - new x: {new_location_post_right}")
63+
assert new_location_post_right < original_location_pre_right

0 commit comments

Comments
 (0)