summaryrefslogtreecommitdiffstats
path: root/testing/webcompat/interventions/tests/test_1765947_veniceincoming_com.py
blob: 84ad99a3a49c8f9482a19f285997c761f9229762 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import pytest
from webdriver.error import NoSuchElementException

URL = "https://veniceincoming.com/it_IT/search_results?page=1&start_date_start=&start_date_end=&k="
COOKIES_CSS = "[aria-label='cookieconsent'] .cc-allow"
IMG_CSS = ".tour-details"
TOUR_DATA_CSS = "#tour_data"


async def check_filter_opens(client):
    await client.navigate(URL)

    try:
        cookies = client.await_css(COOKIES_CSS, is_displayed=True, timeout=5)
        client.soft_click(cookies)
        client.await_element_hidden(client.css(COOKIES_CSS))
    except NoSuchElementException:
        pass

    img = client.await_css(IMG_CSS)
    client.scroll_into_view(img)
    client.mouse.click(element=img).perform()

    try:
        client.await_css(TOUR_DATA_CSS, is_displayed=True, timeout=5)
    except NoSuchElementException:
        return False
    return True


@pytest.mark.only_platforms("android")
@pytest.mark.asyncio
@pytest.mark.with_interventions
async def test_enabled(client):
    assert await check_filter_opens(client)


@pytest.mark.only_platforms("android")
@pytest.mark.asyncio
@pytest.mark.without_interventions
async def test_disabled(client):
    assert not await check_filter_opens(client)