diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/webcompat/interventions/tests/test_1830752_afisha_ru.py | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/webcompat/interventions/tests/test_1830752_afisha_ru.py')
-rw-r--r-- | testing/webcompat/interventions/tests/test_1830752_afisha_ru.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/webcompat/interventions/tests/test_1830752_afisha_ru.py b/testing/webcompat/interventions/tests/test_1830752_afisha_ru.py new file mode 100644 index 0000000000..5a2a51acc1 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1830752_afisha_ru.py @@ -0,0 +1,45 @@ +import time + +import pytest +from webdriver.error import ElementClickInterceptedException, NoSuchElementException + +URL = "https://www.afisha.ru/msk/theatre/" +COOKIES_CSS = "button.Txfw7" +OPT_CSS = "button[data-name='price']" +SLIDER_CSS = "input[type='range'][data-index='0']" + + +async def slider_is_clickable(client): + await client.navigate(URL) + + try: + client.soft_click(client.await_css(COOKIES_CSS)) + client.await_element_hidden(client.css(COOKIES_CSS)) + except NoSuchElementException: + pass + + try: + client.soft_click(client.await_css(OPT_CSS, is_displayed=True)) + except NoSuchElementException: + pytest.xfail("Site may have shown a captcha; please run this test again") + + try: + slider = client.await_css(SLIDER_CSS, is_displayed=True) + time.sleep(2) + slider.click() + except ElementClickInterceptedException: + return False + + return True + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert await slider_is_clickable(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert not await slider_is_clickable(client) |