tor-browser

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

test_1931538_buzzfeed_com.py (1505B)


      1 import pytest
      2 from webdriver.error import ElementClickInterceptedException
      3 
      4 URL = "https://www.buzzfeed.com/trendyelephant793/thanksgiving-foods-showdown-quiz"
      5 GOOGLE_LOGIN_POPUP_CSS = "#credential_picker_iframe"
      6 START_BUTTON = "[class*=introWrapper] button"
      7 CARD_FRONT_CSS = "[class*=isFlipped] [class*=cardFace][class*=cardFront]"
      8 
      9 
     10 async def can_click_on_cards(client):
     11    expected_popups = [client.css(GOOGLE_LOGIN_POPUP_CSS)]
     12    await client.navigate(URL)
     13    start = client.await_css(START_BUTTON, is_displayed=True)
     14    client.scroll_into_view(start)
     15    start.click()
     16    front = client.await_css(CARD_FRONT_CSS, is_displayed=True)
     17    client.execute_async_script(
     18        """
     19      const [card, ready] = arguments;
     20      card.parentElement.addEventListener("transitionend", ready);
     21    """,
     22        front,
     23    )
     24    try:
     25        client.click(front, popups=expected_popups)
     26    except ElementClickInterceptedException:
     27        return False
     28    return True
     29 
     30 
     31 @pytest.mark.only_firefox_versions(max=140)
     32 @pytest.mark.asyncio
     33 @pytest.mark.with_interventions
     34 async def test_enabled(client):
     35    assert await can_click_on_cards(client)
     36 
     37 
     38 @pytest.mark.only_firefox_versions(max=140)
     39 @pytest.mark.asyncio
     40 @pytest.mark.without_interventions
     41 async def test_disabled(client):
     42    assert not await can_click_on_cards(client)
     43 
     44 
     45 @pytest.mark.only_firefox_versions(min=141)
     46 @pytest.mark.asyncio
     47 @pytest.mark.without_interventions
     48 async def test_regression(client):
     49    assert await can_click_on_cards(client)