tor-browser

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

test_1830739_120609_www_planet7casino_com.py (1086B)


      1 import asyncio
      2 
      3 import pytest
      4 
      5 URL = "https://www.planet7casino.com/lobby/?play=alien-wins"
      6 IFRAME_CSS = "#gameiframe"
      7 GOOD_MSG = "GameViewModel"
      8 BAD_MSG = "UnsupportedDevice"
      9 DOWN_TEXT = "temporarily out of order"
     10 
     11 
     12 async def check_for_message(client, message):
     13    await client.navigate(URL)
     14    client.switch_to_frame(client.await_css(IFRAME_CSS))
     15    down = client.async_await_element(client.text(DOWN_TEXT))
     16    expected_message = await client.promise_console_message_listener(message)
     17    done, pending = await asyncio.wait(
     18        [down, expected_message], return_when=asyncio.FIRST_COMPLETED
     19    )
     20    if down in done:
     21        pytest.skip("Cannot test: casino is 'temporarily out of order'")
     22    assert expected_message in done
     23 
     24 
     25 @pytest.mark.only_platforms("android")
     26 @pytest.mark.asyncio
     27 @pytest.mark.with_interventions
     28 async def test_enabled(client):
     29    assert check_for_message(client, GOOD_MSG)
     30 
     31 
     32 @pytest.mark.only_platforms("android")
     33 @pytest.mark.asyncio
     34 @pytest.mark.without_interventions
     35 async def test_disabled(client):
     36    assert check_for_message(client, BAD_MSG)