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

test_geojson test does not pass on v0.13.0 tag because of the usage of removed Selenium method #1625

Closed
rominf opened this issue Oct 8, 2022 · 2 comments · Fixed by #1626

Comments

@rominf
Copy link

rominf commented Oct 8, 2022

Describe the bug
Some tests do not pass on v0.13.0 tag because of the usage of removed Selenium method (see: SeleniumHQ/selenium#10712).

To Reproduce
Follow https://github.com/python-visualization/folium/blob/main/.github/CONTRIBUTING.md to run Selenium tests.

===================================================================== test session starts =====================================================================
platform linux -- Python 3.10.6, pytest-7.1.3, pluggy-1.0.0
rootdir: /home/rominf/aiven/folium, configfile: setup.cfg
plugins: cov-4.0.0, flake8-1.1.1, forked-1.4.0, xdist-2.5.0, nbval-0.9.6
collected 48 items                                                                                                                                            

tests/selenium/test_geojson_selenium.py F                                                                                                               [  2%]
tests/selenium/test_heat_map_selenium.py .                                                                                                              [  4%]
tests/selenium/test_selenium.py .....................................x........                                                                          [100%]

========================================================================== FAILURES ===========================================================================
________________________________________________________________________ test_geojson _________________________________________________________________________

driver = <conftest.DriverFolium (session="41ea21802f821f8d917ea008756c38df")>

    def test_geojson(driver):
        """Verify that loading data in GeoJson works well for different use cases.
    
        Prevent two regressions:
        - https://github.com/python-visualization/folium/pull/1190
        - https://github.com/python-visualization/folium/pull/1289
    
        """
        data_url = 'https://cdn.jsdelivr.net/gh/python-visualization/folium@main/examples/data/search_bars_rome.json'
    
        m = folium.Map((41.9, 12.5), zoom_start=10, tiles='cartodbpositron')
        marker_cluster = folium.plugins.MarkerCluster(name='cluster').add_to(m)
        folium.GeoJson(data_url, embed=False).add_to(marker_cluster)
        folium.GeoJson(data_url, embed=False, show=False, name='geojson').add_to(m)
        folium.LayerControl(collapsed=False).add_to(m)
    
        html = m.get_root().render()
        with temp_html_filepath(html) as filepath:
            driver.get_file(filepath)
            assert driver.wait_until('.folium-map')
            driver.verify_js_logs()
        # Verify the marker cluster is shown, it's a yellow icon with '18' in it.
        icon = driver.wait_until('.leaflet-marker-icon.marker-cluster > div > span')
        assert icon.text == '18'
        # Verify the second GeoJson layer is not shown, because we used show=False.
        control_label = driver.wait_until(
            '.leaflet-control-layers-overlays > label:nth-of-type(2)'
        )
        assert control_label.text == 'geojson'
>       control_input = control_label.find_element_by_css_selector('input')
E       AttributeError: 'WebElement' object has no attribute 'find_element_by_css_selector'

tests/selenium/test_geojson_selenium.py:35: AttributeError

Expected behavior
All tests pass.

Environment (please complete the following information):

  • Browser: chromedriver
  • Tests
  • Python version: 3.10.6 from conda
  • folium version: 0.13.0
  • branca version: 0.5.0

Additional context
No context.

Possible solutions
Update test code to use actual Selenium methods.

folium is maintained by volunteers. Can you help making a fix for this issue?
No: I believe the fix is quite simple for a knowledgeable person, but it will take some time for me to dig into details.

@amrutharajashekar
Copy link
Contributor

Hi @rominf , can i work on this issue ? I would like to contribute .

@amrutharajashekar
Copy link
Contributor

Hi @rominf, I have submitted PR . ( #1626 )
Please let me know if any other changes are required.
Thanks!

ocefpaf added a commit that referenced this issue Oct 10, 2022
test_geojson test does not pass on v0.13.0 tag because of the usage of removed Selenium method #1625
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants