test_pages.py 517 B

12345678910111213141516171819
  1. import threading
  2. from time import sleep
  3. from nicegui import globals, ui
  4. async def test_title(selenium):
  5. @ui.page('/', title='My Custom Title')
  6. def page():
  7. ui.label('hello world')
  8. # start new thread
  9. thread = threading.Thread(target=ui.run, kwargs={'port': 3392, 'show': False, 'reload': False})
  10. thread.start()
  11. sleep(2)
  12. selenium.get('http://localhost:3392')
  13. assert "My Custom Title" in selenium.title
  14. print(globals)
  15. globals.server.should_exit = True
  16. thread.join()