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

Fix error where default_css was missing #201

Merged
merged 5 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name="streamlit_folium",
version="0.21.0",
version="0.21.1",
author="Randy Zwitch",
author_email="[email protected]",
description="Render Folium objects in Streamlit",
Expand Down
4 changes: 2 additions & 2 deletions streamlit_folium/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ def walk(fig):
0, "https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"
)
js_links.insert(0, "https://d3js.org/d3.v4.min.js")
css_links.extend([href for _, href in elem.default_css])
js_links.extend([src for _, src in elem.default_js])
css_links.extend([href for _, href in getattr(elem, "default_css", [])])
js_links.extend([src for _, src in getattr(elem, "default_js", [])])

component_value = _component_func(
script=leaflet,
Expand Down
24 changes: 15 additions & 9 deletions tests/test_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@
# Click marker
try:
page.frame_locator('iframe[title="streamlit_folium\\.st_folium"]').get_by_role(
"button", name="Marker"
"img"
).click()
except Exception as e:
page.screenshot(path="screenshot-test-marker-click.png", full_page=True)
raise e

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.12)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.12)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.12)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.12)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.9)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.9)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.9)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.9)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.11)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.11)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.11)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.11)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.10)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.10)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.10)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.10)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.8)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.8)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.8)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

Check failure on line 77 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.8)

test_marker_click[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").get_by_role("img")

expect(page.get_by_text('"last_object_clicked":NULL')).to_be_hidden()

Expand Down Expand Up @@ -119,15 +119,15 @@
expect(page.get_by_text('{"last_object_clicked":NULL}')).to_be_visible()

# Click marker
page.frame_locator(

Check failure on line 122 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.9)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 122 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.9)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 122 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.9)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 122 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.9)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 122 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.8)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 122 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.8)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 122 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.8)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 122 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.8)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)
'internal:attr=[title="streamlit_folium.st_folium"i]'
).get_by_role("button").nth(2).click()
).get_by_role("img").nth(2).click()

Check failure on line 124 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.12)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 124 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.12)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 124 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.12)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 124 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.12)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 124 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.11)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 124 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.11)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 124 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.11)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 124 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.11)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 124 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.10)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 124 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.10)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 124 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.10)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

Check failure on line 124 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.10)

test_limit_data[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for get_by_title("streamlit_folium.st_folium").locator("internal:control=enter-frame").get_by_role("img").nth(2)

# Have to click a second time for some reason, maybe because it doesn't load right
# away
page.frame_locator(
'internal:attr=[title="streamlit_folium.st_folium"i]'
).get_by_role("button").nth(2).click()
).get_by_role("img").nth(2).click()

expect(page.get_by_text('{"last_object_clicked":{"lat":39.96')).to_be_visible()

Expand All @@ -146,13 +146,13 @@
try:
page.frame_locator('iframe[title="streamlit_folium\\.st_folium"]').locator(
"#map_div"
).get_by_role("button", name="Marker").click()
).get_by_role("img").click()
page.frame_locator('iframe[title="streamlit_folium\\.st_folium"]').locator(
"#map_div2"
).get_by_role("button", name="Marker").click()
).get_by_role("img").click()
except Exception as e:
page.screenshot(path="screenshot-dual-map.png", full_page=True)
raise e

Check failure on line 155 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.12)

test_dual_map[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").locator("#map_div").get_by_role("img")

Check failure on line 155 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.12)

test_dual_map[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").locator("#map_div").get_by_role("img")

Check failure on line 155 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.9)

test_dual_map[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").locator("#map_div").get_by_role("img")

Check failure on line 155 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.9)

test_dual_map[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").locator("#map_div").get_by_role("img")

Check failure on line 155 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.11)

test_dual_map[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").locator("#map_div").get_by_role("img")

Check failure on line 155 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.11)

test_dual_map[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").locator("#map_div").get_by_role("img")

Check failure on line 155 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.10)

test_dual_map[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").locator("#map_div").get_by_role("img")

Check failure on line 155 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.10)

test_dual_map[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").locator("#map_div").get_by_role("img")

Check failure on line 155 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.8)

test_dual_map[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").locator("#map_div").get_by_role("img")

Check failure on line 155 in tests/test_frontend.py

View workflow job for this annotation

GitHub Actions / build (3.8)

test_dual_map[chromium] playwright._impl._errors.TimeoutError: Locator.click: Timeout 30000ms exceeded. Call log: waiting for frame_locator("iframe[title=\"streamlit_folium\\.st_folium\"]").locator("#map_div").get_by_role("img")


def test_vector_grid(page: Page):
Expand All @@ -172,7 +172,7 @@
# Click marker on map
page.frame_locator(
'internal:attr=[title="streamlit_folium.st_folium"i]'
).get_by_role("button").nth(0).click()
).get_by_role("img").nth(0).click()

expect(
page.get_by_text('"last_object_clicked_tooltip":"Liberty Bell"')
Expand All @@ -187,8 +187,8 @@
expect(page.get_by_text("Tooltip: None")).to_be_visible()

page.frame_locator('iframe[title="streamlit_folium\\.st_folium"]').get_by_role(
"button"
).nth(0).click()
"img"
).first.click()

try:
expect(page.get_by_text("Popup: Popup!")).to_be_visible()
Expand All @@ -208,7 +208,7 @@
page.get_by_text("Return on hover?").click()

page.frame_locator('iframe[title="streamlit_folium\\.st_folium"]').get_by_role(
"button"
"img"
).nth(1).hover()

try:
Expand Down Expand Up @@ -273,6 +273,12 @@
).check()


def test_geojson_popup(page: Page):
page.get_by_role("link", name="geojson popup").click()

expect(page.get_by_text("AttributeError")).to_be_hidden()


def test_dynamic_feature_group_update(page: Page):
page.get_by_role("link", name="dynamic updates").click()
page.get_by_text("Show generated code").click()
Expand Down
Loading