diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c5ab1f3ca..5916e150e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,9 +32,7 @@ jobs: - name: test startup run: ./test_startup.sh - name: setup chromedriver - uses: nanasess/setup-chromedriver@v2.0.0 - with: - chromedriver-version: "114.0.5735.90" + uses: nanasess/setup-chromedriver@v2.1.1 - name: pytest run: pytest - name: upload screenshots diff --git a/.vscode/settings.json b/.vscode/settings.json index 242424461..fcb86744f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,6 @@ { "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, - "editor.minimap.enabled": false, "isort.args": ["--line-length", "120"], "prettier.printWidth": 120, "python.formatting.provider": "autopep8", diff --git a/main.py b/main.py index 18a93fe97..bd659362c 100755 --- a/main.py +++ b/main.py @@ -1,13 +1,6 @@ #!/usr/bin/env python3 import importlib import inspect - -if True: - # increasing max decode packets to be able to transfer images - # see https://github.com/miguelgrinberg/python-engineio/issues/142 - from engineio.payload import Payload - Payload.max_decode_packets = 500 - import os from pathlib import Path from typing import Awaitable, Callable, Optional diff --git a/nicegui/elements/query.js b/nicegui/elements/query.js index 5f0686b4f..84943cfca 100644 --- a/nicegui/elements/query.js +++ b/nicegui/elements/query.js @@ -13,7 +13,7 @@ export default { }, add_style(style) { Object.entries(style).forEach(([key, val]) => - document.querySelectorAll(this.selector).forEach((e) => (e.style[key] = val)) + document.querySelectorAll(this.selector).forEach((e) => e.style.setProperty(key, val)) ); }, remove_style(keys) { diff --git a/tests/conftest.py b/tests/conftest.py index 5398063c9..d4910f308 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,9 +6,9 @@ import pytest from selenium import webdriver 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 +32,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 +40,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 +57,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) diff --git a/tests/test_query.py b/tests/test_query.py index 27824e198..163bffdc8 100644 --- a/tests/test_query.py +++ b/tests/test_query.py @@ -52,3 +52,11 @@ def test_query_multiple_divs(screen: Screen): screen.wait(0.5) assert screen.find('A').value_of_css_property('border') == '1px solid rgb(0, 0, 0)' assert screen.find('B').value_of_css_property('border') == '1px solid rgb(0, 0, 0)' + + +def test_query_with_css_variables(screen: Screen): + ui.add_body_html('