From e5cf645b0f4bac3c96f254400f7839e4c4ef3144 Mon Sep 17 00:00:00 2001 From: Falko Schindler Date: Thu, 24 Oct 2024 18:22:44 +0200 Subject: [PATCH] add pytest --- tests/test_html.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/test_html.py diff --git a/tests/test_html.py b/tests/test_html.py new file mode 100644 index 000000000..495af9903 --- /dev/null +++ b/tests/test_html.py @@ -0,0 +1,17 @@ +from nicegui import html, ui +from nicegui.testing import Screen + + +def test_html_element(screen: Screen): + ui.html('This is strong.', tag='strong') + + screen.open('/') + assert screen.find_by_tag('strong').text == 'This is strong.' + + +def test_html_button(screen: Screen): + html.button('Click me').on('click', lambda: ui.notify('Hi!')) + + screen.open('/') + screen.click('Click me') + screen.should_contain('Hi!')