tor-browser

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

test_1936429_diadora_com.py (1431B)


      1 import pytest
      2 
      3 URL = "https://www.diadora.com/en/us/men/?srule=sorting-in-season&prefn1=descrizioneCategoriaMerceologica&prefv1=Shoes"
      4 
      5 POPUPS_CSS = "#CybotCookiebotDialog, #CybotCookiebotDialog *, #modal-geolocation-change, #modal-geolocation-change *, .modal-backdrop, .modal-backdrop *"
      6 SELECT_CSS = ".paginationNumbers .select2.select2-container"
      7 CONTAINER_CSS = ".select2-results"
      8 
      9 
     10 async def get_container_width_difference(client):
     11    await client.navigate(URL, wait="none")
     12    client.hide_elements(POPUPS_CSS)
     13    client.click(client.await_css(SELECT_CSS, is_displayed=True))
     14    container = client.await_css(CONTAINER_CSS)
     15    return client.execute_script(
     16        """
     17      return arguments[0].getBoundingClientRect().width - arguments[0].firstChild.getBoundingClientRect().width;
     18    """,
     19        container,
     20    )
     21 
     22 
     23 @pytest.mark.skip_platforms("android")
     24 @pytest.mark.need_visible_scrollbars
     25 @pytest.mark.asyncio
     26 @pytest.mark.with_interventions
     27 async def test_enabled(client):
     28    # the site applies 10px of padding to the scrollable area.
     29    assert 10 == await get_container_width_difference(client)
     30 
     31 
     32 @pytest.mark.skip_platforms("android")
     33 @pytest.mark.need_visible_scrollbars
     34 @pytest.mark.asyncio
     35 @pytest.mark.without_interventions
     36 async def test_disabled(client):
     37    # the inner container will be more than 10px smaller if there is an extra scrollbar.
     38    assert 10 < await get_container_width_difference(client)