tests: the deadline of a wait for something that must happen is 30 s where it was 5, 8, 10, 15, 20 or 25

This commit is contained in:
feder-cr committed 2026-11-16 01:15:37 +01:00
1 parent 258a803f11
commit 9aa734ba54
18 files changed
+61 -61

No files matched your search

@@ -23,7 +23,7 @@ import pytest
from _servers import LocalServer
READ = """() => new Promise(resolve => {
const timer = setTimeout(() => resolve({timeout: true}), 8000);
const timer = setTimeout(() => resolve({timeout: true}), 30000);
navigator.geolocation.getCurrentPosition(
p => { clearTimeout(timer); resolve({lat: p.coords.latitude, lon: p.coords.longitude}); },
e => { clearTimeout(timer); resolve({error: e.code, message: e.message}); });
+5 -5
View File
@@ -62,7 +62,7 @@ def _goto(page, url, **kwargs):
except Error as e:
if "NS_BINDING_ABORTED" in str(e):
# The page's own replace stopped ours: it is where it sent itself.
page.wait_for_url("**/landed", timeout=15_000)
page.wait_for_url("**/landed", timeout=30_000)
else:
assert "is interrupted by another navigation to" in str(e), e
assert "/landed" in str(e).split("another navigation to")[1], e
@@ -166,7 +166,7 @@ def page(firefox_binary):
def test_a_read_right_after_goto_answers(page, site, path):
for i in range(ROUNDS):
_goto(page, "%s%s?i=%d" % (site, path, i), wait_until="domcontentloaded",
timeout=15_000)
timeout=30_000)
# Each read is made at once, while the page may still be moving: none
# of them may surface the engine's refusal of a vanished world. A count
# is of the page as it is NOW, and that can be the replacing document
@@ -180,7 +180,7 @@ def test_a_read_right_after_goto_answers(page, site, path):
texts = ([], ["first"], ["head"], ["landed"])
assert page.locator("#p").all_inner_texts() in texts
assert page.locator("#p").all_text_contents() in texts
assert page.inner_text("#p", timeout=10_000) in ("first", "head",
assert page.inner_text("#p", timeout=30_000) in ("first", "head",
"landed")
# The caller's code is NOT a read: it is sent once ([B285]). On a page
# still moving - `/x50` replaces itself after the read above - it
@@ -201,7 +201,7 @@ def test_networkidle_is_reached_on_the_page_that_replaced_ours(page, site, path)
first page, or never comes back because the new frame forgot the navigation, is still red."""
for i in range(ROUNDS):
_goto(page, "%s/i%s?n=%d" % (site, path[1:], i), wait_until="networkidle",
timeout=15_000)
timeout=30_000)
assert page.url.endswith("/landed"), page.url
@@ -233,7 +233,7 @@ def test_reads_wait_as_playwright_s_do(page, site):
page.evaluate("setTimeout(() => { const b = document.createElement('b');"
" b.id = 'late'; b.textContent = 'late';"
" document.body.appendChild(b); }, 500)")
assert page.inner_text("#late", timeout=5_000) == "late"
assert page.inner_text("#late", timeout=30_000) == "late"
from invisible_playwright.sync_api import TimeoutError as PlaywrightTimeout
with pytest.raises(PlaywrightTimeout, match="Timeout 300ms exceeded"):
page.inner_text("#never", timeout=300)
+1 -1
View File
@@ -146,7 +146,7 @@ def _worker_navigator_dict(page, props):
worker.onmessage = (e) => resolve(e.data);
worker.onerror = (e) => reject(new Error(e.message));
worker.postMessage(props);
setTimeout(() => reject(new Error('worker timeout')), 5000);
setTimeout(() => reject(new Error('worker timeout')), 30000);
});
return result;
} finally {
@@ -178,17 +178,17 @@ def test_waiting_for_an_element_that_appears_later_in_a_frame_of_another_site(pa
frame = {"frame": wait_frame(page, late.url("B"), "/late-b"),
"nested": wait_frame(page, late.url("C"), "/late-c")}[target]
# the element is not there yet when the wait starts, or it is by now: either way the wait returns it
handle = frame.wait_for_selector("#late", timeout=8000)
handle = frame.wait_for_selector("#late", timeout=30000)
try:
assert handle.inner_text() == "arrived"
assert handle.owner_frame() is frame
finally:
handle.dispose()
# the same, by the locator of the frame and by the frame locator of the page
frame.locator("#shown").wait_for(state="visible", timeout=8000)
frame.locator("#shown").wait_for(state="visible", timeout=30000)
outer = page.frame_locator("#b")
scoped = outer.locator("#late") if target == "frame" else outer.frame_locator("#c").locator("#late")
scoped.wait_for(state="attached", timeout=8000)
scoped.wait_for(state="attached", timeout=30000)
assert scoped.inner_text() == "arrived"
@@ -47,7 +47,7 @@ WORKER_JS = """(kind) => new Promise(resolve => {
} catch (e) { resolve({error: String(e)}); return; }
worker.onmessage = e => resolve(e.data);
worker.onerror = e => resolve({error: 'worker error: ' + e.message});
setTimeout(() => resolve({error: 'timeout'}), 10000);
setTimeout(() => resolve({error: 'timeout'}), 30000);
})""" % json.dumps(IDENTITY)
WINDOW_JS = "() => (%s)" % IDENTITY
@@ -137,7 +137,7 @@ SHARED_WORKER_JS = """() => new Promise(resolve => {
worker.port.onmessage = e => resolve({outcome: 'ok', identity: e.data});
worker.onerror = e => resolve({outcome: 'error', message: String(e.message || e)});
} catch (e) { resolve({outcome: 'throw', message: e.name + ': ' + e.message}); }
setTimeout(() => resolve({outcome: 'timeout'}), 10000);
setTimeout(() => resolve({outcome: 'timeout'}), 30000);
})"""
SERVICE_WORKER_JS = """() => new Promise(resolve => {
@@ -150,7 +150,7 @@ SERVICE_WORKER_JS = """() => new Promise(resolve => {
}),
e => resolve({outcome: 'rejected', message: e.name + ': ' + e.message}));
} catch (e) { resolve({outcome: 'throw', message: e.name + ': ' + e.message}); }
setTimeout(() => resolve({outcome: 'timeout'}), 15000);
setTimeout(() => resolve({outcome: 'timeout'}), 30000);
})"""
@@ -35,11 +35,11 @@ from _waits import awatch
pytestmark = pytest.mark.e2e
#: The longest any wait of this file lasts; no healthy run comes near it. It is the only clock the verdicts have.
DEADLINE = 8.0
DEADLINE = 30.0
#: The timeout of the gotos that are stopped or replaced below. A goto that is not stopped waits for its held answer and
#: ends at this timeout with another error: it is the bound of the waits that lead up to the stop, nothing narrower.
GOTO_TIMEOUT_MS = 15000
GOTO_TIMEOUT_MS = 30000
FISSION_ON = {
"fission.autostart": True,
@@ -215,7 +215,7 @@ def test_an_iframe_removed_while_it_loads_is_aborted_then_gone(firefox_binary, s
# insertion, whatever the machine: a test that only reads the list could read it before the frame existed)
seen = await awatch(lambda: (counts["attached"], counts["detached"], len(page.frames)),
lambda state: state[0] >= 1 and state[1] >= 1 and state[2] == 1,
DEADLINE + 2, lambda: page.wait_for_timeout(100))
DEADLINE, lambda: page.wait_for_timeout(100))
return [f.url for f in page.frames], seen.render()
urls, seen = _run(firefox_binary, scenario)
@@ -172,7 +172,7 @@ def test_networkidle_arrives_on_a_routed_page_through_a_served_browser(firefox_b
for attempt in range(3): # fresh pages, the way a client fetches one address after another
try:
# the timeout of the goto is the detector of a networkidle that never comes
page.goto(site + "?kind=%s&n=%d" % (kind, attempt), wait_until="networkidle", timeout=20000)
page.goto(site + "?kind=%s&n=%d" % (kind, attempt), wait_until="networkidle", timeout=30000)
except Exception as e:
pytest.fail("networkidle did not come on attempt %d (answers to a closed request: %s): %s" % (
attempt, ANSWER_ERRORS[:3], e))
@@ -215,7 +215,7 @@ def test_networkidle_arrives_when_the_client_answers_all_requests_concurrently_a
await ctx.route("**/*", route)
page = await ctx.new_page()
for attempt in range(3):
await page.goto(site + "?kind=%s&n=%d" % (kind, attempt), wait_until="networkidle", timeout=25000)
await page.goto(site + "?kind=%s&n=%d" % (kind, attempt), wait_until="networkidle", timeout=30000)
await ctx.close()
await browser.close()
@@ -243,7 +243,7 @@ def test_one_page_reused_for_many_addresses_reaches_networkidle_every_time(firef
page = ctx.new_page()
kinds = ["cancel_fetch", "cancel_img", "cancel_iframe", "beacon", "cancel_navigation", "oop_iframe"] * 2
for n, kind in enumerate(kinds):
page.goto(site + "?kind=%s&n=%d" % (kind, n), wait_until="networkidle", timeout=20000)
page.goto(site + "?kind=%s&n=%d" % (kind, n), wait_until="networkidle", timeout=30000)
ctx.close()
browser.close()
finally:
@@ -277,7 +277,7 @@ def test_a_plain_route_handler_is_not_poisoned_by_a_request_the_page_cancelled(f
ctx.route("**/*", plain)
page = ctx.new_page()
for attempt in range(3):
page.goto(site + "?kind=%s&n=%d" % (kind, attempt), wait_until="networkidle", timeout=25000)
page.goto(site + "?kind=%s&n=%d" % (kind, attempt), wait_until="networkidle", timeout=30000)
ctx.close()
browser.close()
finally:
@@ -49,7 +49,7 @@ pytestmark = [pytest.mark.e2e, pytest.mark.usefixtures("the_udp_line")]
SCHEMES = ["context_only", "launch_and_context"]
#: How long to wait for a name the case must have asked to reach the DoH, in seconds.
ASKED_SECONDS = 25
ASKED_SECONDS = 30
#: How long the page of the `push` case may take to register its service worker and read its subscription, in seconds.
PUSH_SECONDS = 40
#: After the context of the `closing` case is closed, the browser lives on this long: the requests of the page's last moments are made now.
+28 -28
View File
@@ -106,7 +106,7 @@ def _open_context_page(browser):
def _goto_opener(page, harness):
page.goto(harness["opener_url"], wait_until="domcontentloaded",
timeout=30_000)
page.wait_for_selector("#open-simple", timeout=10_000)
page.wait_for_selector("#open-simple", timeout=30_000)
def test_window_open_plain_is_a_page(browser, harness):
@@ -118,10 +118,10 @@ def test_window_open_plain_is_a_page(browser, harness):
seen = []
page.on("popup", lambda p: seen.append(p))
with ctx.expect_page(timeout=15_000) as info:
with ctx.expect_page(timeout=30_000) as info:
page.click("#open-simple")
popup = info.value
popup.wait_for_url(harness["popup_url"], timeout=10_000)
popup.wait_for_url(harness["popup_url"], timeout=30_000)
assert popup.url == harness["popup_url"], (
f"popup landed on the wrong URL: {popup.url!r}")
@@ -134,9 +134,9 @@ def test_window_open_plain_is_a_page(browser, harness):
"popup.opener() did not resolve to the opening page")
# A popup must behave like any other page.
popup.wait_for_selector("#ping", timeout=10_000)
popup.wait_for_selector("#ping", timeout=30_000)
popup.click("#ping")
popup.wait_for_function("document.title === 'pong'", timeout=10_000)
popup.wait_for_function("document.title === 'pong'", timeout=30_000)
assert popup.title() == "pong"
popup.close()
@@ -154,15 +154,15 @@ def test_window_open_with_features_is_a_page(browser, harness):
ctx, page = _open_context_page(browser)
try:
_goto_opener(page, harness)
with ctx.expect_page(timeout=15_000) as info:
with ctx.expect_page(timeout=30_000) as info:
page.click("#open-features")
popup = info.value
popup.wait_for_url(harness["popup_url"], timeout=10_000)
popup.wait_for_url(harness["popup_url"], timeout=30_000)
assert popup.url == harness["popup_url"]
assert len(ctx.pages) == 2
assert popup.opener() == page
popup.wait_for_selector("#ping", timeout=10_000)
popup.wait_for_selector("#ping", timeout=30_000)
popup.close()
assert popup.is_closed()
finally:
@@ -185,11 +185,11 @@ def test_window_open_with_a_size_keeps_that_size(browser, harness):
try:
_goto_opener(page, harness)
tab_size = page.evaluate("[innerWidth, innerHeight]")
with ctx.expect_page(timeout=15_000) as info:
with ctx.expect_page(timeout=30_000) as info:
page.click("#open-features")
popup = info.value
popup.wait_for_url(harness["popup_url"], timeout=10_000)
popup.wait_for_load_state("load", timeout=10_000)
popup.wait_for_url(harness["popup_url"], timeout=30_000)
popup.wait_for_load_state("load", timeout=30_000)
# The size is final when the window is shown; reading it once more
# after a beat catches a late resize to the context viewport.
first = popup.evaluate("[innerWidth, innerHeight]")
@@ -203,10 +203,10 @@ def test_window_open_with_a_size_keeps_that_size(browser, harness):
f"keep it.")
popup.close()
with ctx.expect_page(timeout=15_000) as info:
with ctx.expect_page(timeout=30_000) as info:
page.click("#open-simple")
tab = info.value
tab.wait_for_url(harness["popup_url"], timeout=10_000)
tab.wait_for_url(harness["popup_url"], timeout=30_000)
assert tab.evaluate("[innerWidth, innerHeight]") == tab_size, (
"a window.open without features is a tab of the same window and "
"must have the opener's size")
@@ -224,10 +224,10 @@ def test_window_open_noopener_is_a_tracked_page(browser, harness):
ctx, page = _open_context_page(browser)
try:
_goto_opener(page, harness)
with ctx.expect_page(timeout=15_000) as info:
with ctx.expect_page(timeout=30_000) as info:
page.click("#open-noopener")
popup = info.value
popup.wait_for_url(harness["popup_url"], timeout=10_000)
popup.wait_for_url(harness["popup_url"], timeout=30_000)
assert popup.url == harness["popup_url"]
assert popup in ctx.pages
@@ -236,9 +236,9 @@ def test_window_open_noopener_is_a_tracked_page(browser, harness):
assert popup.evaluate("window.opener === null"), (
"the test's noopener shape is broken: in-page window.opener "
"should be null")
popup.wait_for_selector("#ping", timeout=10_000)
popup.wait_for_selector("#ping", timeout=30_000)
popup.click("#ping")
popup.wait_for_function("document.title === 'pong'", timeout=10_000)
popup.wait_for_function("document.title === 'pong'", timeout=30_000)
assert popup.title() == "pong"
popup.close()
assert popup.is_closed()
@@ -252,10 +252,10 @@ def test_target_blank_link_expect_popup(browser, harness):
ctx, page = _open_context_page(browser)
try:
_goto_opener(page, harness)
with page.expect_popup(timeout=15_000) as info:
with page.expect_popup(timeout=30_000) as info:
page.click("#open-link")
popup = info.value
popup.wait_for_url(harness["popup_url"], timeout=10_000)
popup.wait_for_url(harness["popup_url"], timeout=30_000)
assert popup.url == harness["popup_url"]
assert popup in ctx.pages
@@ -276,15 +276,15 @@ def test_popup_in_persistent_context(firefox_binary, harness, tmp_path):
profile_dir=str(tmp_path / "profile")) as ctx:
page = ctx.new_page()
_goto_opener(page, harness)
with ctx.expect_page(timeout=15_000) as info:
with ctx.expect_page(timeout=30_000) as info:
page.click("#open-simple")
popup = info.value
popup.wait_for_url(harness["popup_url"], timeout=10_000)
popup.wait_for_url(harness["popup_url"], timeout=30_000)
assert popup.url == harness["popup_url"]
assert popup in ctx.pages
assert popup.opener() == page
popup.wait_for_selector("#ping", timeout=10_000)
popup.wait_for_selector("#ping", timeout=30_000)
popup.close()
assert popup.is_closed()
@@ -376,13 +376,13 @@ def test_window_open_features_headed_humanized(firefox_binary, harness):
try:
page = ctx.new_page()
_goto_opener(page, harness)
with ctx.expect_page(timeout=15_000) as info:
with ctx.expect_page(timeout=30_000) as info:
page.click("#open-features")
popup = info.value
popup.wait_for_url(harness["popup_url"], timeout=10_000)
popup.wait_for_url(harness["popup_url"], timeout=30_000)
assert popup.url == harness["popup_url"]
assert popup in ctx.pages
popup.wait_for_selector("#ping", timeout=10_000)
popup.wait_for_selector("#ping", timeout=30_000)
popup.close()
assert popup.is_closed()
finally:
@@ -403,10 +403,10 @@ def test_popup_document_reaches_the_context(browser, harness):
requests, responses = [], []
ctx.on("request", lambda r: requests.append(r.url))
ctx.on("response", lambda r: responses.append(r))
with ctx.expect_page(timeout=15_000) as info:
with ctx.expect_page(timeout=30_000) as info:
page.click("#open-simple")
popup = info.value
popup.wait_for_load_state("load", timeout=10_000)
popup.wait_for_load_state("load", timeout=30_000)
url = harness["popup_url"]
# until the document's request and its response have been heard (a condition with a deadline, not 500 ms);
# then a short window is left only for a DUPLICATE, which is what the two counts below look for
@@ -429,7 +429,7 @@ def test_a_popup_the_site_closes_is_closed(browser, harness):
ctx, page = _open_context_page(browser)
try:
_goto_opener(page, harness)
with ctx.expect_page(timeout=15_000) as info:
with ctx.expect_page(timeout=30_000) as info:
page.click("#open-closing")
popup = info.value
closes = []
+2 -2
View File
@@ -64,7 +64,7 @@ def test_navigation_wait(firefox_binary, redirect_origins, wait, requestless):
page.goto(start + "/start")
url = destination if requestless else start + "/redirect"
if wait == "expect_navigation":
with page.expect_navigation(url=destination, timeout=5000) as navigation:
with page.expect_navigation(url=destination, timeout=30000) as navigation:
page.evaluate("url => { location.href = url; }", url)
response = navigation.value
if requestless:
@@ -74,5 +74,5 @@ def test_navigation_wait(firefox_binary, redirect_origins, wait, requestless):
assert response.url == destination
else:
page.evaluate("url => { setTimeout(() => location.href = url, 100); }", url)
page.wait_for_url(destination, timeout=5000)
page.wait_for_url(destination, timeout=30000)
assert page.url == page.evaluate("location.href") == destination
@@ -25,7 +25,7 @@ pytestmark = [
pytest.mark.skipif(not sys.platform.startswith("linux"), reason="the Linux text path"),
]
DEADLINE_S = 15
DEADLINE_S = 30
PAGE = ("<!doctype html><meta charset=utf-8><body style='margin:8px;background:#fff;color:#000'>"
"<h1 style='font-family:serif'>Serif heading</h1>"
@@ -157,7 +157,7 @@ def test_the_compositor_is_webrender_software_whatever_the_machine(firefox_binar
#: RTCPeerConnection with no ICE servers and waits for the gather, draws 200 DOM elements and one 2D canvas frame; the browser goes to
#: the next copy of it, 10 times.
ROUNDS = 10
ICE_WAIT_MS = 15000
ICE_WAIT_MS = 30000
SCENE = """<!doctype html><meta charset=utf-8><title>scenario</title>
<body><div id=root></div><canvas id=c width=320 height=200></canvas>
<script>
@@ -40,7 +40,7 @@ _PC_JS = """async (stun) => {
let t_srflx = null;
pc.onicecandidate = e => { if (e.candidate && e.candidate.type === 'srflx' && t_srflx === null) t_srflx = Date.now(); };
await pc.setLocalDescription(await pc.createOffer());
const deadline = Date.now() + 8000;
const deadline = Date.now() + 30000;
while (t_srflx === null && Date.now() < deadline) await new Promise(r => setTimeout(r, 5));
pc.close();
return {t_pc, t_srflx};
+2 -2
View File
@@ -52,7 +52,7 @@ def page(firefox_binary):
def _settled_on_next(page):
deadline = time.monotonic() + 20
deadline = time.monotonic() + 30
while page.title() != "next":
assert time.monotonic() < deadline, "the page never reached /next"
time.sleep(0.05)
@@ -103,5 +103,5 @@ def test_a_read_declared_free_of_effects_answers_from_the_page_that_replaced_it(
def test_wait_for_function_goes_on_through_a_navigation(page, site):
page.goto(site)
page.evaluate("setTimeout(() => { location.href = '/next'; }, 300)")
page.wait_for_function("document.title === 'next'", timeout=15_000)
page.wait_for_function("document.title === 'next'", timeout=30_000)
assert page.title() == "next"
+1 -1
View File
@@ -233,4 +233,4 @@ def test_a_process_that_reads_no_filter_while_it_starts_is_read_again_and_one_th
def test_the_filter_wait_of_the_sandbox_test_is_bounded():
import test_the_socket_process_is_sandboxed_e2e as sandbox
assert 0 < sandbox.STARTUP_SECONDS <= 15
assert 0 < sandbox.STARTUP_SECONDS <= 30
@@ -84,7 +84,7 @@ def test_the_favicon_goes_to_the_site_and_nothing_of_it_to_the_client(firefox_bi
# and nothing above noticed: networkidle reaches the client from
# the lifecycle's timer, not from the reader. A round trip to the
# engine does need the reader.
page.wait_for_function("() => document.title === 'f'", timeout=10000)
page.wait_for_function("() => document.title === 'f'", timeout=30000)
release.set()
# What a client could be told of the favicon comes when its answer is over: wait for the site to have
# written it (a condition with a deadline), then leave the client a short window to say anything. The
@@ -69,7 +69,7 @@ def _children_of(binary: str):
#: start-up, and Firefox pre-launches content processes, so a process sampled while it starts legitimately reads 0 (run 43523960399: the newest tab
#: process, pid 4090 of [3905, 4002, 4005, 4090], read 0 and the same suite was green on the candidates before). A process that is still 0 after this
#: long has finished starting and runs without a filter: that is the failure the test is for.
STARTUP_SECONDS = 10
STARTUP_SECONDS = 30
def _settled_seccomp(pids, seconds: float = STARTUP_SECONDS) -> dict:
@@ -104,7 +104,7 @@ def test_the_socket_process_and_a_tab_process_have_a_seccomp_filter(firefox_bina
await new Promise(r => setTimeout(r, 1500));
}""")
sockets, tabs = [], []
deadline = time.monotonic() + 20
deadline = time.monotonic() + 30
while time.monotonic() < deadline:
kids = _children_of(firefox_binary)
sockets = [pid for pid, kind in kids if kind == "socket"]
+1 -1
View File
@@ -33,7 +33,7 @@ READ = """() => new Promise(resolve => {
if (read().length) return resolve(read());
speechSynthesis.addEventListener('voiceschanged', () => resolve(read()),
{once: true});
setTimeout(() => resolve(read()), 5000);
setTimeout(() => resolve(read()), 30000);
})"""