tor-browser

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

test_1896571_gracobaby_ca.py (1491B)


      1 import time
      2 
      3 import pytest
      4 
      5 URL = "https://www.gracobaby.ca/en_CA/All%20In%20Ones/SAP_2184499.html"
      6 
      7 
      8 async def check_can_scroll(client):
      9    # The site only has the problem if the window size is narrow enough.
     10    client.set_screen_size(400, 800)
     11    await client.navigate(URL)
     12 
     13    # body.scrollTop changes if wk-fill-available is on, otherwise window.scrollY does.
     14    old_sy = client.execute_script("return window.scrollY")
     15    old_st = client.execute_script("return document.body.scrollTop")
     16    client.apz_scroll(client.await_css("body"), dy=100)
     17 
     18    # We need to wait for window.scrollY to be updated, but we
     19    # can't rely on an event being fired to detect when it's done.
     20    time.sleep(1)
     21    return old_sy != client.execute_script(
     22        "return window.scrollY"
     23    ) or old_st != client.execute_script("return document.body.scrollTop")
     24 
     25 
     26 @pytest.mark.enable_webkit_fill_available
     27 @pytest.mark.actual_platform_required
     28 @pytest.mark.asyncio
     29 @pytest.mark.with_interventions
     30 async def test_enabled(client):
     31    assert await check_can_scroll(client)
     32 
     33 
     34 @pytest.mark.disable_webkit_fill_available
     35 @pytest.mark.actual_platform_required
     36 @pytest.mark.asyncio
     37 @pytest.mark.with_interventions
     38 async def test_enabled2(client):
     39    assert await check_can_scroll(client)
     40 
     41 
     42 @pytest.mark.disable_webkit_fill_available
     43 @pytest.mark.actual_platform_required
     44 @pytest.mark.asyncio
     45 @pytest.mark.without_interventions
     46 async def test_disabled(client):
     47    assert not await check_can_scroll(client)