Răsfoiți Sursa

pytest: try to fix timing on gh action

Rodja Trappe 2 ani în urmă
părinte
comite
97ba240b58
1 a modificat fișierele cu 9 adăugiri și 2 ștergeri
  1. 9 2
      tests/test_3d_scene.py

+ 9 - 2
tests/test_3d_scene.py

@@ -1,4 +1,5 @@
 from nicegui import ui
+from selenium.common.exceptions import JavascriptException
 
 from .screen import Screen
 
@@ -9,8 +10,14 @@ def test_moving_sphere_with_timer(screen: Screen):
         ui.timer(0.03, lambda: sphere.move(sphere.x, sphere.y + 0.05, sphere.z))
 
     screen.open('/')
-    screen.wait(0.1)
-    def position(): return screen.selenium.execute_script('return scene.children[4].position.y')
+
+    def position():
+        for i in range(5):
+            try:
+                return screen.selenium.execute_script('return scene.children[4].position.y')
+            except JavascriptException:
+                screen.wait(0.1)
+
     pos = position()
     screen.wait(0.1)
     assert position() > pos