Integration testing: Firefox compatibility (#3162)
* Integration testing: Firefox compatibility * test_client_side_storage: ruff format
This commit is contained in:
parent
92cdc15896
commit
74eaab5e19
@ -5,6 +5,7 @@ import time
|
|||||||
from typing import Generator
|
from typing import Generator
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from selenium.webdriver import Firefox
|
||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
from selenium.webdriver.remote.webdriver import WebDriver
|
from selenium.webdriver.remote.webdriver import WebDriver
|
||||||
|
|
||||||
@ -374,9 +375,12 @@ async def test_client_side_state(
|
|||||||
"value": "c3%20value",
|
"value": "c3%20value",
|
||||||
}
|
}
|
||||||
time.sleep(2) # wait for c3 to expire
|
time.sleep(2) # wait for c3 to expire
|
||||||
assert "state.client_side_state.client_side_sub_state.c3" not in cookie_info_map(
|
if not isinstance(driver, Firefox):
|
||||||
driver
|
# Note: Firefox does not remove expired cookies Bug 576347
|
||||||
)
|
assert (
|
||||||
|
"state.client_side_state.client_side_sub_state.c3"
|
||||||
|
not in cookie_info_map(driver)
|
||||||
|
)
|
||||||
|
|
||||||
local_storage_items = local_storage.items()
|
local_storage_items = local_storage.items()
|
||||||
local_storage_items.pop("chakra-ui-color-mode", None)
|
local_storage_items.pop("chakra-ui-color-mode", None)
|
||||||
|
@ -34,7 +34,7 @@ def FullyControlledInput():
|
|||||||
value=State.text,
|
value=State.text,
|
||||||
id="plain_value_input",
|
id="plain_value_input",
|
||||||
disabled=True,
|
disabled=True,
|
||||||
_disabled={"background_color": "#EEE"},
|
_disabled={"width": "42px"},
|
||||||
),
|
),
|
||||||
rx.input(default_value="default", id="default_input"),
|
rx.input(default_value="default", id="default_input"),
|
||||||
rx.el.input(
|
rx.el.input(
|
||||||
@ -124,13 +124,10 @@ async def test_fully_controlled_input(fully_controlled_input: AppHarness):
|
|||||||
assert fully_controlled_input.poll_for_value(debounce_input) == "initial"
|
assert fully_controlled_input.poll_for_value(debounce_input) == "initial"
|
||||||
assert fully_controlled_input.poll_for_value(value_input) == "initial"
|
assert fully_controlled_input.poll_for_value(value_input) == "initial"
|
||||||
assert fully_controlled_input.poll_for_value(plain_value_input) == "initial"
|
assert fully_controlled_input.poll_for_value(plain_value_input) == "initial"
|
||||||
assert (
|
assert plain_value_input.value_of_css_property("width") == "42px"
|
||||||
plain_value_input.value_of_css_property("background-color")
|
|
||||||
== "rgba(238, 238, 238, 1)"
|
|
||||||
)
|
|
||||||
|
|
||||||
# move cursor to home, then to the right and type characters
|
# move cursor to home, then to the right and type characters
|
||||||
debounce_input.send_keys(Keys.HOME, Keys.ARROW_RIGHT)
|
debounce_input.send_keys(*([Keys.ARROW_LEFT] * len("initial")), Keys.ARROW_RIGHT)
|
||||||
debounce_input.send_keys("foo")
|
debounce_input.send_keys("foo")
|
||||||
assert AppHarness._poll_for(
|
assert AppHarness._poll_for(
|
||||||
lambda: fully_controlled_input.poll_for_value(value_input) == "ifoonitial"
|
lambda: fully_controlled_input.poll_for_value(value_input) == "ifoonitial"
|
||||||
|
@ -10,7 +10,7 @@ from reflex.testing import AppHarness
|
|||||||
|
|
||||||
PARAGRAPH_TEXT = "Tailwind Is Cool"
|
PARAGRAPH_TEXT = "Tailwind Is Cool"
|
||||||
PARAGRAPH_CLASS_NAME = "text-red-500"
|
PARAGRAPH_CLASS_NAME = "text-red-500"
|
||||||
TEXT_RED_500_COLOR = "rgba(239, 68, 68, 1)"
|
TEXT_RED_500_COLOR = ["rgba(239, 68, 68, 1)", "rgb(239, 68, 68)"]
|
||||||
|
|
||||||
|
|
||||||
def TailwindApp(
|
def TailwindApp(
|
||||||
@ -104,7 +104,7 @@ def test_tailwind_app(tailwind_app: AppHarness, tailwind_disabled: bool):
|
|||||||
assert p.value_of_css_property("font-family") == "monospace"
|
assert p.value_of_css_property("font-family") == "monospace"
|
||||||
if tailwind_disabled:
|
if tailwind_disabled:
|
||||||
# expect default color, not "text-red-500" from tailwind utility class
|
# expect default color, not "text-red-500" from tailwind utility class
|
||||||
assert p.value_of_css_property("color") != TEXT_RED_500_COLOR
|
assert p.value_of_css_property("color") not in TEXT_RED_500_COLOR
|
||||||
else:
|
else:
|
||||||
# expect "text-red-500" from tailwind utility class
|
# expect "text-red-500" from tailwind utility class
|
||||||
assert p.value_of_css_property("color") == TEXT_RED_500_COLOR
|
assert p.value_of_css_property("color") in TEXT_RED_500_COLOR
|
||||||
|
@ -538,7 +538,7 @@ class AppHarness:
|
|||||||
if driver_clz is None:
|
if driver_clz is None:
|
||||||
requested_driver = os.environ.get("APP_HARNESS_DRIVER", "Chrome")
|
requested_driver = os.environ.get("APP_HARNESS_DRIVER", "Chrome")
|
||||||
driver_clz = getattr(webdriver, requested_driver)
|
driver_clz = getattr(webdriver, requested_driver)
|
||||||
options = webdriver.ChromeOptions()
|
options = getattr(webdriver, f"{requested_driver}Options")()
|
||||||
if driver_clz is webdriver.Chrome and want_headless:
|
if driver_clz is webdriver.Chrome and want_headless:
|
||||||
options = webdriver.ChromeOptions()
|
options = webdriver.ChromeOptions()
|
||||||
options.add_argument("--headless=new")
|
options.add_argument("--headless=new")
|
||||||
|
Loading…
Reference in New Issue
Block a user