Browse Source

adding test for scene object duplications
it's currently failing because the bug is not jet fixed

Rodja Trappe 2 năm trước cách đây
mục cha
commit
25d984fc2d
1 tập tin đã thay đổi với 14 bổ sung0 xóa
  1. 14 0
      tests/test_scene.py

+ 14 - 0
tests/test_scene.py

@@ -1,3 +1,4 @@
+from selenium import webdriver
 from selenium.common.exceptions import JavascriptException
 
 from nicegui import ui
@@ -25,3 +26,16 @@ def test_moving_sphere_with_timer(screen: Screen):
 
     screen.wait(0.2)
     assert position() > 0
+
+
+def test_no_object_duplication_on_index_client(screen: Screen, selenium: webdriver.Chrome):
+    with ui.scene() as scene:
+        scene.sphere()
+
+    screen.open('/')
+    screen.switch_to(1)
+    screen.open('/')
+    screen.switch_to(0)
+
+    screen.wait(0.2)
+    assert screen.selenium.execute_script('return scene_3.children.length') == 5