tor-browser

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

test_2004610_character_ai.py (1074B)


      1 import pytest
      2 
      3 URL = "https://character.ai/chat/NrVgl5IP6AyWq7ZCQtzJ6Y8TZHevcJtD7FJxOiUpOD0"
      4 DESCRIPTION_CSS = "[data-testid=product-description]"
      5 
      6 
      7 async def is_text_italicized(client):
      8    await client.navigate(URL)
      9    # rather than trying to log in and such, let's just create the markup the site is
     10    # expected to make, and check whether the font appears italicized by comparing it
     11    # to a screenshot after italics have been forced using the CSS we are applying.
     12    client.execute_script(
     13        """document.body.innerHTML = `<div class="font-display"><em>T</em></div>`"""
     14    )
     15    t = client.await_css("div.font-display")
     16    pre = t.screenshot()
     17    client.execute_script(
     18        """document.body.style["font-variation-settings"] = "'ital' 10";"""
     19    )
     20    return pre == t.screenshot()
     21 
     22 
     23 @pytest.mark.asyncio
     24 @pytest.mark.with_interventions
     25 async def test_enabled(client):
     26    assert await is_text_italicized(client)
     27 
     28 
     29 @pytest.mark.asyncio
     30 @pytest.mark.without_interventions
     31 async def test_disabled(client):
     32    assert not await is_text_italicized(client)