tor-browser

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

test_1704673_app_xiaomi_com.py (1084B)


      1 import pytest
      2 from webdriver.bidi.error import UnknownErrorException
      3 
      4 # This site fails with a redirect loop with a Firefox UA
      5 
      6 URL = "http://app.xiaomi.com/"
      7 REDIR_FAILURE_CSS = "[data-l10n-id=redirectLoop-title]"
      8 REDIR_FAILURE_TEXT = "ERROR_REDIRECT_LOOP"
      9 SUCCESS_CSS = "#J_mingleList"
     10 
     11 
     12 @pytest.mark.only_platforms("android")
     13 @pytest.mark.asyncio
     14 @pytest.mark.with_interventions
     15 async def test_enabled(client):
     16    await client.navigate(URL)
     17    assert client.await_css(SUCCESS_CSS)
     18 
     19 
     20 @pytest.mark.only_platforms("android")
     21 @pytest.mark.asyncio
     22 @pytest.mark.without_interventions
     23 async def test_disabled(client):
     24    # We will either get a static error page with the text, or
     25    # an UnknownErrorException from WebDriver.
     26    try:
     27        await client.navigate(URL, wait="none", no_skip=True)
     28        desktop, mobile = client.await_first_element_of(
     29            [client.css(REDIR_FAILURE_CSS), client.text(REDIR_FAILURE_TEXT)],
     30            is_displayed=True,
     31            timeout=30,
     32        )
     33        assert desktop or mobile
     34    except UnknownErrorException:
     35        assert True