6.flask_coroutine.py 894 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import subprocess
  2. import time
  3. from selenium.webdriver import Chrome
  4. import pywebio
  5. import template
  6. import util
  7. from pywebio.input import *
  8. from pywebio.output import *
  9. from pywebio.platform.flask import start_server
  10. from pywebio.utils import to_coroutine
  11. async def target():
  12. set_auto_scroll_bottom(True)
  13. template.basic_output()
  14. await template.coro_background_output()
  15. await to_coroutine(template.basic_input())
  16. await actions(buttons=['Continue'])
  17. await template.flask_coro_background_input()
  18. def test(server_proc: subprocess.Popen, browser: Chrome):
  19. # template.test_output(browser, percy_prefix='[flask coro]')
  20. time.sleep(1)
  21. template.test_input(browser, percy_prefix='[flask coro]')
  22. def start_test_server():
  23. pywebio.enable_debug()
  24. start_server(target, port=8080)
  25. if __name__ == '__main__':
  26. util.run_test(start_test_server, test)