Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 3115f21

Browse files
Replace sleep with selenium wait api
1 parent 8e2462f commit 3115f21

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/test_integration.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
from selenium import webdriver
1616
from selenium.webdriver.common.keys import Keys
1717
from selenium.common.exceptions import InvalidElementStateException
18+
from selenium.webdriver.common.by import By
19+
from selenium.webdriver.support.ui import WebDriverWait
20+
from selenium.webdriver.support import expected_conditions as EC
1821

1922
from textwrap import dedent
2023
try:
@@ -518,15 +521,18 @@ def render_content(tab):
518521
tab_one = self.wait_for_element_by_css_selector('#tab-1')
519522
tab_two = self.wait_for_element_by_css_selector('#tab-2')
520523

524+
WebDriverWait(self.driver, 10).until(
525+
EC.element_to_be_clickable((By.ID, "tab-1")),
526+
EC.element_to_be_clickable((By.ID, "tab-2"))
527+
)
528+
521529
self.snapshot("Tabs with Graph - initial (graph should not resize)")
522530

523531
tab_two.click()
524-
time.sleep(1)
525532

526533
self.snapshot("Tabs with Graph - clicked tab 2 (graph should not resize)")
527534

528535
tab_one.click()
529-
time.sleep(1)
530536

531537
self.snapshot("Tabs with Graph - clicked tab 1 (graph should not resize)")
532538

0 commit comments

Comments
 (0)