Skip to content

Commit 82b6e81

Browse files
Hani YacoubHani Yacoub
authored andcommitted
Stabilize Test allow audio video functionality
1 parent c1627ec commit 82b6e81

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tests/audio_video/test_allow_audio_video_functionality.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
22
from os import environ
3+
from time import sleep
34

45
import pytest
56
from selenium.webdriver import Firefox
@@ -51,5 +52,13 @@ def test_allow_audio_video_functionality(driver: Firefox):
5152

5253
# Open test website and check the site is loaded and the featured video starts playing with sound
5354
GenericPage(driver, url=TEST_URL).open()
54-
with driver.context(driver.CONTEXT_CHROME):
55-
tabs.expect_tab_sound_status(1, tabs.MEDIA_STATUS.PLAYING)
55+
max_retries = 3
56+
for attempt in range(max_retries):
57+
try:
58+
with driver.context(driver.CONTEXT_CHROME):
59+
tabs.expect_tab_sound_status(1, tabs.MEDIA_STATUS.PLAYING)
60+
break # Success!
61+
except AssertionError:
62+
sleep(2)
63+
else:
64+
pytest.fail(f"Tab sound status did not reach PLAYING after {max_retries} retries.")

0 commit comments

Comments
 (0)