tor-browser

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

test_1930440_singaporepools_com.py (1158B)


      1 import pytest
      2 
      3 URL = "https://online.singaporepools.com/en/lottery"
      4 
      5 UNSUPPORTED_ALERT = "unsupported browser"
      6 LOGIN_CSS = ".mini-login-gadget"
      7 
      8 
      9 async def do_checks(client, shouldPass):
     10    await client.navigate(URL, wait="none")
     11    if not shouldPass:
     12        assert await client.await_alert(UNSUPPORTED_ALERT, timeout=60)
     13 
     14    # the login bits of the page should properly load
     15    assert client.await_css(LOGIN_CSS, is_displayed=True, timeout=60)
     16 
     17    # we should never see the in-page support warning
     18    warningFound = client.execute_script(
     19        """
     20      for (const warning of document.querySelectorAll(".alert.views-row")) {
     21        if (warning.innerText.includes("Chrome")) {
     22          return true;
     23        }
     24      }
     25      return false;
     26    """
     27    )
     28 
     29    if shouldPass:
     30        assert not await client.find_alert()
     31 
     32    assert (shouldPass and not warningFound) or (not shouldPass and warningFound)
     33 
     34 
     35 @pytest.mark.asyncio
     36 @pytest.mark.with_interventions
     37 async def test_enabled(client):
     38    await do_checks(client, True)
     39 
     40 
     41 @pytest.mark.asyncio
     42 @pytest.mark.without_interventions
     43 async def test_disabled(client):
     44    await do_checks(client, False)