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 Selenium heatmap test by using fixed figure size #2010

Merged
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
11 changes: 10 additions & 1 deletion tests/selenium/test_heat_map_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ def test_heat_map_with_weights(driver):
This test will fail in non-headless mode because window size will be different.

"""
m = folium.Map((0.5, 0.5), zoom_start=8, tiles=None)
figure_width, figure_height = 800, 600
m = folium.Map(
(0.5, 0.5),
zoom_start=8,
tiles=None,
width=figure_width,
height=figure_height,
)
HeatMap(
# make four dots with different weights: 1, 1, 1.5 and 2.
data=[
Expand All @@ -40,6 +47,8 @@ def test_heat_map_with_weights(driver):
)
screenshot_bytes = base64.b64decode(canvas_base64)
screenshot = Image.open(io.BytesIO(screenshot_bytes))
# window size is not reliable, so crop to a smaller fixed size
screenshot = screenshot.crop((0, 0, figure_width, figure_height))
path = os.path.dirname(__file__)
with open(os.path.join(path, "test_heat_map_selenium_screenshot.png"), "rb") as f:
screenshot_expected = Image.open(f)
Expand Down
Binary file modified tests/selenium/test_heat_map_selenium_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading