diff options
Diffstat (limited to 'testing/webcompat/interventions/tests')
94 files changed, 2648 insertions, 0 deletions
diff --git a/testing/webcompat/interventions/tests/__init__.py b/testing/webcompat/interventions/tests/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testing/webcompat/interventions/tests/__init__.py diff --git a/testing/webcompat/interventions/tests/test_1385206_rakuten_co_jp.py b/testing/webcompat/interventions/tests/test_1385206_rakuten_co_jp.py new file mode 100644 index 0000000000..a5dec6d9d8 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1385206_rakuten_co_jp.py @@ -0,0 +1,23 @@ +import pytest + +URL = "http://www.rakuten.co.jp/" +MOBILE_CSS = "#top-area" +DESKTOP_CSS = "#header-group" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(MOBILE_CSS) + assert not client.find_css(DESKTOP_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(DESKTOP_CSS) + assert not client.find_css(MOBILE_CSS) diff --git a/testing/webcompat/interventions/tests/test_1448747_bathpublishing_com.py b/testing/webcompat/interventions/tests/test_1448747_bathpublishing_com.py new file mode 100644 index 0000000000..0d6877ed15 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1448747_bathpublishing_com.py @@ -0,0 +1,32 @@ +import pytest +from webdriver.error import NoSuchElementException + +URL = "https://bathpublishing.com/products/clinical-negligence-made-clear-a-guide-for-patients-professionals" +POPUP_CSS = "button.recommendation-modal__close-button" +SELECT_CSS = "select#productSelect--product-template-option-0" + + +async def is_fastclick_active(client): + await client.navigate(URL) + + try: + client.soft_click(client.await_css(POPUP_CSS, timeout=3)) + client.await_element_hidden(client.css(POPUP_CSS)) + except NoSuchElementException: + pass + + return client.test_for_fastclick(client.await_css(SELECT_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_fastclick_active(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_fastclick_active(client) diff --git a/testing/webcompat/interventions/tests/test_1448747_bluetokaicoffee_com.py b/testing/webcompat/interventions/tests/test_1448747_bluetokaicoffee_com.py new file mode 100644 index 0000000000..9f4bdc0959 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1448747_bluetokaicoffee_com.py @@ -0,0 +1,23 @@ +import pytest + +URL = "https://bluetokaicoffee.com/collections/cold-brew-can" +SELECT_CSS = "select#SortBy" + + +async def is_fastclick_active(client): + await client.navigate(URL) + return client.test_for_fastclick(client.await_css(SELECT_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_fastclick_active(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_fastclick_active(client) diff --git a/testing/webcompat/interventions/tests/test_1448747_co2meter_com.py b/testing/webcompat/interventions/tests/test_1448747_co2meter_com.py new file mode 100644 index 0000000000..2932e9cb03 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1448747_co2meter_com.py @@ -0,0 +1,40 @@ +import pytest +from webdriver.error import NoSuchElementException + +URL = "https://www.co2meter.com/collections/restaurants-food" +ITEM_CSS = "a.grid__image" +ADD_CSS = "#AddToCart" +SELECT_CSS = "select#address_country" +POPUP_CLOSE_CSS = "button.needsclick.klaviyo-close-form" + + +async def is_fastclick_active(client): + await client.navigate(URL) + + client.soft_click(client.await_css(ITEM_CSS)) + client.soft_click(client.await_css(ADD_CSS)) + + try: + popup_close_finder = client.css(POPUP_CLOSE_CSS) + popup_close = client.await_element(popup_close_finder, timeout=5) + if popup_close: + client.soft_click(popup_close) + client.await_element_hidden(popup_close_finder) + except NoSuchElementException: + pass + + return client.test_for_fastclick(client.await_css(SELECT_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_fastclick_active(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_fastclick_active(client) diff --git a/testing/webcompat/interventions/tests/test_1448747_discountcoffee_co_uk.py b/testing/webcompat/interventions/tests/test_1448747_discountcoffee_co_uk.py new file mode 100644 index 0000000000..beb4f48ff9 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1448747_discountcoffee_co_uk.py @@ -0,0 +1,23 @@ +import pytest + +URL = "https://www.discountcoffee.co.uk/collections/wholesale-coffee-beans" +SELECT_CSS = "#collection-filter-type select" + + +async def is_fastclick_active(client): + await client.navigate(URL) + return client.test_for_fastclick(client.await_css(SELECT_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_fastclick_active(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_fastclick_active(client) diff --git a/testing/webcompat/interventions/tests/test_1448747_dylantalkstone_com.py b/testing/webcompat/interventions/tests/test_1448747_dylantalkstone_com.py new file mode 100644 index 0000000000..af397a9ff0 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1448747_dylantalkstone_com.py @@ -0,0 +1,23 @@ +import pytest + +URL = "https://dylantalkstone.com/collections/tele-pickups/products/flat-6-tele-pickups" +SELECT_CSS = "select#productSelect-option-0" + + +async def is_fastclick_active(client): + await client.navigate(URL) + return client.test_for_fastclick(client.await_css(SELECT_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_fastclick_active(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_fastclick_active(client) diff --git a/testing/webcompat/interventions/tests/test_1448747_fourbarrelcoffee_com.py b/testing/webcompat/interventions/tests/test_1448747_fourbarrelcoffee_com.py new file mode 100644 index 0000000000..2103853b27 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1448747_fourbarrelcoffee_com.py @@ -0,0 +1,23 @@ +import pytest + +URL = "https://www.fourbarrelcoffee.com/" +ADD_TO_CART_CSS = "#container a#menu-link" + + +async def is_fastclick_active(client): + await client.navigate(URL) + return client.test_for_fastclick(client.await_css(ADD_TO_CART_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_fastclick_active(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_fastclick_active(client) diff --git a/testing/webcompat/interventions/tests/test_1448747_franmar_com.py b/testing/webcompat/interventions/tests/test_1448747_franmar_com.py new file mode 100644 index 0000000000..38690667ef --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1448747_franmar_com.py @@ -0,0 +1,23 @@ +import pytest + +URL = "https://products.franmar.com/collections/consumer-products/" +SELECT_CSS = "#sortBy" + + +async def is_fastclick_active(client): + await client.navigate(URL) + return client.test_for_fastclick(client.await_css(SELECT_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_fastclick_active(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_fastclick_active(client) diff --git a/testing/webcompat/interventions/tests/test_1448747_gofreeconcepts_de.py b/testing/webcompat/interventions/tests/test_1448747_gofreeconcepts_de.py new file mode 100644 index 0000000000..dd51bff9da --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1448747_gofreeconcepts_de.py @@ -0,0 +1,23 @@ +import pytest + +URL = "https://gofreeconcepts.de/collections/shamma-sandals/products/shamma-sandals-warriors-maximus-mit-lederfussbett" +SELECT_CSS = "#productSelect" + + +async def is_fastclick_active(client): + await client.navigate(URL) + return client.test_for_fastclick(client.await_css(SELECT_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_fastclick_active(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_fastclick_active(client) diff --git a/testing/webcompat/interventions/tests/test_1448747_renewd_com_au.py b/testing/webcompat/interventions/tests/test_1448747_renewd_com_au.py new file mode 100644 index 0000000000..b5ad4f90c7 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1448747_renewd_com_au.py @@ -0,0 +1,23 @@ +import pytest + +URL = "https://renewd.com.au" +ADD_TO_CART_CSS = "button[id].btn.add_to_cart" + + +async def is_fastclick_active(client): + await client.navigate(URL) + return client.test_for_fastclick(client.await_css(ADD_TO_CART_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_fastclick_active(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_fastclick_active(client) diff --git a/testing/webcompat/interventions/tests/test_1448747_thehawksmoor_com.py b/testing/webcompat/interventions/tests/test_1448747_thehawksmoor_com.py new file mode 100644 index 0000000000..0f7efe2d0e --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1448747_thehawksmoor_com.py @@ -0,0 +1,31 @@ +import pytest +from webdriver.error import NoSuchElementException + +URL = "https://thehawksmoor.com/book-a-table/?location=11335" +POPUP_CSS = ".pum-overlay button.pum-close" +SELECT_CSS = "select#booktable_restaurants" + + +async def is_fastclick_active(client): + await client.navigate(URL) + + try: + client.soft_click(client.await_css(POPUP_CSS, timeout=3)) + except NoSuchElementException: + pass + + return client.test_for_fastclick(client.await_css(SELECT_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_fastclick_active(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_fastclick_active(client) diff --git a/testing/webcompat/interventions/tests/test_1452707_absa.py b/testing/webcompat/interventions/tests/test_1452707_absa.py new file mode 100644 index 0000000000..2c0a1ad35a --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1452707_absa.py @@ -0,0 +1,19 @@ +import pytest + +URL = "https://ib.absa.co.za/absa-online/login.jsp" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.find_css("html.gecko") + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.alert.text == "Browser unsupported" + client.alert.dismiss() + assert client.find_css("html.unknown") diff --git a/testing/webcompat/interventions/tests/test_1457335_histography.py b/testing/webcompat/interventions/tests/test_1457335_histography.py new file mode 100644 index 0000000000..9e437d52b6 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1457335_histography.py @@ -0,0 +1,20 @@ +import pytest + +URL = "http://histography.io/" +SUPPORT_URL = "http://histography.io/browser_support.htm" + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.current_url == URL + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.current_url == SUPPORT_URL diff --git a/testing/webcompat/interventions/tests/test_1472075_bankofamerica.py b/testing/webcompat/interventions/tests/test_1472075_bankofamerica.py new file mode 100644 index 0000000000..d49c141c46 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1472075_bankofamerica.py @@ -0,0 +1,19 @@ +import pytest + +URL = "https://www.bankofamerica.com/" + + +@pytest.mark.asyncio +@pytest.mark.skip_platforms("android", "windows") +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert not client.find_css("#browserUpgradeNoticeBar") + + +@pytest.mark.asyncio +@pytest.mark.skip_platforms("android", "windows") +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.is_displayed(client.await_css("#browserUpgradeNoticeBar")) diff --git a/testing/webcompat/interventions/tests/test_1509873_viewer_zmags_com.py b/testing/webcompat/interventions/tests/test_1509873_viewer_zmags_com.py new file mode 100644 index 0000000000..50a48f1ccd --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1509873_viewer_zmags_com.py @@ -0,0 +1,21 @@ +import pytest + +URL = "https://secure.viewer.zmags.com/services/htmlviewer/content/ddc3f3b9?pubVersion=46&locale=en&viewerID=85cfd72f#/ddc3f3b9/1" +BLOCKED_TEXT = "This browser is not supported" +UNBLOCKED_CSS = "#viewer .MainViewEnabled" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(UNBLOCKED_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_text(BLOCKED_TEXT) diff --git a/testing/webcompat/interventions/tests/test_1570108_steamcommunity.py b/testing/webcompat/interventions/tests/test_1570108_steamcommunity.py new file mode 100644 index 0000000000..bef7efd9d5 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1570108_steamcommunity.py @@ -0,0 +1,136 @@ +import pytest + +URL = "https://steamcommunity.com/chat" + + +USERID_CSS = "input[type='text'][class*='newlogindialog']" +PASSWORD_CSS = "input[type='password'][class*='newlogindialog']" +SIGNIN_CSS = "button[type='submit'][class*='newlogindialog']" +GEAR_CSS = ".friendListButton" +LOGIN_FAIL_XPATH = ( + "//*[contains(text(), 'try again') and " "contains(@class, 'FormError')]" +) +AUTH_CSS = "[class*='newlogindialog_ProtectingAccount']" +AUTH_DIGITS_CSS = "[class*='newlogindialog_SegmentedCharacterInput'] input[type='text']" +AUTH_RETRY_CSS = "[class*='newlogindialog_TryAgainButton']" +AUTH_RETRY_LOADER_CSS = "[class*='newlogindialog_Loading']" +RATE_TEXT = "too many login failures" +VOICE_XPATH = ( + "//*[contains(text(), 'Voice') and " + "contains(@class, 'pagedsettings_PagedSettingsDialog_PageListItem')]" +) +MIC_BUTTON_CSS = "button.LocalMicTestButton" +UNSUPPORTED_TEXT = "currently unsupported in Firefox" + + +async def do_2fa(client): + digits = client.find_css(AUTH_DIGITS_CSS, all=True) + assert len(digits) > 0 + + loader = client.css(AUTH_RETRY_LOADER_CSS) + if client.find_element(loader): + client.await_element_hidden(loader) + for digit in digits: + if digit.property("value"): + digit.send_keys(u"\ue003") # backspace + + code = input("**** Enter two-factor authentication code: ") + for i, digit in enumerate(code): + if len(digits) > i: + digits[i].send_keys(digit) + + client.await_element(loader, timeout=10) + client.await_element_hidden(loader) + + +async def load_mic_test(client, credentials, should_do_2fa): + await client.navigate(URL) + + async def login(): + userid = client.await_css(USERID_CSS) + password = client.find_css(PASSWORD_CSS) + submit = client.find_css(SIGNIN_CSS) + assert client.is_displayed(userid) + assert client.is_displayed(password) + assert client.is_displayed(submit) + + userid.send_keys(credentials["username"]) + password.send_keys(credentials["password"]) + submit.click() + + await login() + + while True: + auth, retry, gear, fail, rate = client.await_first_element_of( + [ + client.css(AUTH_CSS), + client.css(AUTH_RETRY_CSS), + client.css(GEAR_CSS), + client.xpath(LOGIN_FAIL_XPATH), + client.text(RATE_TEXT), + ], + is_displayed=True, + timeout=20, + ) + + if retry: + await do_2fa(client) + continue + + if rate: + pytest.skip( + "Too many Steam login attempts in a short time; try again later." + ) + return None + elif auth: + if should_do_2fa: + await do_2fa(client) + continue + + pytest.skip( + "Two-factor authentication requested; disable Steam Guard" + " or run this test with --do-2fa to live-input codes" + ) + return None + elif fail: + pytest.skip("Invalid login provided.") + return None + else: + break + + assert gear + gear.click() + + voice = client.await_xpath(VOICE_XPATH, is_displayed=True) + voice.click() + + mic_test = client.await_css(MIC_BUTTON_CSS, is_displayed=True) + return mic_test + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client, credentials, should_do_2fa): + mic_test = await load_mic_test(client, credentials, should_do_2fa) + if not mic_test: + return + + with client.assert_getUserMedia_called(): + mic_test.click() + + assert not client.find_text(UNSUPPORTED_TEXT) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client, credentials, should_do_2fa): + mic_test = await load_mic_test(client, credentials, should_do_2fa) + if not mic_test: + return + + mic_test.click() + + unsupported = client.await_text(UNSUPPORTED_TEXT) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1570328_developer_apple_com.py b/testing/webcompat/interventions/tests/test_1570328_developer_apple_com.py new file mode 100644 index 0000000000..c40b530a62 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1570328_developer_apple_com.py @@ -0,0 +1,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) diff --git a/testing/webcompat/interventions/tests/test_1574522_enuri_com.py b/testing/webcompat/interventions/tests/test_1574522_enuri_com.py new file mode 100644 index 0000000000..156d2b2f36 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1574522_enuri_com.py @@ -0,0 +1,23 @@ +import pytest + +# The site puts an exclamation mark in front of width="703" +# for Chrome UAs, but not for Firefox. + +URL = "http://enuri.com/knowcom/detail.jsp?kbno=474985" +CHECK_CSS = "td[width='703']" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert not client.find_css(CHECK_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.find_css(CHECK_CSS) diff --git a/testing/webcompat/interventions/tests/test_1575000_lloydsbank.py b/testing/webcompat/interventions/tests/test_1575000_lloydsbank.py new file mode 100644 index 0000000000..00426dd6aa --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1575000_lloydsbank.py @@ -0,0 +1,41 @@ +import pytest + +URL = ( + "https://apply.lloydsbank.co.uk/sales-content/cwa/l/pca/index-app.html" + "?product=classicaccountLTB#!b" +) + +NO_CSS = "[data-selector='existingCustomer-toggle-button-no']" +CONT_CSS = "[data-selector='ib-yes-continue-without-login-not-existing-customer-continue-button']" +CONT2_CSS = "[data-selector='beforeYouStart-continue-button']" +RADIO_CSS = "[name='aboutYou-gender-radio'] + span" +ACCEPT_COOKIES_CSS = "#lbganalyticsCookies [title*='Accept cookies']" + + +async def get_radio_position(client): + await client.navigate(URL) + accept = client.await_css(ACCEPT_COOKIES_CSS, timeout=2) + if accept: + accept.click() + client.await_css(NO_CSS).click() + client.await_css(CONT_CSS).click() + client.await_css(CONT2_CSS).click() + radio = client.await_css(RADIO_CSS) + return client.execute_script( + """ + return window.getComputedStyle(arguments[0]).position; + """, + radio, + ) + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert "relative" == await get_radio_position(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert "relative" != await get_radio_position(client) diff --git a/testing/webcompat/interventions/tests/test_1577267_metfone_com_kh.py b/testing/webcompat/interventions/tests/test_1577267_metfone_com_kh.py new file mode 100644 index 0000000000..3cc4870b42 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1577267_metfone_com_kh.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.metfone.com.kh/en/4g-lte" +DESKTOP_CSS = "section.quickLinks" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert not client.find_css(DESKTOP_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.find_css(DESKTOP_CSS) diff --git a/testing/webcompat/interventions/tests/test_1577519_stream_directv_com.py b/testing/webcompat/interventions/tests/test_1577519_stream_directv_com.py new file mode 100644 index 0000000000..fde07de470 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1577519_stream_directv_com.py @@ -0,0 +1,37 @@ +import pytest + +URL = "https://stream.directv.com/" +LOGIN_CSS = "#userID" +UNSUPPORTED_CSS = ".title-new-browse-ff" +DENIED_XPATH = "//h1[text()='Access Denied']" + + +async def check_site(client, should_pass): + await client.navigate(URL) + + denied, login, unsupported = client.await_first_element_of( + [ + client.xpath(DENIED_XPATH), + client.css(LOGIN_CSS), + client.css(UNSUPPORTED_CSS), + ], + is_displayed=True, + ) + + if denied: + pytest.skip("Region-locked, cannot test. Try using a VPN set to USA.") + return + + assert (should_pass and login) or (not should_pass and unsupported) + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await check_site(client, should_pass=True) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await check_site(client, should_pass=False) diff --git a/testing/webcompat/interventions/tests/test_1579159_m_tailieu_vn.py b/testing/webcompat/interventions/tests/test_1579159_m_tailieu_vn.py new file mode 100644 index 0000000000..59f48097f3 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1579159_m_tailieu_vn.py @@ -0,0 +1,26 @@ +import pytest + +URL = ( + "https://m.tailieu.vn/index/mobile/id/1654340/hash/654d7ea9c2853e5be07e2c792ea7f168" +) +PAGE_CSS = "#viewer > #pageContainer1" +OK_ERROR_CSS = "#errorMessage" +ERROR_MSG = "may not load data from http://tailieu.vn/html5/pdf.js" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + page, ok_error = client.await_first_element_of( + [client.css(PAGE_CSS), client.css(OK_ERROR_CSS)], is_displayed=True + ) + assert page or ok_error + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL, await_console_message=ERROR_MSG) diff --git a/testing/webcompat/interventions/tests/test_1582582_sling_com.py b/testing/webcompat/interventions/tests/test_1582582_sling_com.py new file mode 100644 index 0000000000..71f6910af9 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1582582_sling_com.py @@ -0,0 +1,26 @@ +import pytest + +URL = "https://watch.sling.com/" +INCOMPATIBLE_CSS = "[class*='unsupported-browser']" +LOADER_CSS = ".loader-container" +VPN_TEXT = "ONLY AVAILABLE INSIDE THE US" + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + loader, vpn = client.await_first_element_of( + [client.css(LOADER_CSS), client.text(VPN_TEXT)], timeout=20 + ) + assert loader or vpn + assert not client.find_css(INCOMPATIBLE_CSS) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(INCOMPATIBLE_CSS, timeout=2000) diff --git a/testing/webcompat/interventions/tests/test_1595215_uniqlo_com.py b/testing/webcompat/interventions/tests/test_1595215_uniqlo_com.py new file mode 100644 index 0000000000..f87f8349b0 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1595215_uniqlo_com.py @@ -0,0 +1,21 @@ +import pytest + +URL = "https://store-kr.uniqlo.com/" +REDIRECT_CSS = "[onload='javascript:redirectPage();']" +APP_CSS = "uni-root" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(APP_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(REDIRECT_CSS) diff --git a/testing/webcompat/interventions/tests/test_1605611_maps_google_com.py b/testing/webcompat/interventions/tests/test_1605611_maps_google_com.py new file mode 100644 index 0000000000..c8aadc2e3e --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1605611_maps_google_com.py @@ -0,0 +1,34 @@ +import pytest + +# Google puts [disabled="true"] on buttons, which causes them to not +# work in Firefox. Our intervention removes that [disabled] property. + +URL = "https://www.google.com/maps/dir/Fettstra%C3%9Fe+20,+D-20357+Hamburg,+Deutschland/Hauptkirche+St.+Michaelis,+Englische+Planke,+Hamburg/@53.5586949,9.9852882,14z/data=!4m8!4m7!1m2!1m1!1s0x47b18f4493d02fe1:0x6280c2a6cea3ed83!1m2!1m1!1s0x47b18f11e1dd5b45:0x187d5dca009a4b19!3e3?gl=de" +BUTTON_CSS = "button[jsaction^='directionsSearchbox.time']" + + +def button_is_disabled(client): + button = client.await_css(BUTTON_CSS, is_displayed=True) + assert button + return client.execute_script( + """ + return arguments[0].getAttribute("disabled") === "true"; + """, + button, + ) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert not button_is_disabled(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert button_is_disabled(client) diff --git a/testing/webcompat/interventions/tests/test_1610026_mobilesuica.py b/testing/webcompat/interventions/tests/test_1610026_mobilesuica.py new file mode 100644 index 0000000000..444fe8471f --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1610026_mobilesuica.py @@ -0,0 +1,49 @@ +import pytest + +ADDRESS_CSS = "input[name=MailAddress]" +PASSWORD_CSS = "input[name=Password]" +CLOSE_BUTTON_CSS = "input[name=winclosebutton]" +UNAVAILABLE_TEXT = "時間をお確かめの上、再度実行してください。" +UNSUPPORTED_TEXT = "ご利用のブラウザでは正しく" + + +async def load_site(client): + await client.navigate("https://www.mobilesuica.com/") + + address = client.find_css(ADDRESS_CSS) + password = client.find_css(PASSWORD_CSS) + error1 = client.find_css(CLOSE_BUTTON_CSS) + error2 = client.find_text(UNSUPPORTED_TEXT) + + # The page can be down at certain times, making testing impossible. For instance: + # "モバイルSuicaサービスが可能な時間は4:00~翌日2:00です。 + # 時間をお確かめの上、再度実行してください。" + # "Mobile Suica service is available from 4:00 to 2:00 the next day. + # Please check the time and try again." + site_is_down = client.find_text(UNAVAILABLE_TEXT) + if site_is_down is not None: + pytest.xfail("Site is currently down") + + return address, password, error1 or error2, site_is_down + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + address, password, error, site_is_down = await load_site(client) + if site_is_down: + return + assert client.is_displayed(address) + assert client.is_displayed(password) + assert error is None + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + address, password, error, site_is_down = await load_site(client) + if site_is_down: + return + assert address is None + assert password is None + assert client.is_displayed(error) diff --git a/testing/webcompat/interventions/tests/test_1610344_directv_com_co.py b/testing/webcompat/interventions/tests/test_1610344_directv_com_co.py new file mode 100644 index 0000000000..d832eb33d2 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1610344_directv_com_co.py @@ -0,0 +1,47 @@ +import pytest + +URL = "https://www.directv.com.co/" +IFRAME_CSS = "#main-iframe" +INCOMPATIBLE_CSS = ".browser-compatible.compatible.incompatible" +BLOCKED_TEXT = "blocked by the security rules" +DENIED_TEXT = "not available in your region" +FORBIDDEN_TEXT = "403 Forbidden" + + +async def check_unsupported_visibility(client, should_show): + await client.navigate(URL) + + # their region-block page sometimes wraps the content in an iframe + frame = client.find_css(IFRAME_CSS) + if frame: + client.switch_frame(frame) + + denied, blocked, forbidden, incompatible = client.await_first_element_of( + [ + client.text(DENIED_TEXT), + client.text(BLOCKED_TEXT), + client.text(FORBIDDEN_TEXT), + client.css(INCOMPATIBLE_CSS), + ] + ) + + if denied or blocked or forbidden: + pytest.skip("Region-locked, cannot test. Try using a VPN set to USA.") + return + + shown = client.is_displayed(incompatible) + assert (should_show and shown) or (not should_show and not shown) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await check_unsupported_visibility(client, should_show=False) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await check_unsupported_visibility(client, should_show=True) diff --git a/testing/webcompat/interventions/tests/test_1622063_wp1-ext_usps_gov.py b/testing/webcompat/interventions/tests/test_1622063_wp1-ext_usps_gov.py new file mode 100644 index 0000000000..e55adf0dbe --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1622063_wp1-ext_usps_gov.py @@ -0,0 +1,21 @@ +import pytest + +URL = "https://wp1-ext.usps.gov/sap/bc/webdynpro/sap/hrrcf_a_unreg_job_search" +BLOCKED_TEXT = "This browser is not supported" +UNBLOCKED_CSS = "#sapwd_main_window_root_" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(UNBLOCKED_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_text(BLOCKED_TEXT) diff --git a/testing/webcompat/interventions/tests/test_1628455_autotrader_ca.py b/testing/webcompat/interventions/tests/test_1628455_autotrader_ca.py new file mode 100644 index 0000000000..e5fe67d814 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1628455_autotrader_ca.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.autotrader.ca/" +MOBILE_CSS = "#openInApp" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.find_css(MOBILE_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert not client.find_css(MOBILE_CSS) diff --git a/testing/webcompat/interventions/tests/test_1631811_datastudio.py b/testing/webcompat/interventions/tests/test_1631811_datastudio.py new file mode 100644 index 0000000000..2075ee59eb --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1631811_datastudio.py @@ -0,0 +1,21 @@ +import pytest + +URL = "https://ageor.dipot.com/2020/03/Covid-19-in-Greece.html" +FRAME_CSS = "iframe[src^='https://datastudio.google.com/']" +FRAME_TEXT = "Coranavirus SARS-CoV-2 (Covid-19) in Greece" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.load_page_and_wait_for_iframe(URL, client.css(FRAME_CSS)) + assert client.execute_script("return window.indexedDB === undefined;") + success_text = client.await_text(FRAME_TEXT) + assert client.is_displayed(success_text) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.load_page_and_wait_for_iframe(URL, client.css(FRAME_CSS)) + assert client.execute_script("return window.indexedDB !== undefined;") diff --git a/testing/webcompat/interventions/tests/test_1644830_missingmail_usps.py b/testing/webcompat/interventions/tests/test_1644830_missingmail_usps.py new file mode 100644 index 0000000000..39a2db683a --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1644830_missingmail_usps.py @@ -0,0 +1,63 @@ +import pytest + +URL = ( + "https://missingmail.usps.com/?_gl=1*veidlp*_gcl_aw*R0NMLjE1OTE3MjUyNTkuRUF" + "JYUlRb2JDaE1Jd3AzaTBhYjE2UUlWa01EQUNoMlBBUVlrRUFBWUFTQUFFZ0lMeFBEX0J3RQ..*" + "_gcl_dc*R0NMLjE1OTE3MjUyNTkuRUFJYUlRb2JDaE1Jd3AzaTBhYjE2UUlWa01EQUNoMlBBUV" + "lrRUFBWUFTQUFFZ0lMeFBEX0J3RQ..#/" +) + +USERNAME_CSS = "#username" +PASSWORD_CSS = "#password" +SIGN_IN_CSS = "#btn-submit" +TERMS_CHECKBOX_CSS = "#tc-checkbox" +TERMS_FAUX_CHECKBOX_CSS = "#tc-checkbox + .mrc-custom-checkbox" + +# The USPS missing mail website takes a very long time to load (multiple +# minutes). We give them a very generous amount of time here, but will +# give up after that and just skip the rest of the test. +TIMEOUT = 900 +TIMEOUT_MESSAGE = "USPS website is too slow, skipping test" + + +async def are_checkboxes_clickable(client, credentials): + await client.navigate(URL) + + username = client.await_css(USERNAME_CSS) + password = client.find_css(PASSWORD_CSS) + sign_in = client.find_css(SIGN_IN_CSS) + assert client.is_displayed(username) + assert client.is_displayed(password) + assert client.is_displayed(sign_in) + + username.send_keys(credentials["username"]) + password.send_keys(credentials["password"]) + sign_in.click() + + tc = client.await_css(TERMS_CHECKBOX_CSS, timeout=TIMEOUT) + if tc is None: + pytest.skip(TIMEOUT_MESSAGE) + return + + assert not tc.selected + + # we need to simulate a real click on the checkbox + tfc = client.find_css(TERMS_FAUX_CHECKBOX_CSS) + await client.dom_ready() + client.execute_script("arguments[0].scrollIntoView(true)", tfc) + client.mouse.click(tfc).perform() + return tc.selected + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client, credentials): + assert await are_checkboxes_clickable(client, credentials) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client, credentials): + assert not await are_checkboxes_clickable(client, credentials) diff --git a/testing/webcompat/interventions/tests/test_1650317_livescience_com.py b/testing/webcompat/interventions/tests/test_1650317_livescience_com.py new file mode 100644 index 0000000000..f9cb71c571 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1650317_livescience_com.py @@ -0,0 +1,40 @@ +import pytest + +URL = "https://www.livescience.com/" +TEXT_TO_TEST = ".trending__link" + + +async def is_text_visible(client): + # the page does not properly load, so we just time out + # and wait for the element we're interested in to appear + await client.navigate(URL, timeout=1) + link = client.await_css(TEXT_TO_TEST) + assert client.is_displayed(link) + return client.execute_async_script( + """ + const link = arguments[0]; + const cb = arguments[1]; + const fullHeight = link.scrollHeight; + const parentVisibleHeight = link.parentElement.clientHeight; + link.style.paddingBottom = "0"; + window.requestAnimationFrame(() => { + const bottomPaddingHeight = fullHeight - link.scrollHeight; + cb(fullHeight - parentVisibleHeight <= bottomPaddingHeight); + }); + """, + link, + ) + + +@pytest.mark.skip_platforms("android", "mac") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert await is_text_visible(client) + + +@pytest.mark.skip_platforms("android", "mac") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert not await is_text_visible(client) diff --git a/testing/webcompat/interventions/tests/test_1651292_www_jp_square-enix_com.py b/testing/webcompat/interventions/tests/test_1651292_www_jp_square-enix_com.py new file mode 100644 index 0000000000..d8c7844c54 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1651292_www_jp_square-enix_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.jp.square-enix.com/music/sem/page/FF7R/ost/" +ERROR_MSG = 'can\'t access property "slice", e.match(...) is null' +UNBLOCKED_CSS = "h1.logo.visible" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(UNBLOCKED_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL, await_console_message=ERROR_MSG) diff --git a/testing/webcompat/interventions/tests/test_1651917_www_teletrader_com.py b/testing/webcompat/interventions/tests/test_1651917_www_teletrader_com.py new file mode 100644 index 0000000000..deda666ebb --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1651917_www_teletrader_com.py @@ -0,0 +1,27 @@ +import pytest + +URL = "https://www.teletrader.com/" + + +def body_is_offscreen(client): + return client.execute_script( + """ + return document.body.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 not body_is_offscreen(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert body_is_offscreen(client) diff --git a/testing/webcompat/interventions/tests/test_1654877_preev_com.py b/testing/webcompat/interventions/tests/test_1654877_preev_com.py new file mode 100644 index 0000000000..398dd8b6e3 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1654877_preev_com.py @@ -0,0 +1,32 @@ +import pytest + +URL = "http://preev.com/" +INPUT_CSS = "#invField" + + +def no_number_arrows_appear(client): + inp = client.await_css(INPUT_CSS, is_displayed=True) + assert inp + inp.click() + return client.execute_script( + """ + return getComputedStyle(arguments[0]).appearance == "textfield"; + """, + inp, + ) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert no_number_arrows_appear(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert not no_number_arrows_appear(client) diff --git a/testing/webcompat/interventions/tests/test_1654907_reactine_ca.py b/testing/webcompat/interventions/tests/test_1654907_reactine_ca.py new file mode 100644 index 0000000000..6b277db8c0 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1654907_reactine_ca.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.reactine.ca/products/" +BANNER_CSS = "#browser-alert" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(BANNER_CSS, is_displayed=False) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(BANNER_CSS, is_displayed=True) diff --git a/testing/webcompat/interventions/tests/test_1694470_m_myvidster_com.py b/testing/webcompat/interventions/tests/test_1694470_m_myvidster_com.py new file mode 100644 index 0000000000..1daec3fa83 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1694470_m_myvidster_com.py @@ -0,0 +1,31 @@ +import pytest + +URL = "https://m.myvidster.com/" +CONTAINER_CSS = "#home_refresh_var" + + +def content_is_cropped(client): + container = client.await_css(CONTAINER_CSS, is_displayed=True) + assert container + return client.execute_script( + """ + return arguments[0].clientHeight < 100 + """, + container, + ) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert not content_is_cropped(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert content_is_cropped(client) diff --git a/testing/webcompat/interventions/tests/test_1697324_mobile2_bmo_com.py b/testing/webcompat/interventions/tests/test_1697324_mobile2_bmo_com.py new file mode 100644 index 0000000000..72f3e16fa5 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1697324_mobile2_bmo_com.py @@ -0,0 +1,21 @@ +import pytest + +URL = "https://mobile2.bmo.com/" +BLOCKED_TEXT = "This browser is out-of-date" +UNBLOCKED_CSS = "auth-field" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(UNBLOCKED_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_text(BLOCKED_TEXT) diff --git a/testing/webcompat/interventions/tests/test_1704673_app_xiaomi_com.py b/testing/webcompat/interventions/tests/test_1704673_app_xiaomi_com.py new file mode 100644 index 0000000000..229bb1f77e --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1704673_app_xiaomi_com.py @@ -0,0 +1,23 @@ +import pytest + +# This site fails with a redirect loop with a Firefox UA + +URL = "http://app.xiaomi.com/" +REDIR_FAILURE_TEXT = "ERROR_REDIRECT_LOOP" +SUCCESS_CSS = "#J_mingleList" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(SUCCESS_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL, timeout=15) + assert client.find_text(REDIR_FAILURE_TEXT) diff --git a/testing/webcompat/interventions/tests/test_1712807_www_dealnews_com.py b/testing/webcompat/interventions/tests/test_1712807_www_dealnews_com.py new file mode 100644 index 0000000000..d33bc01a76 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1712807_www_dealnews_com.py @@ -0,0 +1,31 @@ +import pytest + +URL = "https://www.dealnews.com/" + + +# The page sets the style.width of images too wide on +# Firefox, making the page wider than the viewport + + +def is_wider_than_window(client): + return client.execute_script( + """ + return document.body.scrollWidth > document.body.clientWidth; + """ + ) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert not is_wider_than_window(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert is_wider_than_window(client) diff --git a/testing/webcompat/interventions/tests/test_1712833_desuca.py b/testing/webcompat/interventions/tests/test_1712833_desuca.py new file mode 100644 index 0000000000..60796fa54f --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1712833_desuca.py @@ -0,0 +1,18 @@ +import pytest + +URL = "https://buskocchi.desuca.co.jp/smartPhone.html" +SCRIPT = "return document.getElementById('map_canvas')?.clientHeight" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.execute_script(SCRIPT) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.execute_script(SCRIPT) diff --git a/testing/webcompat/interventions/tests/test_1719846_covid_cdc_gov.py b/testing/webcompat/interventions/tests/test_1719846_covid_cdc_gov.py new file mode 100644 index 0000000000..253ea6167e --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1719846_covid_cdc_gov.py @@ -0,0 +1,21 @@ +import pytest + +URL = "https://covid.cdc.gov/covid-data-tracker/#pandemic-vulnerability-index" + + +IFRAME_CSS = "#pviIframe" +UNSUPPORTED_TEXT = "not support Internet Explorer" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(IFRAME_CSS) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_text(UNSUPPORTED_TEXT) diff --git a/testing/webcompat/interventions/tests/test_1719859_saxoinvestor.py b/testing/webcompat/interventions/tests/test_1719859_saxoinvestor.py new file mode 100644 index 0000000000..774cc8dbc8 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1719859_saxoinvestor.py @@ -0,0 +1,28 @@ +import pytest + +URL = ( + "https://www.saxoinvestor.fr/login/?adobe_mc=" + "MCORGID%3D173338B35278510F0A490D4C%2540AdobeOrg%7CTS%3D1621688498" +) + + +@pytest.mark.skip_platforms("linux") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + userid = client.find_css("input#field_userid") + password = client.find_css("input#field_password") + submit = client.find_css("input#button_login") + assert client.is_displayed(userid) + assert client.is_displayed(password) + assert client.is_displayed(submit) + + +@pytest.mark.skip_platforms("linux") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + warning = client.find_css("#browser_support_section") + assert client.is_displayed(warning) diff --git a/testing/webcompat/interventions/tests/test_1722954_granbluefantasy_jp.py b/testing/webcompat/interventions/tests/test_1722954_granbluefantasy_jp.py new file mode 100644 index 0000000000..93fdf940b7 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1722954_granbluefantasy_jp.py @@ -0,0 +1,27 @@ +import pytest + +URL = "https://game.granbluefantasy.jp/" + + +def content_is_full_width(client): + return client.execute_script( + """ + return document.querySelector("#wrapper").offsetWidth == document.body.clientWidth; + """ + ) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert content_is_full_width(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert not content_is_full_width(client) diff --git a/testing/webcompat/interventions/tests/test_1722955_frontgate_com.py b/testing/webcompat/interventions/tests/test_1722955_frontgate_com.py new file mode 100644 index 0000000000..6f597c7d3e --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1722955_frontgate_com.py @@ -0,0 +1,23 @@ +import pytest + +URL = "https://www.frontgate.com/resort-cotton-bath-towels/155771" +MOBILE_CSS = "#app" +DESKTOP_CSS = "#cbiBody" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(MOBILE_CSS) + assert not client.find_css(DESKTOP_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(DESKTOP_CSS) + assert not client.find_css(MOBILE_CSS) diff --git a/testing/webcompat/interventions/tests/test_1738317_vmos_cn.py b/testing/webcompat/interventions/tests/test_1738317_vmos_cn.py new file mode 100644 index 0000000000..275b8b453d --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1738317_vmos_cn.py @@ -0,0 +1,23 @@ +import pytest + +URL = "https://www.vmos.cn/" +MOBILE_CSS = ".bg_wave_blue" +DESKTOP_CSS = "#content" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(MOBILE_CSS) + assert not client.find_css(DESKTOP_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(DESKTOP_CSS) + assert not client.find_css(MOBILE_CSS) diff --git a/testing/webcompat/interventions/tests/test_1738319_yebocasino_co_za.py b/testing/webcompat/interventions/tests/test_1738319_yebocasino_co_za.py new file mode 100644 index 0000000000..6b09cbec87 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1738319_yebocasino_co_za.py @@ -0,0 +1,29 @@ +import pytest + +URL = "https://www.yebocasino.co.za/webplay/" +PRACTICE_CSS = "#lobbybox_featuredgames .gamebox .cta.practice" +IFRAME_CSS = "#gameiframe" +UNSUPPORTED_CSS = ".unsupported-device-box" +SUPPORTED_CSS = "#game_main" + + +async def get_to_page(client): + await client.navigate(URL) + client.soft_click(client.await_css(PRACTICE_CSS)) + client.switch_to_frame(client.await_css(IFRAME_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await get_to_page(client) + assert client.await_css(SUPPORTED_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await get_to_page(client) + assert client.await_css(UNSUPPORTED_CSS) diff --git a/testing/webcompat/interventions/tests/test_1741234_alphalabs.py b/testing/webcompat/interventions/tests/test_1741234_alphalabs.py new file mode 100644 index 0000000000..65fd9c06dc --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1741234_alphalabs.py @@ -0,0 +1,35 @@ +import pytest + +URL = "https://patient.alphalabs.ca/Report/CovidReport" + +CONTINUE_CSS = ".btnNormal[type='submit']" +FOOTER_CSS = "footer" + + +async def is_continue_above_footer(client): + await client.navigate(URL) + cont = client.find_css(CONTINUE_CSS) + assert cont + footer = client.find_css(FOOTER_CSS) + assert footer + return client.execute_script( + """ + const cont = arguments[0].getClientRects()[0]; + const footer = arguments[1].getClientRects()[0]; + return cont.bottom < footer.top; + """, + cont, + footer, + ) + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert await is_continue_above_footer(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert not await is_continue_above_footer(client) diff --git a/testing/webcompat/interventions/tests/test_1743627_renrenaud-bray_com.py b/testing/webcompat/interventions/tests/test_1743627_renrenaud-bray_com.py new file mode 100644 index 0000000000..51752b3a04 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1743627_renrenaud-bray_com.py @@ -0,0 +1,25 @@ +import pytest + +URL = "https://www.renaud-bray.com/accueil.aspx" +ERROR_MSG = "ua.split(...)[1] is undefined" +MENU_CSS = "#pageHeader_menuStores" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.execute_script( + """ + return arguments[0].style.zIndex == "7000"; + """, + client.await_css(MENU_CSS), + ) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL, await_console_message=ERROR_MSG) diff --git a/testing/webcompat/interventions/tests/test_1743751_slrclub_com.py b/testing/webcompat/interventions/tests/test_1743751_slrclub_com.py new file mode 100644 index 0000000000..30b52fc98b --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1743751_slrclub_com.py @@ -0,0 +1,23 @@ +import pytest + +URL = "http://www.slrclub.com/" +MOBILE_CSS = "#logo-wrap" +DESKTOP_CSS = "#header" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(MOBILE_CSS) + assert not client.find_css(DESKTOP_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(DESKTOP_CSS) + assert not client.find_css(MOBILE_CSS) diff --git a/testing/webcompat/interventions/tests/test_1743754_workflow_base_vn.py b/testing/webcompat/interventions/tests/test_1743754_workflow_base_vn.py new file mode 100644 index 0000000000..a64c02b227 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1743754_workflow_base_vn.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://workflow.base.vn/todos" +ERROR_MSG = 'can\'t access property "split", a.ua.split(...)[1] is undefined' +SUCCESS_CSS = "#authform" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(SUCCESS_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL, await_console_message=ERROR_MSG) diff --git a/testing/webcompat/interventions/tests/test_1753461_naver.py b/testing/webcompat/interventions/tests/test_1753461_naver.py new file mode 100644 index 0000000000..03266ef415 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1753461_naver.py @@ -0,0 +1,22 @@ +import pytest + +URL = "https://serieson.naver.com/v2/movie/335790?isWebtoonAgreePopUp=true" + +SUPPORTED_CSS = "#playerWrapper" +UNSUPPORTED_CSS = ".end_player_unavailable .download_links" + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(SUPPORTED_CSS) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(UNSUPPORTED_CSS) diff --git a/testing/webcompat/interventions/tests/test_1756872_www_dolcegabbana_com.py b/testing/webcompat/interventions/tests/test_1756872_www_dolcegabbana_com.py new file mode 100644 index 0000000000..648fc83210 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1756872_www_dolcegabbana_com.py @@ -0,0 +1,23 @@ +import pytest + +URL = "https://www.dolcegabbana.com/en/" +FAIL_CSS = "#p-homepage" +SUCCESS_CSS = "#app" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(SUCCESS_CSS) + assert not client.find_css(FAIL_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(FAIL_CSS) + assert not client.find_css(SUCCESS_CSS) diff --git a/testing/webcompat/interventions/tests/test_1765947_veniceincoming_com.py b/testing/webcompat/interventions/tests/test_1765947_veniceincoming_com.py new file mode 100644 index 0000000000..84ad99a3a4 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1765947_veniceincoming_com.py @@ -0,0 +1,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) diff --git a/testing/webcompat/interventions/tests/test_1774490_rainews_it.py b/testing/webcompat/interventions/tests/test_1774490_rainews_it.py new file mode 100644 index 0000000000..042e8965ae --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1774490_rainews_it.py @@ -0,0 +1,34 @@ +import pytest + +URL = ( + "https://www.rainews.it/photogallery/2022/06/fotorassegna-stampa-le-prime" + "-pagine-dei-quotidiani-di-sabato-04-giugno--cd5414b3-65b9-429b-85d5-e53fadd59f4c.html" +) + +PICTURE_CSS = ".swiper-slide picture" +GALLERY_CSS = ".swiper-wrapper" + + +def get_picture_width(client): + return client.execute_script( + f""" + const p = document.querySelector("{PICTURE_CSS}"); + return window.getComputedStyle(p).width; + """ + ) + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + client.await_css(GALLERY_CSS) + assert "0px" != get_picture_width(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + client.await_css(GALLERY_CSS) + assert "0px" == get_picture_width(client) diff --git a/testing/webcompat/interventions/tests/test_1776897_www_edencast_fr.py b/testing/webcompat/interventions/tests/test_1776897_www_edencast_fr.py new file mode 100644 index 0000000000..4823aa0c39 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1776897_www_edencast_fr.py @@ -0,0 +1,59 @@ +import pytest + +# The page will asyncronously write out an <audio> element on success, but +# will not do anything easily detectable otherwise. +# +# The problem is that the podPressShowHidePlayer function thinks to write +# out a Flash embed unless WebKit is in the UA string, but ends up doing +# nothing at all. However, it calls a different function for html5 vs SWF, +# and we can detect which one it calls to confirm it calls the html5 one. + +URL = "https://www.edencast.fr/zoomcastlost-in-blindness/" + +AUDIO_CSS = "audio#podpresshtml5_1" + +SCRIPT = """ + var done = arguments[0]; + + if (!window?.podPressShowHidePlayer) { + done("none"); + } + + window.podPressenprintHTML5audio = function() { + done("html5"); + }; + + window.podpress_audioplayer_swfobject = { + embedSWF: function() { + done("swf"); + }, + }; + + const d = document.createElement("div"); + d.id = "podPressPlayerSpace_test"; + document.documentElement.appendChild(d); + + const p = document.createElement("div"); + p.id = "podPressPlayerSpace_test_PlayLink"; + document.documentElement.appendChild(p); + + podPressShowHidePlayer("test", "https//x/test.mp3", 100, 100, "force"); + """ + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + await client.dom_ready() + assert "html5" == client.execute_async_script(SCRIPT) + assert client.find_css(AUDIO_CSS) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + await client.dom_ready() + assert "swf" == client.execute_async_script(SCRIPT) + assert not client.find_css(AUDIO_CSS) diff --git a/testing/webcompat/interventions/tests/test_1778168_watch_antennaplus_gr.py b/testing/webcompat/interventions/tests/test_1778168_watch_antennaplus_gr.py new file mode 100644 index 0000000000..ab145fe21d --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1778168_watch_antennaplus_gr.py @@ -0,0 +1,22 @@ +import pytest + +URL = ( + "https://watch.antennaplus.gr/#/shows/agries_melisses/seasons/" + "3/episode/agries_melisses_S03_E137_v1" +) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(".login-pf-page") + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(".ua-barrier") diff --git a/testing/webcompat/interventions/tests/test_1784141_acuvue_com.py b/testing/webcompat/interventions/tests/test_1784141_acuvue_com.py new file mode 100644 index 0000000000..9d61591576 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784141_acuvue_com.py @@ -0,0 +1,22 @@ +import pytest + +URL = "https://www.acuvue.com/" +UNSUPPORTED_CSS = "#browser-alert" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784141_aveeno_com.py b/testing/webcompat/interventions/tests/test_1784141_aveeno_com.py new file mode 100644 index 0000000000..fe787cd044 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784141_aveeno_com.py @@ -0,0 +1,22 @@ +import pytest + +URL = "https://www.aveeno.com/products/calm-restore-oat-gel-moisturizer-for-sensitive-skin" +UNSUPPORTED_CSS = "#browser-alert" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784199_aptsovation_com.py b/testing/webcompat/interventions/tests/test_1784199_aptsovation_com.py new file mode 100644 index 0000000000..a7f22edac0 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784199_aptsovation_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.aptsovation.com/" +UNSUPPORTED_CSS = "[aria-label='Your browser is not supported']" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784199_avanabayview_com.py b/testing/webcompat/interventions/tests/test_1784199_avanabayview_com.py new file mode 100644 index 0000000000..17ab789bee --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784199_avanabayview_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.avanabayview.com/" +UNSUPPORTED_CSS = "[aria-label='Your browser is not supported']" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784199_breakpointeandcoronado_com.py b/testing/webcompat/interventions/tests/test_1784199_breakpointeandcoronado_com.py new file mode 100644 index 0000000000..3af30def4a --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784199_breakpointeandcoronado_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.breakpointeandcoronado.com/" +UNSUPPORTED_CSS = "[aria-label='Your browser is not supported']" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784199_entrata_platform.py b/testing/webcompat/interventions/tests/test_1784199_entrata_platform.py new file mode 100644 index 0000000000..d10776d5fd --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784199_entrata_platform.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.liveobserverpark.com/" +UNSUPPORTED_BANNER = ".banner_overlay" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported_banner = client.await_css(UNSUPPORTED_BANNER) + assert not client.is_displayed(unsupported_banner) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported_banner = client.await_css(UNSUPPORTED_BANNER) + assert client.is_displayed(unsupported_banner) diff --git a/testing/webcompat/interventions/tests/test_1784199_liveatlasathens_com.py b/testing/webcompat/interventions/tests/test_1784199_liveatlasathens_com.py new file mode 100644 index 0000000000..37b5f0cf4a --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784199_liveatlasathens_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.liveatlasathens.com/" +UNSUPPORTED_CSS = "[aria-label='Your browser is not supported']" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784199_liveobserverpark_com.py b/testing/webcompat/interventions/tests/test_1784199_liveobserverpark_com.py new file mode 100644 index 0000000000..ffc6b2d702 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784199_liveobserverpark_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.liveobserverpark.com/" +UNSUPPORTED_CSS = "[aria-label='Your browser is not supported']" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784199_midwayurban_com.py b/testing/webcompat/interventions/tests/test_1784199_midwayurban_com.py new file mode 100644 index 0000000000..2c90d9468e --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784199_midwayurban_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.midwayurban.com/" +UNSUPPORTED_CSS = "[aria-label='Your browser is not supported']" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784199_nhcalaska_com.py b/testing/webcompat/interventions/tests/test_1784199_nhcalaska_com.py new file mode 100644 index 0000000000..37ebce9be0 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784199_nhcalaska_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.nhcalaska.com/" +UNSUPPORTED_CSS = "[aria-label='Your browser is not supported']" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784199_securityproperties_com.py b/testing/webcompat/interventions/tests/test_1784199_securityproperties_com.py new file mode 100644 index 0000000000..bb7840ec66 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784199_securityproperties_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.securityproperties.com/thornton/reserve-at-thornton-i-ii-apartments" +UNSUPPORTED_CSS = "[aria-label='Your browser is not supported']" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784199_theloftsorlando_com.py b/testing/webcompat/interventions/tests/test_1784199_theloftsorlando_com.py new file mode 100644 index 0000000000..6aea9fd25c --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784199_theloftsorlando_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.theloftsorlando.com/" +UNSUPPORTED_CSS = "[aria-label='Your browser is not supported']" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784199_thepointeatcentral_prospectportal_com.py b/testing/webcompat/interventions/tests/test_1784199_thepointeatcentral_prospectportal_com.py new file mode 100644 index 0000000000..50ec397f75 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784199_thepointeatcentral_prospectportal_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://thepointeatcentral.prospectportal.com/Apartments/module/application_authentication?_ga=2.250831814.1585158328.1588776830-1793033216.1588776830" +UNSUPPORTED_CSS = "[aria-label='Your browser is not supported']" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784199_vanallenapartments_com.py b/testing/webcompat/interventions/tests/test_1784199_vanallenapartments_com.py new file mode 100644 index 0000000000..aff3d7d3ad --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784199_vanallenapartments_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://www.vanallenapartments.com/" +UNSUPPORTED_CSS = "[aria-label='Your browser is not supported']" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert not client.is_displayed(unsupported) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + unsupported = client.await_css(UNSUPPORTED_CSS) + assert client.is_displayed(unsupported) diff --git a/testing/webcompat/interventions/tests/test_1784302_open_toutiao_com.py b/testing/webcompat/interventions/tests/test_1784302_open_toutiao_com.py new file mode 100644 index 0000000000..bcb8b0b4e8 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784302_open_toutiao_com.py @@ -0,0 +1,20 @@ +import pytest + +URL = "https://open.toutiao.com/a6966170645738783269/?__publisher_id__=4221768740&channel_id=88805669586&dt=R7Plusm&fr=normal&from_gid=6956432767005491719&gy=2cb247169b873bc0f78107b5a569f282d129ede38a56330ac9edc00743af6ba6f301248cddcb5b2376b2b286f219a9938e69c1c33941e7892a56b16c8617ebb0b1cd50cb401ece07ea7107a158f0b3b0cb95539be68ebda39413081f8dfe1d7ef83abb830d081642aa72639dc2c3e34109c846be7df23727854e76248ce909576f29134ee85086a27255c0745783a0b2f39d213d1a0ee09adb787da51569e05f525c3ad201d6638c&item_id=6966170645738783269&label=related_news&oppo_anchor=&react_gray=1&req_id=2021070203235101015120108107B22076&utm_campaign=open&utm_medium=webview&utm_source=o_llq_api" +API_MISSING_MSG = "navigator.connection is undefined" +GOOD_CSS = "#pageletArticleContent" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(GOOD_CSS, is_displayed=True) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL, await_console_message=API_MISSING_MSG) diff --git a/testing/webcompat/interventions/tests/test_1784361_coldwellbankerhomes_com.py b/testing/webcompat/interventions/tests/test_1784361_coldwellbankerhomes_com.py new file mode 100644 index 0000000000..32892b2087 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1784361_coldwellbankerhomes_com.py @@ -0,0 +1,23 @@ +import pytest + +# The gallery on this page only sets img[src] to a non-1x1-spacer if the error +# doesn't happen during page load, which doesn't happen with a Chrome UA. + +URL = "https://www.coldwellbankerhomes.com/ri/little-compton/kvc-17_1,17_2/" +ERROR_MSG = 'can\'t access property "dataset", v[0] is undefined' +SUCCESS_CSS = "img.psr-lazy:not([src*='spacer'])" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(SUCCESS_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL, await_console_message=ERROR_MSG) diff --git a/testing/webcompat/interventions/tests/test_1786404_business_help_royalmail_com.py b/testing/webcompat/interventions/tests/test_1786404_business_help_royalmail_com.py new file mode 100644 index 0000000000..01ca2ddcc2 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1786404_business_help_royalmail_com.py @@ -0,0 +1,46 @@ +import pytest + +URL = "https://business.help.royalmail.com/app/webforms/stampsenquiries" + +COOKIES_ACCEPT_CSS = "#consent_prompt_submit" +POSTCODE_CSS = "input[name='rn_AddressControl_16textbox']" +OPTION_CSS = "option.addr_pick_line:not(:disabled)" +ADDY1_CSS = "[name='Incident.CustomFields.c.address1_1']" + + +async def getResult(client): + await client.navigate(URL) + client.await_css(COOKIES_ACCEPT_CSS).click() + client.execute_script( + f""" + const proto = EventTarget.prototype; + const def = Object.getOwnPropertyDescriptor(proto, "addEventListener"); + const old = def.value; + def.value = function(type) {{ + if (type === "click" && this?.matches("{OPTION_CSS}")) {{ + window.__expectedListenerAdded = true; + }} + }}; + Object.defineProperty(proto, "addEventListener", def); + """ + ) + + client.await_css(POSTCODE_CSS).send_keys("W1A 1AV") + client.await_css(OPTION_CSS) + return client.execute_script( + """ + return Boolean(window.__expectedListenerAdded); + """ + ) + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert await getResult(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert not await getResult(client) diff --git a/testing/webcompat/interventions/tests/test_1793761_schoolnutritionandfitness_com.py b/testing/webcompat/interventions/tests/test_1793761_schoolnutritionandfitness_com.py new file mode 100644 index 0000000000..9bb0be584c --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1793761_schoolnutritionandfitness_com.py @@ -0,0 +1,32 @@ +import pytest + +URL = "https://www.schoolnutritionandfitness.com/webmenus2/#/view?id=6331c49ce96f1e9c468b45be&siteCode=1641" +ELEM_CSS = "react-app td > div" +HEIGHT_CUTOFF = 10 + + +def get_elem_height(client): + elem = client.await_css(ELEM_CSS, is_displayed=True) + assert elem + return client.execute_script( + """ + return arguments[0].getBoundingClientRect().height; + """, + elem, + ) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert get_elem_height(client) > HEIGHT_CUTOFF + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert get_elem_height(client) < HEIGHT_CUTOFF diff --git a/testing/webcompat/interventions/tests/test_1795490_www_china-airlines_com.py b/testing/webcompat/interventions/tests/test_1795490_www_china-airlines_com.py new file mode 100644 index 0000000000..8a38a633a4 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1795490_www_china-airlines_com.py @@ -0,0 +1,25 @@ +import pytest + +URL = "https://www.china-airlines.com/tw/en/booking/book-flights/flight-search?lang=en-us&deptstn=TPE&arrstn=LAX" +DATE_CSS = "#departureDateMobile" +DATE_DISABLED_CSS = "#departureDateMobile[disabled]" + + +async def check_date_disabled(client): + await client.navigate(URL) + client.await_css(DATE_CSS) + return client.find_css(DATE_DISABLED_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await check_date_disabled(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await check_date_disabled(client) diff --git a/testing/webcompat/interventions/tests/test_1797400_mobilevikings_be.py b/testing/webcompat/interventions/tests/test_1797400_mobilevikings_be.py new file mode 100644 index 0000000000..c3575b9735 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1797400_mobilevikings_be.py @@ -0,0 +1,31 @@ +import pytest +from webdriver.error import NoSuchElementException + +URL = "https://mobilevikings.be/en/registration/?product_id=155536813-1-1" +COOKIES_CSS = "#btn-accept-cookies" +DATE_CSS = "input.date-input[name='birth_date']" + + +async def date_after_typing(client): + await client.navigate(URL) + try: + client.await_css(COOKIES_CSS, timeout=3).click() + client.await_element_hidden(client.css(COOKIES_CSS)) + except NoSuchElementException: + pass + date = client.await_css(DATE_CSS) + client.scroll_into_view(date) + date.send_keys("1") + return date.property("value") + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert "1_/__/____" == await date_after_typing(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert "__/__/____" == await date_after_typing(client) diff --git a/testing/webcompat/interventions/tests/test_1799968_samsung_com.py b/testing/webcompat/interventions/tests/test_1799968_samsung_com.py new file mode 100644 index 0000000000..4b4fc408aa --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1799968_samsung_com.py @@ -0,0 +1,21 @@ +import pytest + +URL = "https://www.samsung.com/in/watches/galaxy-watch/galaxy-watch5-44mm-graphite-bluetooth-sm-r910nzaainu/" +GOOD_CSS = "html.linux.firefox" +ERROR_MSG = "DOMTokenList.add: The empty string is not a valid token." + + +@pytest.mark.only_platforms("linux") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(GOOD_CSS) + + +@pytest.mark.only_platforms("linux") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL, await_console_message=ERROR_MSG) + assert not client.find_css(GOOD_CSS) diff --git a/testing/webcompat/interventions/tests/test_1799994_vivobarefoot_com.py b/testing/webcompat/interventions/tests/test_1799994_vivobarefoot_com.py new file mode 100644 index 0000000000..5b3713ce30 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1799994_vivobarefoot_com.py @@ -0,0 +1,45 @@ +import pytest +from webdriver.error import NoSuchElementException + +URL = "https://www.vivobarefoot.com/eu/mens" +FILTER_CSS = "#narrow-by-list .filter-wrapper:last-of-type" +SUBMENU_CSS = "#narrow-by-list .filter-wrapper:last-of-type dd" +POPUP1_CSS = "#globalePopupWrapper" +POPUP2_CSS = "#globale_overlay" +POPUP3_CSS = ".weblayer--box-subscription-1" + + +async def check_filter_opens(client): + await client.navigate(URL) + + popup = client.await_css(POPUP1_CSS, timeout=3) + if popup: + client.remove_element(popup) + popup = client.find_css(POPUP2_CSS) + if popup: + client.remove_element(popup) + popup = client.find_css(POPUP3_CSS) + if popup: + client.remove_element(popup) + + filter = client.await_css(FILTER_CSS) + client.mouse.click(element=filter).perform() + try: + client.await_css(SUBMENU_CSS, is_displayed=True, timeout=3) + except NoSuchElementException: + return False + return True + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert await check_filter_opens(client) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert not await check_filter_opens(client) diff --git a/testing/webcompat/interventions/tests/test_1800000_www_honda_co_uk.py b/testing/webcompat/interventions/tests/test_1800000_www_honda_co_uk.py new file mode 100644 index 0000000000..70f968dc1d --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1800000_www_honda_co_uk.py @@ -0,0 +1,50 @@ +import pytest +from webdriver.error import NoSuchElementException + +URL = "https://www.honda.co.uk/cars/book-a-service.html#search?query=tf33bu" +COOKIES_CSS = "#onetrust-accept-btn-handler" +CHOOSE_DEALER_CSS = "a[data-analytics-template*='Make a booking']" +BOOK_ONLINE_CSS = "select#requiredService" +SITE_DOWN_CSS = ".no-results" + + +async def check_choose_dealer_works(client): + await client.navigate(URL) + + cookies = client.css(COOKIES_CSS) + client.await_element(cookies).click() + client.await_element_hidden(cookies) + + down, dealer = client.await_first_element_of( + [ + client.css(SITE_DOWN_CSS), + client.css(CHOOSE_DEALER_CSS), + ], + timeout=5, + ) + + if down: + pytest.skip("Service is down right now, so testing is impossible") + return True + + client.scroll_into_view(dealer) + client.mouse.click(element=dealer).perform() + try: + client.await_css(BOOK_ONLINE_CSS, is_displayed=True, timeout=3) + except NoSuchElementException: + return False + return True + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert await check_choose_dealer_works(client) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert not await check_choose_dealer_works(client) diff --git a/testing/webcompat/interventions/tests/test_1800241_mms_telekom_de.py b/testing/webcompat/interventions/tests/test_1800241_mms_telekom_de.py new file mode 100644 index 0000000000..37778ea804 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1800241_mms_telekom_de.py @@ -0,0 +1,19 @@ +import pytest + +URL = "https://www.mms.telekom.de/OTP/" +LOGIN_CSS = ".LoginbackgroundDiv" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + login_element = client.await_css(LOGIN_CSS) + assert client.is_displayed(login_element) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert not client.find_css(LOGIN_CSS) diff --git a/testing/webcompat/interventions/tests/test_1800936_cov19ent_kdca_go_kr.py b/testing/webcompat/interventions/tests/test_1800936_cov19ent_kdca_go_kr.py new file mode 100644 index 0000000000..e0384a8641 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1800936_cov19ent_kdca_go_kr.py @@ -0,0 +1,26 @@ +import pytest + +URL = "https://cov19ent.kdca.go.kr/" +HEADER_CSS = "header.mouseOn" + + +async def get_header_position(client): + await client.navigate(URL) + return client.execute_script( + f""" + const r = document.querySelector("{HEADER_CSS}"); + return window.getComputedStyle(r).position; + """ + ) + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert "absolute" == await get_header_position(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert "absolute" != await get_header_position(client) diff --git a/testing/webcompat/interventions/tests/test_1803131_www_argaam_com.py b/testing/webcompat/interventions/tests/test_1803131_www_argaam_com.py new file mode 100644 index 0000000000..c5a3782768 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1803131_www_argaam_com.py @@ -0,0 +1,23 @@ +import pytest + +URL = "https://www.argaam.com/" +MOBILE_CSS = ".mobile-data-container" +DESKTOP_CSS = ".ticker_box" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(MOBILE_CSS) + assert not client.find_css(DESKTOP_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(DESKTOP_CSS) + assert not client.find_css(MOBILE_CSS) diff --git a/testing/webcompat/interventions/tests/test_1803976_youtube_com.py b/testing/webcompat/interventions/tests/test_1803976_youtube_com.py new file mode 100644 index 0000000000..16fc66231a --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1803976_youtube_com.py @@ -0,0 +1,62 @@ +import time + +import pytest + +URL = "https://www.youtube.com/" +SEARCH_TERM = "movies" + +SEARCH_FIELD_CSS = "input[type='text'][id*='search']" +SEARCH_BUTTON_CSS = "#search-icon-legacy" +FILTER_BAR_CSS = "#filter-menu" +PERF_NOW_CONSTANT = 11111 + + +def change_performance_now(client): + return client.execute_script( + """ + const PERF_NOW = arguments[0]; + Object.defineProperty(window.performance, "now", { + value: () => PERF_NOW, + }, PERF_NOW_CONSTANT); + """ + ) + + +async def search_for_term(client): + await client.navigate(URL) + search = client.await_css(SEARCH_FIELD_CSS) + button = client.find_css(SEARCH_BUTTON_CSS) + + assert client.is_displayed(search) + assert client.is_displayed(button) + + search.send_keys(SEARCH_TERM) + time.sleep(1) + button.click() + time.sleep(2) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await search_for_term(client) + filter_bar = client.await_css(FILTER_BAR_CSS) + + client.back() + + assert not client.is_displayed(filter_bar) + + +@pytest.mark.skip(reason="results are intermittent, so skipping this test for now") +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + change_performance_now(client) + await search_for_term(client) + + client.back() + + filter_bar = client.await_css(FILTER_BAR_CSS) + assert client.is_displayed(filter_bar) diff --git a/testing/webcompat/interventions/tests/test_1811325_inmac_wstore_com.py b/testing/webcompat/interventions/tests/test_1811325_inmac_wstore_com.py new file mode 100644 index 0000000000..392be13b39 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1811325_inmac_wstore_com.py @@ -0,0 +1,43 @@ +import pytest + +URL = "https://www.inmac-wstore.com" +SITE_CSS = ".desktopDevice" +IFRAME_CSS = "iframe[src^='https://geo.captcha-delivery.com/']" +BLOCKED_CSS = ".captcha__human" +NOT_A_ROBOT_TEXT = ( + "We want to make sure it is actually you we are dealing with and not a robot." +) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + + frame = client.find_css(IFRAME_CSS) + if frame: + client.switch_frame(frame) + + blocked, loaded = client.await_first_element_of( + [ + client.text(NOT_A_ROBOT_TEXT), + client.css(SITE_CSS), + ] + ) + + if blocked: + pytest.skip("Site using a captcha, can't proceed with test.") + return + + assert client.is_displayed(loaded) + + +@pytest.mark.skip_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + frame = client.find_css(IFRAME_CSS) + client.switch_frame(frame) + assert client.await_css(BLOCKED_CSS) diff --git a/testing/webcompat/interventions/tests/test_1817520_ersthelfer_tv.py b/testing/webcompat/interventions/tests/test_1817520_ersthelfer_tv.py new file mode 100644 index 0000000000..e8addbeb68 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1817520_ersthelfer_tv.py @@ -0,0 +1,36 @@ +import pytest + +URL = "https://book.ersthelfer.tv/" +DATE = "12.12.2020" +PLACEHOLDER = "__.__.____" + +CITY_CSS = "#city_id" +PERSON_CSS = "#no_of_person" +CITY_OPTION_XPATH = "//select[@name='city_id']/option[2]" +PERSON_OPTION_XPATH = "//select[@name='no_of_person']/option[2]" +DATE_PICKER_CSS = "[class*='date-picker-custom-wrapper'] input" + + +async def set_date(client): + client.await_css(CITY_CSS).click() + client.await_xpath(CITY_OPTION_XPATH).click() + + client.await_css(PERSON_CSS).click() + client.await_xpath(PERSON_OPTION_XPATH).click() + date_input = client.await_css(DATE_PICKER_CSS, is_displayed=True) + date_input.send_keys(DATE) + return date_input.property("value") + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert DATE == await set_date(client) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert PLACEHOLDER == await set_date(client) diff --git a/testing/webcompat/interventions/tests/test_1818818_marksandspencer_com.py b/testing/webcompat/interventions/tests/test_1818818_marksandspencer_com.py new file mode 100644 index 0000000000..ff5de87e50 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1818818_marksandspencer_com.py @@ -0,0 +1,33 @@ +import pytest +from webdriver.error import NoSuchElementException + +URL = ( + "https://www.marksandspencer.com/webapp/wcs/stores/servlet/GenericApplicationError" +) +COOKIES_CSS = "button.navigation-cookiebbanner__submit" +SELECT_CSS = "#progressiveHeaderSection button.navigation-hamburger-trigger" + + +async def is_fastclick_active(client): + await client.navigate(URL) + try: + client.await_css(COOKIES_CSS, timeout=3).click() + client.await_element_hidden(client.css(COOKIES_CSS)) + except NoSuchElementException: + pass + + return client.test_for_fastclick(client.await_css(SELECT_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_fastclick_active(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_fastclick_active(client) diff --git a/testing/webcompat/interventions/tests/test_1818818_wellcare_com.py b/testing/webcompat/interventions/tests/test_1818818_wellcare_com.py new file mode 100644 index 0000000000..7241f5631b --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1818818_wellcare_com.py @@ -0,0 +1,26 @@ +import pytest + +URL = "https://www.wellcare.com/en/Oregon/Members/Prescription-Drug-Plans-2023/Wellcare-Value-Script" +MENU_CSS = "a[title='login DDL']" +SELECT_CSS = "select#userSelect" + + +async def is_fastclick_active(client): + await client.navigate(URL) + menu = client.await_css(MENU_CSS) + menu.click() + return client.test_for_fastclick(client.await_css(SELECT_CSS)) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + assert not await is_fastclick_active(client) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + assert await is_fastclick_active(client) diff --git a/testing/webcompat/interventions/tests/test_1819450_cmbchina_com.py b/testing/webcompat/interventions/tests/test_1819450_cmbchina_com.py new file mode 100644 index 0000000000..c711596114 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1819450_cmbchina_com.py @@ -0,0 +1,21 @@ +import pytest + +URL = "https://www.cmbchina.com/" +DESKTOP_CSS = "#aspnetForm" +MOBILE_CSS = "#app .mobile-header" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(MOBILE_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(DESKTOP_CSS) diff --git a/testing/webcompat/interventions/tests/test_1819476_axis_bank.py b/testing/webcompat/interventions/tests/test_1819476_axis_bank.py new file mode 100644 index 0000000000..fe7ff20cea --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1819476_axis_bank.py @@ -0,0 +1,19 @@ +import pytest + +URL = "https://www.axisbank.com/retail/cards/credit-card" +TARGET_CSS = ".loanBox" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + loan_element = client.await_css(TARGET_CSS) + assert client.is_displayed(loan_element) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert not client.find_css(TARGET_CSS) diff --git a/testing/webcompat/interventions/tests/test_1819476_axisbank_com.py b/testing/webcompat/interventions/tests/test_1819476_axisbank_com.py new file mode 100644 index 0000000000..ee5d64a1d0 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1819476_axisbank_com.py @@ -0,0 +1,18 @@ +import pytest + +URL = "https://www.axisbank.com/retail/cards/credit-card" +SITE_CSS = "#ulCreditCard:not(:empty)" +ERROR_MSG = "webkitSpeechRecognition is not defined" + + +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(SITE_CSS) + + +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL, await_console_message=ERROR_MSG) diff --git a/testing/webcompat/interventions/tests/test_1819702_feelgoodcontacts_com.py b/testing/webcompat/interventions/tests/test_1819702_feelgoodcontacts_com.py new file mode 100644 index 0000000000..039e08cadc --- /dev/null +++ b/testing/webcompat/interventions/tests/test_1819702_feelgoodcontacts_com.py @@ -0,0 +1,21 @@ +import pytest + +URL = "https://feelgoodcontacts.com/" +MOBILE_CSS = "#aHomeMob" +DESKTOP_CSS = "#mmenu" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(MOBILE_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(DESKTOP_CSS) diff --git a/testing/webcompat/interventions/tests/test_969844_mobile_de.py b/testing/webcompat/interventions/tests/test_969844_mobile_de.py new file mode 100644 index 0000000000..a3fc63b723 --- /dev/null +++ b/testing/webcompat/interventions/tests/test_969844_mobile_de.py @@ -0,0 +1,25 @@ +import pytest + +# The site serves a different mobile page to Firefox than Chrome + +URL = "https://www.mobile.de/" +MOBILE_CSS = "header [data-testid='header-burger-menu']" +DESKTOP_CSS = "header [data-testid='header-mobile-small-screen']" + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.with_interventions +async def test_enabled(client): + await client.navigate(URL) + assert client.await_css(MOBILE_CSS) + assert not client.find_css(DESKTOP_CSS) + + +@pytest.mark.only_platforms("android") +@pytest.mark.asyncio +@pytest.mark.without_interventions +async def test_disabled(client): + await client.navigate(URL) + assert client.await_css(DESKTOP_CSS) + assert not client.find_css(MOBILE_CSS) |