tor-browser

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

test_1850998_chaturbate_com.py (1449B)


      1 import pytest
      2 
      3 URL = "https://chaturbate.com/"
      4 AGREE_CSS = "#close_entrance_terms"
      5 FIRST_ROOM_CSS = "a.room_thumbnail_container[href]"
      6 FS_CSS = "[data-testid='mobile-fullscreen-button']"
      7 VID_CSS = ".videoPlayerDiv"
      8 
      9 
     10 async def is_requestFullscreen_called(client):
     11    await client.navigate(URL)
     12    client.await_css(AGREE_CSS, is_displayed=True, timeout=30).click()
     13    client.await_css(FIRST_ROOM_CSS, is_displayed=True).click()
     14    vid = client.await_css(VID_CSS, is_displayed=True)
     15    fs = client.await_css(FS_CSS, is_displayed=True)
     16    height = client.execute_script(
     17        """
     18      Element.prototype.requestFullscreen = () => window.fs_pressed = true
     19      return arguments[0].getBoundingClientRect().height;
     20    """,
     21        vid,
     22    )
     23    fs.click()
     24    return client.execute_async_script(
     25        """
     26      const [vidSel, height, done] = arguments;
     27      setInterval(() => {
     28        if (document.querySelector(vidSel)?.getBoundingClientRect().height > height) {
     29          done(window.fs_pressed);
     30        }
     31      }, 100);
     32    """,
     33        VID_CSS,
     34        height,
     35    )
     36 
     37 
     38 @pytest.mark.only_platforms("android")
     39 @pytest.mark.asyncio
     40 @pytest.mark.with_interventions
     41 async def test_enabled(client):
     42    assert await is_requestFullscreen_called(client)
     43 
     44 
     45 @pytest.mark.only_platforms("android")
     46 @pytest.mark.asyncio
     47 @pytest.mark.without_interventions
     48 async def test_disabled(client):
     49    assert not await is_requestFullscreen_called(client)