Source code

Revision control

Copy as Markdown

Other Tools

import pytest
COOKIES_CSS = "#usercentrics-cmp-ui"
DRAW_BUTTON_CSS = "button[data-loading=false]"
SEARCHBAR_CSS = "[class*=SearchBar]"
async def can_draw(client):
await client.navigate(URL)
client.hide_elements(COOKIES_CSS)
client.await_css(
DRAW_BUTTON_CSS, condition="elem.innerText.includes('Draw')", is_displayed=True
).click()
client.await_css(
DRAW_BUTTON_CSS,
condition="elem.innerText.includes('Draw from scratch')",
is_displayed=True,
).click()
coords = [200, 200]
await client.apz_down(coords=coords)
for _ in range(0, 10):
coords = [coords[0] + 5, coords[1] + 5]
await client.apz_move(coords=coords)
await client.apz_up(coords=coords)
# a searchbar appears if the page let us draw
await client.stall(1)
return client.find_css(SEARCHBAR_CSS, is_displayed=True)
@pytest.mark.skip_platforms("android")
@pytest.mark.asyncio
@pytest.mark.with_interventions
async def test_enabled(client):
assert await can_draw(client)
@pytest.mark.skip_platforms("android")
@pytest.mark.asyncio
@pytest.mark.without_interventions
async def test_disabled(client):
assert not await can_draw(client)