|
@@ -9,6 +9,7 @@ from selenium.webdriver.chrome.service import Service
|
|
|
from webdriver_manager.chrome import ChromeDriverManager
|
|
|
|
|
|
from nicegui import Client, globals
|
|
|
+from nicegui.elements import plotly, pyplot
|
|
|
from nicegui.page import page
|
|
|
|
|
|
from .screen import Screen
|
|
@@ -32,6 +33,7 @@ def capabilities(capabilities: Dict) -> Dict:
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
|
def reset_globals() -> Generator[None, None, None]:
|
|
|
+ print('!!! resetting globals !!!')
|
|
|
for path in {'/'}.union(globals.page_routes.values()):
|
|
|
globals.app.remove_route(path)
|
|
|
globals.app.middleware_stack = None
|
|
@@ -39,6 +41,9 @@ def reset_globals() -> Generator[None, None, None]:
|
|
|
# NOTE favicon routes must be removed separately because they are not "pages"
|
|
|
[globals.app.routes.remove(r) for r in globals.app.routes if r.path.endswith('/favicon.ico')]
|
|
|
importlib.reload(globals)
|
|
|
+ # repopulate globals.optional_features
|
|
|
+ importlib.reload(plotly)
|
|
|
+ importlib.reload(pyplot)
|
|
|
globals.app.storage.clear()
|
|
|
globals.index_client = Client(page('/'), shared=True).__enter__()
|
|
|
globals.app.get('/')(globals.index_client.build_response)
|
|
@@ -53,7 +58,7 @@ def remove_all_screenshots() -> None:
|
|
|
|
|
|
@pytest.fixture(scope='function')
|
|
|
def driver(chrome_options: webdriver.ChromeOptions) -> webdriver.Chrome:
|
|
|
- s = Service(ChromeDriverManager().install())
|
|
|
+ s = Service()
|
|
|
driver = webdriver.Chrome(service=s, options=chrome_options)
|
|
|
driver.implicitly_wait(Screen.IMPLICIT_WAIT)
|
|
|
driver.set_page_load_timeout(4)
|