blob: cfefe314120ed2b457f9b736dc28106d90ff6781 (
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
|
import pytest
from webdriver.error import NoSuchElementException
URL = "https://my.babbel.com/en/welcome/1?bsc=engmag-rus&btp=default&learn_lang=RUS"
COOKIES_CSS = "#onetrust-accept-btn-handler"
BUTTON_CSS = "button.button[type=submit]"
async def button_visible(client):
await client.navigate(URL)
try:
client.soft_click(client.await_css(COOKIES_CSS, timeout=3))
except NoSuchElementException:
pass
btn = client.await_css(BUTTON_CSS)
return client.execute_script(
"""
return window.innerHeight > arguments[0].getBoundingClientRect().bottom;
""",
btn,
)
@pytest.mark.only_platforms("android")
@pytest.mark.asyncio
@pytest.mark.with_interventions
async def test_enabled(client):
assert await button_visible(client)
@pytest.mark.only_platforms("android")
@pytest.mark.asyncio
@pytest.mark.without_interventions
async def test_disabled(client):
assert not await button_visible(client)
|