Parcourir la source

test if keyboard is in DOM after page reload

Falko Schindler il y a 2 ans
Parent
commit
1773f878bd
1 fichiers modifiés avec 6 ajouts et 1 suppressions
  1. 6 1
      tests/test_dependencies.py

+ 6 - 1
tests/test_dependencies.py

@@ -1,4 +1,6 @@
+import pytest
 from nicegui import ui
+from selenium.common.exceptions import NoSuchElementException
 
 from .user import User
 
@@ -24,6 +26,9 @@ def test_keyboard_after_startup(user: User):
 
     user.open('/')
     assert not any(s.endswith('keyboard.js') for s in user.get_attributes('script', 'src'))
+    with pytest.raises(NoSuchElementException):
+        user.selenium.find_element_by_tag_name('span')
     user.click('activate keyboard')
     assert any(s.endswith('keyboard.js') for s in user.get_attributes('script', 'src'))
-    assert user.selenium.find_element_by_tag_name('span')
+    user.sleep(1)
+    assert user.selenium.find_element_by_tag_name('span')  # FIXME: ptw fails (which is correct) while pytest does not