mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1805818 - Add additional tests for interventions r=twisniewski DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D164772
This commit is contained in:
parent
cb098267e2
commit
bd91080417
@ -2,9 +2,9 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import pytest
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from selenium.common.exceptions import NoAlertPresentException, NoSuchElementException
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import pytest
|
||||
|
||||
|
||||
URL = "http://histography.io/"
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import pytest
|
||||
from helpers import Css, Text, find_element
|
||||
|
||||
|
||||
ADDRESS_CSS = Css("input[name=MailAddress]")
|
||||
PASSWORD_CSS = Css("input[name=Password]")
|
||||
CLOSE_BUTTON_CSS = Css("input[name=winclosebutton]")
|
||||
|
@ -3,8 +3,8 @@ from helpers import (
|
||||
Css,
|
||||
Text,
|
||||
await_element,
|
||||
load_page_and_wait_for_iframe,
|
||||
find_element,
|
||||
load_page_and_wait_for_iframe,
|
||||
)
|
||||
|
||||
# Note that we have to load this page twice, as when it is loaded the
|
||||
|
@ -1,6 +1,5 @@
|
||||
import pytest
|
||||
|
||||
|
||||
URL = "https://buskocchi.desuca.co.jp/smartPhone.html"
|
||||
SCRIPT = """return document.getElementById("map_canvas")?.clientHeight;"""
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import pytest
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from helpers import Css, Text, assert_not_element, await_element, find_element
|
||||
|
||||
URL = "https://covid.cdc.gov/covid-data-tracker/#pandemic-vulnerability-index"
|
||||
|
@ -1,7 +1,6 @@
|
||||
import pytest
|
||||
from helpers import Css, find_element
|
||||
|
||||
|
||||
URL = (
|
||||
"https://www.saxoinvestor.fr/login/?adobe_mc="
|
||||
"MCORGID%3D173338B35278510F0A490D4C%2540AdobeOrg%7CTS%3D1621688498"
|
||||
|
@ -0,0 +1,33 @@
|
||||
import pytest
|
||||
from helpers import Css, await_element
|
||||
|
||||
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 = Css(".swiper-wrapper")
|
||||
|
||||
|
||||
def get_picture_width(session):
|
||||
return session.execute_script(
|
||||
f"""
|
||||
const p = document.querySelector("{PICTURE_CSS}");
|
||||
return window.getComputedStyle(p).width;
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
session.get(URL)
|
||||
await_element(session, GALLERY_CSS)
|
||||
assert "0px" != get_picture_width(session)
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
session.get(URL)
|
||||
await_element(session, GALLERY_CSS)
|
||||
assert "0px" == get_picture_width(session)
|
@ -0,0 +1,19 @@
|
||||
import pytest
|
||||
from helpers import Css, await_element
|
||||
|
||||
URL = "https://m.pji.co.kr/"
|
||||
UNSUPPORTED_BANNER = Css("#chromAlarmView")
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
session.get(URL)
|
||||
unsupported_banner = await_element(session, UNSUPPORTED_BANNER)
|
||||
assert unsupported_banner.is_displayed() is False
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
session.get(URL)
|
||||
unsupported_banner = await_element(session, UNSUPPORTED_BANNER)
|
||||
assert unsupported_banner.is_displayed()
|
@ -0,0 +1,19 @@
|
||||
import pytest
|
||||
from helpers import Css, await_element
|
||||
|
||||
URL = "https://www.liveobserverpark.com/"
|
||||
UNSUPPORTED_BANNER = Css(".banner_overlay")
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
session.get(URL)
|
||||
unsupported_banner = await_element(session, UNSUPPORTED_BANNER)
|
||||
assert unsupported_banner.is_displayed() is False
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
session.get(URL)
|
||||
unsupported_banner = await_element(session, UNSUPPORTED_BANNER)
|
||||
assert unsupported_banner.is_displayed()
|
@ -0,0 +1,18 @@
|
||||
import pytest
|
||||
from helpers import Css, assert_not_element, await_element
|
||||
|
||||
URL = "https://www.mms.telekom.de/OTP/"
|
||||
LOGIN_CSS = Css(".LoginbackgroundDiv")
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
session.get(URL)
|
||||
login_element = await_element(session, LOGIN_CSS)
|
||||
assert login_element.is_displayed()
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
session.get(URL)
|
||||
assert_not_element(session, LOGIN_CSS)
|
@ -0,0 +1,24 @@
|
||||
import pytest
|
||||
|
||||
URL = "https://cov19ent.kdca.go.kr/"
|
||||
HEADER_CSS = "header.mouseOn"
|
||||
|
||||
|
||||
def get_header_position(session):
|
||||
session.get(URL)
|
||||
return session.execute_script(
|
||||
f"""
|
||||
const r = document.querySelector("{HEADER_CSS}");
|
||||
return window.getComputedStyle(r).position;
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
assert "absolute" == get_header_position(session)
|
||||
|
||||
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
assert "absolute" != get_header_position(session)
|
@ -0,0 +1,60 @@
|
||||
import time
|
||||
|
||||
import pytest
|
||||
from helpers import Css, await_element, find_element
|
||||
|
||||
URL = "https://www.youtube.com/"
|
||||
SEARCH_TERM = "movies"
|
||||
|
||||
SEARCH_FIELD_CSS = Css("input[type='text'][id*='search']")
|
||||
SEARCH_BUTTON_CSS = Css("#search-icon-legacy")
|
||||
FILTER_BAR_CSS = Css("#filter-menu")
|
||||
PERF_NOW_CONSTANT = 11111
|
||||
|
||||
|
||||
def change_performance_now(session):
|
||||
return session.execute_script(
|
||||
f"""
|
||||
Object.defineProperty(window.performance, "now", {{
|
||||
value: function() {{
|
||||
return {PERF_NOW_CONSTANT};
|
||||
}}
|
||||
}});
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def search_for_term(session):
|
||||
session.get(URL)
|
||||
search = await_element(session, SEARCH_FIELD_CSS)
|
||||
button = find_element(session, SEARCH_BUTTON_CSS)
|
||||
|
||||
assert search.is_displayed()
|
||||
assert button.is_displayed()
|
||||
|
||||
search.send_keys(SEARCH_TERM)
|
||||
time.sleep(1)
|
||||
button.click()
|
||||
time.sleep(2)
|
||||
|
||||
|
||||
@pytest.mark.with_interventions
|
||||
def test_enabled(session):
|
||||
search_for_term(session)
|
||||
filter_bar = await_element(session, FILTER_BAR_CSS, None, True)
|
||||
|
||||
session.back()
|
||||
|
||||
assert filter_bar.is_displayed() is False
|
||||
|
||||
|
||||
@pytest.mark.skip(reason="results are intermittent, so skipping this test for now")
|
||||
@pytest.mark.without_interventions
|
||||
def test_disabled(session):
|
||||
change_performance_now(session)
|
||||
search_for_term(session)
|
||||
|
||||
session.back()
|
||||
|
||||
filter_bar = await_element(session, FILTER_BAR_CSS)
|
||||
assert filter_bar.is_displayed()
|
Loading…
Reference in New Issue
Block a user