tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_1928605_votermaps_org.py (879B)


      1 import pytest
      2 
      3 URL = "https://votermaps.org/"
      4 
      5 FIRST_SVG_TEXT = ".map-box svg a path+text"
      6 
      7 
      8 async def svg_text_is_buggy(client):
      9    await client.navigate(URL, wait="none")
     10    text = client.await_css(FIRST_SVG_TEXT, is_displayed=True)
     11 
     12    def get_width():
     13        return client.execute_script(
     14            "return arguments[0].getBoundingClientRect().width", text
     15        )
     16 
     17    orig_width = get_width()
     18    client.execute_script(
     19        """
     20       const text = arguments[0].childNodes[0];
     21       text.nodeValue = text.nodeValue.trim();
     22    """,
     23        text,
     24    )
     25    return orig_width > get_width() + 10
     26 
     27 
     28 @pytest.mark.asyncio
     29 @pytest.mark.with_interventions
     30 async def test_enabled(client):
     31    assert not await svg_text_is_buggy(client)
     32 
     33 
     34 @pytest.mark.asyncio
     35 @pytest.mark.without_interventions
     36 async def test_disabled(client):
     37    assert await svg_text_is_buggy(client)