Skip to content

Commit 7d86a0c

Browse files
committed
Add retry to ensure video is playing
1 parent 82d7713 commit 7d86a0c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

tests/tabs/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ def add_to_prefs_list():
2222
@pytest.fixture()
2323
def video_url():
2424
return "https://www.w3schools.com/html/mov_bbb.mp4"
25-
# return "https://www.youtube.com/watch?v=mAia0v3ojzw"

tests/tabs/test_mute_tabs.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from time import sleep
2+
13
import pytest
24
from selenium.webdriver import Firefox
35
from selenium.webdriver.support import expected_conditions as EC
@@ -8,6 +10,7 @@
810
COOKIE_CONSENT_SELECTOR = (
911
"button[aria-label^='Accept all'], button[aria-label^='Accept the use']"
1012
)
13+
RETRY_LIMIT = 10
1114

1215

1316
@pytest.fixture()
@@ -28,7 +31,11 @@ def test_mute_unmute_tab(screenshot, driver: Firefox, video_url: str):
2831
tabs.expect(EC.title_contains("mov_bbb.mp4"))
2932

3033
with driver.context(driver.CONTEXT_CHROME):
31-
tabs.expect_tab_sound_status(1, tabs.MEDIA_STATUS.PLAYING)
34+
sound_status = False
35+
retries = 0
36+
while not sound_status and retries < RETRY_LIMIT:
37+
sound_status = tabs.expect_tab_sound_status(1, tabs.MEDIA_STATUS.PLAYING)
38+
sleep(0.5)
3239
tabs.click_tab_mute_button(1)
3340
tabs.expect_tab_sound_status(1, tabs.MEDIA_STATUS.MUTED)
3441
tabs.click_tab_mute_button(1)

0 commit comments

Comments
 (0)