summaryrefslogtreecommitdiffstats
path: root/testing/webcompat/interventions/tests/test_1570328_developer_apple_com.py
blob: c40b530a6293a035506e901ca4d036fe6584e2b2 (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
import pytest

URL = "https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/AboutBundles/AboutBundles.html"
TOC_CSS = "#toc"


def toc_is_onscreen(client):
    assert client.await_css(TOC_CSS, is_displayed=True)
    return client.execute_script(
        """
        return document.querySelector("#toc").getBoundingClientRect().left >= 0;
    """
    )


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


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