tor-browser

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

test_1925276_xtralife_com.py (1242B)


      1 import pytest
      2 
      3 URL = "https://www.xtralife.com/"
      4 
      5 HERO_CSS = ".cookie-title"
      6 SEARCH_CSS = "form[action*=buscar] input[type=text]"
      7 SEARCH_RESULTS_CSS = ".smart-search-results"
      8 HEADER_CSS = ".headerContent"
      9 
     10 
     11 async def search_results_positioned_properly(client):
     12    await client.navigate(URL, wait="none")
     13    client.await_css(HERO_CSS, is_displayed=True)
     14    client.await_css(SEARCH_CSS, is_displayed=True).send_keys("test")
     15    results = client.await_css(SEARCH_RESULTS_CSS, is_displayed=True)
     16    header = client.await_css(HEADER_CSS, is_displayed=True)
     17    return client.execute_script(
     18        """
     19        const [results, header] = arguments;
     20        const headerBB = header.getBoundingClientRect();
     21        const resultsBB = results.getBoundingClientRect();
     22        return resultsBB.top >= headerBB.bottom;
     23      """,
     24        results,
     25        header,
     26    )
     27 
     28 
     29 @pytest.mark.skip_platforms("android")
     30 @pytest.mark.asyncio
     31 @pytest.mark.with_interventions
     32 async def test_enabled(client):
     33    assert await search_results_positioned_properly(client)
     34 
     35 
     36 @pytest.mark.skip_platforms("android")
     37 @pytest.mark.asyncio
     38 @pytest.mark.without_interventions
     39 async def test_disabled(client):
     40    assert not await search_results_positioned_properly(client)