Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration testing: Firefox compatibility #3162

Merged
merged 3 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions integration/test_client_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Generator

import pytest
from selenium.webdriver import Firefox
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webdriver import WebDriver

Expand Down Expand Up @@ -374,9 +375,12 @@ def set_sub_sub(var: str, value: str):
"value": "c3%20value",
}
time.sleep(2) # wait for c3 to expire
assert "state.client_side_state.client_side_sub_state.c3" not in cookie_info_map(
driver
)
if not isinstance(driver, Firefox):
# 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.pop("chakra-ui-color-mode", None)
Expand Down
9 changes: 3 additions & 6 deletions integration/test_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def index():
value=State.text,
id="plain_value_input",
disabled=True,
_disabled={"background_color": "#EEE"},
_disabled={"width": "42px"},
),
rx.input(default_value="default", id="default_input"),
rx.el.input(
Expand Down Expand Up @@ -124,13 +124,10 @@ async def get_state_text():
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(plain_value_input) == "initial"
assert (
plain_value_input.value_of_css_property("background-color")
== "rgba(238, 238, 238, 1)"
)
assert plain_value_input.value_of_css_property("width") == "42px"

# 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")
assert AppHarness._poll_for(
lambda: fully_controlled_input.poll_for_value(value_input) == "ifoonitial"
Expand Down
6 changes: 3 additions & 3 deletions integration/test_tailwind.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

PARAGRAPH_TEXT = "Tailwind Is Cool"
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(
Expand Down Expand Up @@ -104,7 +104,7 @@ def test_tailwind_app(tailwind_app: AppHarness, tailwind_disabled: bool):
assert p.value_of_css_property("font-family") == "monospace"
if tailwind_disabled:
# 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:
# 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
2 changes: 1 addition & 1 deletion reflex/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def frontend(self, driver_clz: Optional[Type["WebDriver"]] = None) -> "WebDriver
if driver_clz is None:
requested_driver = os.environ.get("APP_HARNESS_DRIVER", "Chrome")
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:
options = webdriver.ChromeOptions()
options.add_argument("--headless=new")
Expand Down
Loading