tor-browser

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

test_1955932_coopvoce_it.py (1138B)


      1 import asyncio
      2 
      3 import pytest
      4 from webdriver.error import NoSuchElementException
      5 
      6 URL = "https://www.coopvoce.it/portale/ricarica.html"
      7 ALLOW_COOKIES_CSS = "#CybotCookiebotDialogBodyLevelButtonLevelOptinAllowAll"
      8 RADIO_CSS = "li.nav-item.online-importo"
      9 RADIO_SELECTED_CSS = "li.nav-item.online-importo .selected"
     10 
     11 
     12 async def does_radiobutton_work(client):
     13    await client.navigate(URL)
     14 
     15    try:
     16        client.await_css(ALLOW_COOKIES_CSS, is_displayed=True, timeout=4).click()
     17        client.await_element_hidden(client.css(ALLOW_COOKIES_CSS))
     18    except NoSuchElementException:
     19        pass
     20 
     21    radio = client.await_css(RADIO_CSS, is_displayed=True)
     22    await asyncio.sleep(0.5)
     23    radio.click()
     24    try:
     25        client.await_css(RADIO_SELECTED_CSS, is_displayed=True, timeout=3)
     26        return True
     27    except NoSuchElementException:
     28        return False
     29 
     30 
     31 @pytest.mark.asyncio
     32 @pytest.mark.with_interventions
     33 async def test_enabled(client):
     34    assert await does_radiobutton_work(client)
     35 
     36 
     37 @pytest.mark.asyncio
     38 @pytest.mark.without_interventions
     39 async def test_disabled(client):
     40    assert not await does_radiobutton_work(client)