浏览代码

trying to remove test flakyness

Rodja Trappe 2 年之前
父节点
当前提交
839b49eea7
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      tests/test_auto_context.py

+ 3 - 3
tests/test_auto_context.py

@@ -2,7 +2,7 @@ import asyncio
 
 
 from selenium.webdriver.common.by import By
 from selenium.webdriver.common.by import By
 
 
-from nicegui import Client, background_tasks, ui
+from nicegui import Client, app, background_tasks, ui
 
 
 from .screen import Screen
 from .screen import Screen
 
 
@@ -97,10 +97,10 @@ def test_autoupdate_on_async_timer_callback(screen: Screen):
     ui.label('0')
     ui.label('0')
     ui.timer(2.0, update, once=True)
     ui.timer(2.0, update, once=True)
 
 
-    ui.timer(0, lambda: ui.label('connection established'), once=True)  # HACK: allow waiting for client connection
+    app.on_startup(lambda: ui.label('connection established'))  # HACK: allow waiting for client connection
 
 
     screen.open('/')
     screen.open('/')
-    with screen.implicitly_wait(10.0):
+    with screen.implicitly_wait(20.0):
         screen.wait_for('connection established')
         screen.wait_for('connection established')
     screen.should_contain('0')
     screen.should_contain('0')
     screen.should_not_contain('1')
     screen.should_not_contain('1')