зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1802563 - Remove obsolete webcompat intervention tests, fix others, and add some new ones; r=ksenia DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D163140
This commit is contained in:
Родитель
7671a9d5a4
Коммит
469224c6a9
|
@ -1,6 +1,6 @@
|
|||
[pytest]
|
||||
console_output_style = classic
|
||||
markers =
|
||||
skip_platforms: skip tests on specific platforms
|
||||
skip_platforms: skip tests on specific platforms (mac, linux, windows)
|
||||
with_interventions: enable web-compat interventions
|
||||
without_interventions: disable web-compat interventions
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import time
|
||||
|
||||
import pytest
|
||||
from helpers import Css, await_element, find_element
|
||||
|
||||
URL = "https://www.bankofamerica.com/"
|
||||
|
||||
|
||||
@pytest.mark.skip_platforms("windows")
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
session.get(URL)
|
||||
|
@ -12,6 +14,7 @@ def test_enabled(session):
|
|||
assert find_element(session, Css("#browserUpgradeNoticeBar"), default=None) is None
|
||||
|
||||
|
||||
@pytest.mark.skip_platforms("windows")
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
session.get(URL)
|
||||
|
|
|
@ -3,22 +3,24 @@ from helpers import (
|
|||
Css,
|
||||
Text,
|
||||
Xpath,
|
||||
assert_not_element,
|
||||
await_element,
|
||||
await_first_element_of,
|
||||
await_getUserMedia_call_on_click,
|
||||
find_element,
|
||||
assert_not_element,
|
||||
)
|
||||
|
||||
|
||||
URL = "https://steamcommunity.com/chat"
|
||||
|
||||
|
||||
USERID_CSS = Css("input#input_username")
|
||||
PASSWORD_CSS = Css("input#input_password")
|
||||
SIGNIN_CSS = Css("#login_btn_signin button")
|
||||
GEAR_CSS = Css(".friendSettingsButton")
|
||||
AUTH_CSS = Css("input#authcode")
|
||||
USERID_CSS = Css("input[type='text'][class*='newlogindialog']")
|
||||
PASSWORD_CSS = Css("input[type='password'][class*='newlogindialog']")
|
||||
SIGNIN_CSS = Css("button[type='submit'][class*='newlogindialog']")
|
||||
GEAR_CSS = Css(".friendListButton")
|
||||
LOGIN_FAIL_XPATH = Xpath(
|
||||
"//*[contains(text(), 'try again') and " "contains(@class, 'FormError')]"
|
||||
)
|
||||
AUTH_CSS = Css("[class*='newlogindialog_ProtectingAccount']")
|
||||
RATE_TEXT = Text("too many login failures")
|
||||
VOICE_XPATH = Xpath(
|
||||
"//*[contains(text(), 'Voice') and "
|
||||
|
@ -31,7 +33,7 @@ UNSUPPORTED_TEXT = Text("currently unsupported in Firefox")
|
|||
def load_mic_test(session, credentials):
|
||||
session.get(URL)
|
||||
|
||||
userid = find_element(session, USERID_CSS)
|
||||
userid = await_element(session, USERID_CSS)
|
||||
password = find_element(session, PASSWORD_CSS)
|
||||
submit = find_element(session, SIGNIN_CSS)
|
||||
assert userid.is_displayed()
|
||||
|
@ -43,8 +45,11 @@ def load_mic_test(session, credentials):
|
|||
submit.click()
|
||||
|
||||
while True:
|
||||
[gear, auth, rate] = await_first_element_of(
|
||||
session, [GEAR_CSS, AUTH_CSS, RATE_TEXT], is_displayed=True, timeout=20
|
||||
[gear, fail, auth, rate] = await_first_element_of(
|
||||
session,
|
||||
[GEAR_CSS, LOGIN_FAIL_XPATH, AUTH_CSS, RATE_TEXT],
|
||||
is_displayed=True,
|
||||
timeout=20,
|
||||
)
|
||||
if rate:
|
||||
pytest.skip(
|
||||
|
@ -54,6 +59,9 @@ def load_mic_test(session, credentials):
|
|||
elif auth:
|
||||
pytest.skip("Two-factor authentication requested; disable Steam Guard.")
|
||||
return None
|
||||
elif fail:
|
||||
pytest.skip("Invalid login provided.")
|
||||
return None
|
||||
else:
|
||||
break
|
||||
assert gear
|
||||
|
|
|
@ -3,17 +3,18 @@ from helpers import Css, Text, await_first_element_of
|
|||
|
||||
URL = "https://www.directv.com.co/"
|
||||
INCOMPATIBLE_CSS = Css(".browser-compatible.compatible.incompatible")
|
||||
BLOCKED_TEXT = Text("request was blocked by the security rules")
|
||||
DENIED_TEXT = Text("not available in your region")
|
||||
|
||||
|
||||
def check_unsupported_visibility(session, should_show):
|
||||
session.get(URL)
|
||||
|
||||
[denied, incompatible] = await_first_element_of(
|
||||
session, [DENIED_TEXT, INCOMPATIBLE_CSS]
|
||||
[denied, blocked, incompatible] = await_first_element_of(
|
||||
session, [DENIED_TEXT, BLOCKED_TEXT, INCOMPATIBLE_CSS]
|
||||
)
|
||||
|
||||
if denied:
|
||||
if denied or blocked:
|
||||
pytest.skip("Region-locked, cannot test. Try using a VPN set to USA.")
|
||||
return
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ TIMEOUT_MESSAGE = "USPS website is too slow, skipping test"
|
|||
def are_checkboxes_clickable(session, credentials):
|
||||
session.get(URL)
|
||||
|
||||
username = find_element(session, USERNAME_CSS)
|
||||
username = await_element(session, USERNAME_CSS)
|
||||
password = find_element(session, PASSWORD_CSS)
|
||||
sign_in = find_element(session, SIGN_IN_CSS)
|
||||
assert username.is_displayed()
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
import pytest
|
||||
from helpers import Css, await_element
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
|
||||
URL = "https://www.livescience.com/"
|
||||
TEXT_TO_TEST = ".trending__link"
|
||||
|
||||
|
||||
def is_text_visible(session):
|
||||
# the page does not properly load, so we just time out
|
||||
# and wait for the element we're interested in to appear
|
||||
session.set_page_load_timeout(1)
|
||||
try:
|
||||
session.get(URL)
|
||||
except TimeoutException:
|
||||
pass
|
||||
assert await_element(session, Css(TEXT_TO_TEST))
|
||||
return session.execute_async_script(
|
||||
f"""
|
||||
const cb = arguments[0];
|
||||
const link = document.querySelector("{TEXT_TO_TEST}");
|
||||
const fullHeight = link.scrollHeight;
|
||||
const parentVisibleHeight = link.parentElement.clientHeight;
|
||||
link.style.paddingBottom = "0";
|
||||
window.requestAnimationFrame(() => {{
|
||||
const bottomPaddingHeight = fullHeight - link.scrollHeight;
|
||||
cb(fullHeight - parentVisibleHeight <= bottomPaddingHeight);
|
||||
}});
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.skip_platforms("mac")
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
assert is_text_visible(session)
|
||||
|
||||
|
||||
@pytest.mark.skip_platforms("mac")
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
assert not is_text_visible(session)
|
|
@ -1,45 +0,0 @@
|
|||
import pytest
|
||||
from helpers import Css, await_element
|
||||
|
||||
|
||||
URL = (
|
||||
"https://www.zillow.com/homes/for_sale/Castle-Rock,-CO_rb/?"
|
||||
"searchQueryState=%7B%22pagination%22%3A%7B%7D%2C%22usersSearchTerm"
|
||||
"%22%3A%22Castle%20Rock%2C%20CO%22%2C%22mapBounds%22%3A%7B%22west"
|
||||
"%22%3A-104.89113437569046%2C%22east%22%3A-104.88703327810668%2C%22"
|
||||
"south%22%3A39.396847440697016%2C%22north%22%3A39.39931394177977"
|
||||
"%7D%2C%22regionSelection%22%3A%5B%7B%22regionId%22%3A23984%2C%22"
|
||||
"regionType%22%3A6%7D%5D%2C%22isMapVisible%22%3Atrue%2C%22filterState"
|
||||
"%22%3A%7B%22sort%22%3A%7B%22value%22%3A%22globalrelevanceex"
|
||||
"%22%7D%2C%22ah%22%3A%7B%22value%22%3Atrue%7D%7D%2C%22isListVisible"
|
||||
"%22%3Atrue%2C%22mapZoom%22%3A19%7D"
|
||||
)
|
||||
|
||||
SVG_CSS = Css(".zillow-map-layer svg.full-boundary-svg")
|
||||
|
||||
|
||||
def is_svg_element_overflow_hidden(session):
|
||||
# The bug is only triggered for large enough window sizes, as otherwise
|
||||
# different CSS is applied which already has overflow:hidden.
|
||||
session.set_window_size(1920, 1200)
|
||||
session.get(URL)
|
||||
await_element(session, SVG_CSS, timeout=20)
|
||||
return "hidden" == session.execute_script(
|
||||
f"""
|
||||
const svg = document.querySelector("{SVG_CSS.value}");
|
||||
if (!svg) {{
|
||||
return undefined;
|
||||
}}
|
||||
return window.getComputedStyle(svg).overflow;
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
assert is_svg_element_overflow_hidden(session)
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
assert not is_svg_element_overflow_hidden(session)
|
|
@ -1,21 +0,0 @@
|
|||
import pytest
|
||||
from helpers import Css, await_element, find_element
|
||||
|
||||
|
||||
URL = "https://m.aliexpress.com/?tracelog=wwwhome2mobilesitehome"
|
||||
SELECTOR = Css("#header input[placeholder]")
|
||||
DISABLED_SELECTOR = Css(f"{SELECTOR.value}:disabled")
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
session.get(URL)
|
||||
find_element(session, SELECTOR)
|
||||
assert find_element(session, DISABLED_SELECTOR, default=None) is None
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
session.get(URL)
|
||||
await_element(session, SELECTOR)
|
||||
find_element(session, DISABLED_SELECTOR)
|
|
@ -1,28 +0,0 @@
|
|||
import pytest
|
||||
from helpers import Css, is_float_cleared, find_element
|
||||
|
||||
|
||||
URL = (
|
||||
"https://www.lcbo.com/webapp/wcs/stores/servlet/PhysicalStoreInventoryView"
|
||||
"?langId=-1&storeId=10203&catalogId=10051&productId=54875"
|
||||
)
|
||||
|
||||
|
||||
PRODUCT_INFO = Css("#content > div")
|
||||
LOCATIONS = Css("#inventoryTable")
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
session.get(URL)
|
||||
product_info = find_element(session, PRODUCT_INFO)
|
||||
locations = find_element(session, LOCATIONS)
|
||||
assert is_float_cleared(session, locations, product_info)
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
session.get(URL)
|
||||
product_info = find_element(session, PRODUCT_INFO)
|
||||
locations = find_element(session, LOCATIONS)
|
||||
assert not is_float_cleared(session, locations, product_info)
|
|
@ -1,25 +0,0 @@
|
|||
import pytest
|
||||
from helpers import Css, is_float_cleared, find_element
|
||||
|
||||
|
||||
URL = "https://curriculum.gov.bc.ca/curriculum/arts-education/10/media-arts"
|
||||
|
||||
|
||||
SHOULD_CLEAR = Css(".curriculum_big_ideas")
|
||||
SHOULD_BE_CLEARED = Css(".view-display-id-attachment_1")
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
session.get(URL)
|
||||
should_clear = find_element(session, SHOULD_CLEAR)
|
||||
should_be_cleared = find_element(session, SHOULD_BE_CLEARED)
|
||||
assert is_float_cleared(session, should_clear, should_be_cleared)
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
session.get(URL)
|
||||
should_clear = find_element(session, SHOULD_CLEAR)
|
||||
should_be_cleared = find_element(session, SHOULD_BE_CLEARED)
|
||||
assert not is_float_cleared(session, should_clear, should_be_cleared)
|
|
@ -0,0 +1,19 @@
|
|||
import pytest
|
||||
from helpers import Css, await_element
|
||||
|
||||
URL = "https://serieson.naver.com/v2/movie/335790?isWebtoonAgreePopUp=true"
|
||||
|
||||
SUPPORTED_CSS = Css("#playerWrapper")
|
||||
UNSUPPORTED_CSS = Css(".end_player_unavailable .download_links")
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
session.get(URL)
|
||||
assert await_element(session, SUPPORTED_CSS)
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
session.get(URL)
|
||||
assert await_element(session, UNSUPPORTED_CSS)
|
|
@ -0,0 +1,58 @@
|
|||
import pytest
|
||||
from helpers import Css, assert_not_element, await_dom_ready, find_element
|
||||
|
||||
# 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 = 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.with_interventions
|
||||
def test_enabled(session):
|
||||
session.get(URL)
|
||||
await_dom_ready(session)
|
||||
assert "html5" == session.execute_async_script(SCRIPT)
|
||||
assert find_element(session, AUDIO_CSS)
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
session.get(URL)
|
||||
await_dom_ready(session)
|
||||
assert "swf" == session.execute_async_script(SCRIPT)
|
||||
assert_not_element(session, AUDIO_CSS)
|
|
@ -0,0 +1,19 @@
|
|||
import pytest
|
||||
from helpers import Css, await_element
|
||||
|
||||
URL = (
|
||||
"https://watch.antennaplus.gr/#/shows/agries_melisses/seasons/"
|
||||
"3/episode/agries_melisses_S03_E137_v1"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
session.get(URL)
|
||||
assert await_element(session, Css(".login-pf-page"))
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
session.get(URL)
|
||||
assert await_element(session, Css(".ua-barrier"))
|
|
@ -0,0 +1,45 @@
|
|||
import pytest
|
||||
from helpers import Css, await_element
|
||||
|
||||
URL = "https://business.help.royalmail.com/app/webforms/stampsenquiries"
|
||||
|
||||
COOKIES_ACCEPT_CSS = Css("#consent_prompt_submit")
|
||||
POSTCODE_CSS = Css("input[name='rn_AddressControl_15textbox']")
|
||||
OPTION_CSS = "option.addr_pick_line:not(:disabled)"
|
||||
ADDY1_CSS = "[name='Incident.CustomFields.c.address1_1']"
|
||||
|
||||
|
||||
def getResult(session):
|
||||
session.get(URL)
|
||||
await_element(session, COOKIES_ACCEPT_CSS).click()
|
||||
session.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);
|
||||
"""
|
||||
)
|
||||
|
||||
await_element(session, POSTCODE_CSS).send_keys("W1A 1AV")
|
||||
await_element(session, Css(OPTION_CSS))
|
||||
return session.execute_script(
|
||||
"""
|
||||
return Boolean(window.__expectedListenerAdded);
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
assert getResult(session)
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
assert not getResult(session)
|
Загрузка…
Ссылка в новой задаче