|
@@ -4,6 +4,8 @@ from typing import Callable, Generator
|
|
|
|
|
|
import icecream
|
|
|
import pytest
|
|
|
+from justpy.htmlcomponents import JustpyBaseComponent, WebPage
|
|
|
+from nicegui import globals
|
|
|
from selenium import webdriver
|
|
|
|
|
|
from .user import User
|
|
@@ -27,6 +29,26 @@ def selenium(selenium: webdriver.Chrome) -> webdriver.Chrome:
|
|
|
return selenium
|
|
|
|
|
|
|
|
|
+@pytest.fixture(autouse=True)
|
|
|
+def reset_globals() -> Generator[None, None, None]:
|
|
|
+ WebPage.instances = {}
|
|
|
+ WebPage.sockets = {}
|
|
|
+ WebPage.next_page_id = 0
|
|
|
+ JustpyBaseComponent.next_id = 0
|
|
|
+ JustpyBaseComponent.instances = {}
|
|
|
+ globals.config = None
|
|
|
+ globals.server = None
|
|
|
+ globals.page_builders = {}
|
|
|
+ globals.view_stack = []
|
|
|
+ globals.tasks = []
|
|
|
+ globals.connect_handlers = []
|
|
|
+ globals.disconnect_handlers = []
|
|
|
+ globals.startup_handlers = []
|
|
|
+ globals.shutdown_handlers = []
|
|
|
+ globals.has_auto_index_page = False
|
|
|
+ globals.dependencies = {}
|
|
|
+
|
|
|
+
|
|
|
@pytest.fixture()
|
|
|
def user(selenium: webdriver.Chrome) -> Generator[User, None, None]:
|
|
|
user = User(selenium)
|