tor-browser

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

test_2003011_ehealth_gov_gr.py (1331B)


      1 from asyncio.exceptions import TimeoutError
      2 
      3 import pytest
      4 from webdriver.error import NoSuchElementException
      5 
      6 URL = "https://ehealth.gov.gr/p-rv/p"
      7 
      8 POPUP_CSS = ".popupContent"
      9 POPUP_CC_LINK_CSS = ".popupContent .cc-link"
     10 
     11 
     12 async def is_popup_text_cut_off(client):
     13    try:
     14        await client.navigate(URL, wait="none", timeout=10, no_skip=True)
     15        popup = client.await_css(POPUP_CSS, is_displayed=True)
     16        cc_link = client.await_css(POPUP_CC_LINK_CSS, is_displayed=True)
     17        return client.execute_script(
     18            """
     19            const [popup, cc_link] = arguments;
     20            return cc_link.getBoundingClientRect().top > popup.getBoundingClientRect().bottom;
     21          """,
     22            popup,
     23            cc_link,
     24        )
     25    except (TimeoutError, NoSuchElementException):
     26        pytest.skip("Region-locked, cannot test. Try using a VPN set to Greece.")
     27        return False
     28 
     29 
     30 @pytest.mark.only_platforms("android")
     31 @pytest.mark.actual_platform_required
     32 @pytest.mark.asyncio
     33 @pytest.mark.with_interventions
     34 async def test_enabled(client):
     35    assert not await is_popup_text_cut_off(client)
     36 
     37 
     38 @pytest.mark.only_platforms("android")
     39 @pytest.mark.actual_platform_required
     40 @pytest.mark.asyncio
     41 @pytest.mark.without_interventions
     42 async def test_disabled(client):
     43    assert await is_popup_text_cut_off(client)