1
1
import logging
2
- import sys
3
- from os import environ
4
2
5
3
import pytest
6
4
from selenium .webdriver import Firefox
@@ -13,37 +11,53 @@ def test_case():
13
11
return "134647"
14
12
15
13
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" )
20
14
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
+
23
17
tabs = TabBar (driver )
24
18
num_tabs = 20
25
19
20
+ # Open multiple tabs
26
21
for _ in range (num_tabs ):
27
22
tabs .new_tab_by_button ()
28
23
29
- # after opening 20 tabs, should be at the right most tab
30
24
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)
32
26
last_tab = tabs .get_tab (21 )
33
27
original_location_pre_left = last_tab .location ["x" ]
28
+
29
+ # Scroll left via double click
34
30
tabs .double_click ("tab-scrollbox-left-button" , labels = [])
35
- new_location_post_left = last_tab .location ["x" ]
36
31
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 )
40
38
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)
42
46
first_tab = tabs .get_tab (1 )
43
47
original_location_pre_right = first_tab .location ["x" ]
48
+
49
+ # Scroll right via double click
44
50
tabs .double_click ("tab-scrollbox-right-button" , labels = [])
45
- new_location_post_right = first_tab .location ["x" ]
46
51
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