ソースを参照

test if keyboard is in DOM after page reload

Falko Schindler 2 年 前
コミット
1773f878bd
1 ファイル変更6 行追加1 行削除
  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