Skip to content

Commit 27dacc0

Browse files
committed
fix animation test
1 parent a8b8af1 commit 27dacc0

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/tests/test_browser/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def driver(pytestconfig):
7171
driver = Chrome(options=chrome_options)
7272

7373
driver.set_window_size(1080, 800)
74-
driver.set_page_load_timeout(5)
75-
driver.implicitly_wait(5)
74+
driver.set_page_load_timeout(3)
75+
driver.implicitly_wait(3)
7676

7777
try:
7878
yield driver

src/tests/test_browser/test_basic.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import idom
22

3-
# The IDOM server is running in a seperate thread so asyncio
4-
# can't help us with synchronization problems here
5-
from threading import Condition
3+
from queue import Queue
64

75

86
def test_simple_hello_world(driver, display):
@@ -63,18 +61,17 @@ async def on_change(event):
6361

6462

6563
def test_animation(driver, display):
66-
count_confirmed = Condition()
64+
count_queue = Queue()
6765

6866
@idom.element
69-
async def Counter(self, count=0):
67+
async def Counter(self):
7068

71-
with count_confirmed:
72-
count_confirmed.wait()
69+
count = count_queue.get()
7370

7471
@self.animate
7572
async def increment(stop):
7673
if count < 5:
77-
self.update(count + 1)
74+
self.update()
7875
else:
7976
stop()
8077

@@ -83,8 +80,7 @@ async def increment(stop):
8380
display(Counter)
8481

8582
for i in range(6):
86-
with count_confirmed:
87-
count_confirmed.notify()
83+
count_queue.put(i)
8884
driver.find_element_by_id(f"counter-{i}")
8985

9086

0 commit comments

Comments
 (0)