test_bindings.py 685 B

1234567891011121314151617181920212223242526
  1. import pytest
  2. from nicegui import ui
  3. from selenium.webdriver.common.action_chains import ActionChains
  4. from selenium.webdriver.common.by import By
  5. from .screen import Screen
  6. def test_binding_select_result(screen: Screen):
  7. class Model():
  8. location = None
  9. data = Model()
  10. options = {
  11. (51.9607, 7.6261): 'Münster',
  12. (48.3069, 14.2858): 'Linz',
  13. }
  14. data.location = list(options.keys())[0]
  15. ui.select(options).bind_value(data, 'location')
  16. screen.open('/')
  17. screen.should_not_contain('Linz')
  18. element = screen.click('Münster')
  19. screen.click_at_position(element, x=20, y=100)
  20. screen.wait(0.3)
  21. screen.should_contain('Linz')