Compare commits

...
Author SHA1 Message Date
feder-crandClaude Opus 5.5 48368461fc HUNT SCAFFOLDING, NEVER MERGED: the typing per key under the same stamps inside our process
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 15:44:54 +01:00
feder-crandClaude Opus 5.5 76fe33a8fc HUNT SCAFFOLDING, NEVER MERGED: hold time of the lifecycle lock per holder, traced and as a control with only the maxima
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 15:36:10 +01:00
feder-crandClaude Opus 5.5 56c6c43d2d HUNT SCAFFOLDING, NEVER MERGED: the slow listeners, the lifecycle lock waits and the announce under the lock, inside our process
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 15:34:48 +01:00
feder-crandClaude Opus 5.5 037f614721 HUNT SCAFFOLDING, NEVER MERGED: stamp the /landed request where the core and stock Playwright read the browser pipe, wall clock everywhere
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 15:10:11 +01:00
feder-crandClaude Opus 5.5 6761bd4b43 HUNT SCAFFOLDING, NEVER MERGED: trace the lifecycle events and the networkidle it gives, on the pages that move, ours against stock
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:44:08 +01:00
feder-crandClaude Opus 5.5 224850a3e0 HUNT SCAFFOLDING, NEVER MERGED: networkidle on a page that moves, ours against stock Playwright Firefox, with the time of the replacement's request
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 14:25:23 +01:00
feder-crandClaude Opus 5.5 59cc42452c HUNT SCAFFOLDING, NEVER MERGED: the networkidle round on a page that moves, four at once on Windows, with the URL read again
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 13:58:46 +01:00
7 changed files with 558 additions and 0 deletions

No files matched your search

+127
View File
@@ -0,0 +1,127 @@
# windows-flakes-hunt.yml - hunt scaffolding, never merged. Runs only on a push to a `hunt/windows-flakes**` branch.
# The networkidle round on /x0 left on its own page once (main e2e 43425218633, part 3): ours against stock Playwright Firefox, four at once, x5, with the lifecycle, the pipe reader and the slow listeners inside our process stamped (ours only).
name: windows flakes hunt
on:
push:
branches: ['hunt/windows-flakes**']
permissions:
contents: read
concurrency:
group: windows-flakes-hunt-${{ github.ref }}
cancel-in-progress: true
env:
GITHUB_TOKEN: ${{ github.token }}
jobs:
hunt:
name: windows flakes hunt
runs-on: windows-2022
timeout-minutes: 120
strategy:
max-parallel: 1
matrix:
os: [windows-2022]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with: { python-version: '3.11' }
- name: Install
run: |
set -e
python -m pip install --quiet --upgrade pip
python -m pip install --quiet ".[dev]"
python -m pip install --quiet "playwright==$(cat scripts/playwright_pin.txt)"
echo "FF=$(cd "$RUNNER_TEMP" && python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
python scripts/ci_lab_geoip.py build
python -m playwright install firefox
python scripts/hunt_trace_lifecycle.py
python scripts/hunt_trace_pipes.py
python scripts/hunt_trace_inside.py
- name: Ours and stock, four at once each, five times
env:
PYTHONUNBUFFERED: "1"
run: |
set +e
mkdir -p evidence
for n in 1 2 3 4 5; do
for engine in ours; do
for c in 1 2 3 4; do
HUNT_LOCK_MAX="$PWD/evidence/lockmax_traced_${n}_$c.jsonl" HUNT_INSIDE_TRACE="$PWD/evidence/inside_${engine}_${n}_$c.jsonl" python -u scripts/hunt_netidle.py $engine "$FF" "$PWD/evidence/lc_${engine}_${n}_$c.jsonl" "$PWD/evidence/pipe_${engine}_${n}_$c.txt" > "evidence/${engine}_${n}_$c.log" 2>&1 &
done
wait
done
echo "round $n done"
done
# the typing per key under the same stamps: is the slip of the keys the same wait (ours only, four at once x5)
for n in 1 2 3 4 5; do
for c in 1 2 3 4; do
HUNT_LOCK_MAX="$PWD/evidence/lockmax_typing_${n}_$c.jsonl" HUNT_INSIDE_TRACE="$PWD/evidence/inside_typing_${n}_$c.jsonl" python -u scripts/hunt_typing.py ours "$FF" > "evidence/typing_${n}_$c.log" 2>&1 &
done
wait
done
# the control: no line per event, only the longest hold of the lifecycle's lock per holder, written at exit
for n in 1 2 3 4 5; do
for c in 1 2 3 4; do
HUNT_LOCK_MAX="$PWD/evidence/lockmax_control_${n}_$c.jsonl" python -u scripts/hunt_netidle.py ours "$FF" > "evidence/control_${n}_$c.log" 2>&1 &
done
wait
done
{
echo "## networkidle rows: engine, landed at return, count"
echo '```'
cat evidence/*.log | grep -a "^HUNT-ROW" | sed 's/^HUNT-ROW //' | python -c "import sys,json,collections; c=collections.Counter(); [c.update([(r['engine'], r['path'], r['landed_at_return'], r['error'] is not None)]) for r in map(json.loads, sys.stdin)]; [print(k, v) for k, v in sorted(c.items())]"
echo "## rows not on /landed at return, with the /landed request time"
cat evidence/*.log | grep -a "^HUNT-ROW" | grep -a '"landed_at_return": false' | cut -c1-260
for kind in traced typing control; do
echo "## longest hold of the lifecycle lock per holder ($kind)"
cat evidence/lockmax_${kind}_*.jsonl | python -c "
import json,sys,collections
m=collections.defaultdict(list); n=collections.Counter()
for l in sys.stdin:
r=json.loads(l); m[r['holder']].append(r['max_ms']); n[r['holder']]+=r['count']
for k,v in sorted(m.items(), key=lambda kv:-max(kv[1]))[:12]:
v.sort(); print('%-70s max %5d p95-of-runs %5d holds %d' % (k, v[-1], v[min(len(v)-1,int(len(v)*.95))], n[k]))
"
done
echo "## slow listeners and announces inside our process (traced passes): count, p95, max per name"
cat evidence/inside_*.jsonl | python -c "
import json,sys,collections
m=collections.defaultdict(list)
for l in sys.stdin:
r=json.loads(l); m[(r['kind'], r.get('fn'))].append(r['ms'])
for k,v in sorted(m.items(), key=lambda kv:-sum(kv[1]))[:15]:
v.sort(); print('%-34s %-60s n %4d p95 %5d max %5d sum %6d' % (k[0], str(k[1])[:60], len(v), v[min(len(v)-1,int(len(v)*.95))], v[-1], sum(v)))
"
echo "## typing slip (ours, four at once, traced)"
cat evidence/typing_*.log | grep -a "^HUNT-TYPING" | sed 's/^HUNT-TYPING //' | python -c "
import json,sys
r=[json.loads(l) for l in sys.stdin]
e=sorted(x['sent_ms'][-1]-x['planned_ms'][-1] for x in r if len(x['sent_ms'])==len(x['planned_ms']))
print('runs', len(r), 'sent slip at last key p50', e[len(e)//2] if e else None, 'max', e[-1] if e else None)
"
echo "## control rows not on /landed"
cat evidence/control_*.log | grep -a "^HUNT-ROW" | grep -ac '"landed_at_return": false'
grep -ahE "Traceback|Error" evidence/*.log | sort | uniq -c | head -20
echo '```'
} | tee -a "$GITHUB_STEP_SUMMARY"
- name: Close every Firefox left
if: always()
shell: pwsh
run: |
Get-Process firefox -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
"left: " + @(Get-Process firefox -ErrorAction SilentlyContinue).Count
- name: Upload the evidence
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: windows-flakes-${{ github.run_id }}
path: evidence
if-no-files-found: warn
retention-days: 14
+82
View File
@@ -0,0 +1,82 @@
"""HUNT SCAFFOLDING, NEVER MERGED: goto(networkidle) on pages that replace themselves after load, ours against stock Playwright Firefox.
Usage: python scripts/hunt_netidle.py ours|stock [binary]. Prints one JSON line per round: the URL when goto returned, how long goto took, and
when the server saw the request of /landed relative to goto's return (negative = the replacement was already on the wire when goto said idle).
"""
import http.server
import json
import os
import sys
import threading
import time
ENGINE = sys.argv[1]
if len(sys.argv) > 3:
os.environ["HUNT_LC_TRACE"] = sys.argv[3]
if len(sys.argv) > 4:
os.environ["HUNT_PIPE_TRACE"] = sys.argv[4]
REQS = []
def _page(ms, cross):
target = "location.origin.replace('127.0.0.1','localhost')+'/landed'" if cross else "'/landed'"
return ("<!doctype html><html><body><p id=p>first</p><script>addEventListener('load', () => setTimeout(() => "
"location.replace(%s), %d))</script></body></html>" % (target, ms)).encode()
PAGES = {"/landed": b"<!doctype html><html><body><p id=p>landed</p></body></html>"}
for ms in (0, 50):
PAGES["/r%d" % ms] = _page(ms, False)
PAGES["/x%d" % ms] = _page(ms, True)
class H(http.server.BaseHTTPRequestHandler):
def do_GET(self):
REQS.append((time.time(), self.path))
body = PAGES.get(self.path.split("?")[0], PAGES["/landed"])
self.send_response(200)
self.send_header("Content-Type", "text/html; charset=utf-8")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def log_message(self, *a):
pass
srv = http.server.ThreadingHTTPServer(("127.0.0.1", 0), H)
srv.daemon_threads = True
threading.Thread(target=srv.serve_forever, daemon=True).start()
site = "http://127.0.0.1:%d" % srv.server_address[1]
def rounds(page, Error):
for path in ("/r0", "/r50", "/x0", "/x50"):
for i in range(5):
t0 = time.time()
err = None
try:
page.goto("%s%s?n=%d" % (site, path, i), wait_until="networkidle", timeout=15000)
except Error as e:
err = str(e).splitlines()[0][:100]
t1 = time.time()
url = page.url
landed = [t for t, p in REQS if p.startswith("/landed") and t >= t0]
print("HUNT-ROW " + json.dumps({
"engine": ENGINE, "path": path, "round": i, "landed_at_return": url.endswith("/landed"), "goto_ms": round((t1 - t0) * 1000),
"landed_request_ms_from_return": round((landed[0] - t1) * 1000) if landed else None, "error": err,
"t0": round(t0, 4), "t1": round(t1, 4), "landed_t": round(landed[0], 4) if landed else None}), flush=True)
if ENGINE == "stock":
from playwright.sync_api import sync_playwright, Error
with sync_playwright() as p:
b = p.firefox.launch(headless=True)
rounds(b.new_page(), Error)
b.close()
else:
from invisible_playwright import InvisiblePlaywright
from invisible_playwright.sync_api import Error
with InvisiblePlaywright(seed=4321, binary_path=sys.argv[2], headless=True) as browser:
rounds(browser.new_page(), Error)
srv.shutdown()
+150
View File
@@ -0,0 +1,150 @@
"""HUNT SCAFFOLDING, NEVER MERGED: where the time goes between our pipe reader and the lifecycle.
Patches the installed invisible_core: every listener call in Connection.dispatch_event that takes 20 ms or more, and every wait of
Lifecycle._on_event for the lifecycle's lock of 20 ms or more, is written (wall clock) to $HUNT_INSIDE_TRACE with the listener's name,
the event and the thread that held the lock. Run once after the install: python scripts/hunt_trace_inside.py
"""
import importlib.util
import io
path = importlib.util.find_spec("invisible_core.juggler.connection").origin
s = io.open(path, encoding="utf-8").read()
old = """ for fn in subscribers:
try:
fn(method, params, session)
except Exception as failure:
"""
new = """ for fn in subscribers:
try:
_ht0 = time.time()
fn(method, params, session)
_hdt = time.time() - _ht0
if _hdt >= 0.02:
_hunt_inside(kind="listener", fn=getattr(fn, "__qualname__", repr(fn))[:120], ev=method, ms=round(_hdt * 1000), t=round(_ht0, 4))
except Exception as failure:
"""
assert s.count(old) == 1, "dispatch_event"
s = s.replace(old, new, 1)
if "\nimport time\n" not in s:
s = s.replace("\nimport json\n", "\nimport json\nimport time\n", 1)
s = s.rstrip(chr(10)) + '''
def _hunt_inside(**row):
import json as _j, os as _o
path = _o.environ.get("HUNT_INSIDE_TRACE")
if path:
with open(path, "a", encoding="utf-8") as fh:
print(_j.dumps(row), file=fh)
'''
io.open(path, "w", encoding="utf-8", newline=chr(10)).write(s)
print("patched", path)
path = importlib.util.find_spec("invisible_core.juggler.lifecycle").origin
s = io.open(path, encoding="utf-8").read()
old = """ def _on_event(self, method: str, p: dict) -> None:
with self._cv:
"""
new = """ def _on_event(self, method: str, p: dict) -> None:
import time as _hti
_hw0 = _hti.time()
self._cv.acquire()
_hwait = _hti.time() - _hw0
self._cv.release()
if _hwait >= 0.02:
from invisible_core.juggler.connection import _hunt_inside
_hunt_inside(kind="lifecycle lock wait", ev=method, ms=round(_hwait * 1000), t=round(_hw0, 4), holder=getattr(self, "_hunt_holder", None))
with self._cv:
"""
assert s.count(old) == 1, "_on_event"
s = s.replace(old, new, 1)
old = """ if self.announce is not None:
self.announce(what, frame_id, url, **detail)
"""
new = """ if self.announce is not None:
import time as _hta
_ha0 = _hta.time()
self.announce(what, frame_id, url, **detail)
_hadt = _hta.time() - _ha0
if _hadt >= 0.02:
from invisible_core.juggler.connection import _hunt_inside
_hunt_inside(kind="announce under the lifecycle lock", ev=what, ms=round(_hadt * 1000), t=round(_ha0, 4),
fn=getattr(self.announce, "__qualname__", "?"))
"""
assert s.count(old) == 1, "_tell"
s = s.replace(old, new, 1)
old = """ self._cv = threading.Condition()
"""
new = """ self._cv = _HuntCondition()
"""
assert s.count(old) == 1, "_cv"
s = s.replace(old, new, 1)
s = s.rstrip(chr(10)) + """
import atexit as _hatexit
import sys as _hsys
import threading as _hthreading
import time as _htime
_HUNT_MAX = {}
def _hunt_record(holder, held):
import os as _o
m = _HUNT_MAX.get(holder)
_HUNT_MAX[holder] = (max(held, m[0]) if m else held, (m[1] if m else 0) + 1, (m[2] if m else 0.0) + held)
if held >= 0.02 and _o.environ.get("HUNT_INSIDE_TRACE"):
from invisible_core.juggler.connection import _hunt_inside
_hunt_inside(kind="lifecycle lock held", fn=holder, ms=round(held * 1000), t=round(_htime.time(), 4))
def _hunt_dump():
import json as _j, os as _o
path = _o.environ.get("HUNT_LOCK_MAX")
if path:
with open(path, "a", encoding="utf-8") as fh:
for k, (mx, n, tot) in sorted(_HUNT_MAX.items(), key=lambda kv: -kv[1][0]):
print(_j.dumps({"holder": k, "max_ms": round(mx * 1000), "count": n, "total_ms": round(tot * 1000)}), file=fh)
_hatexit.register(_hunt_dump)
class _HuntCondition(_hthreading.Condition):
# How long the lifecycle's lock is HELD, outermost holds only, per holder (the function that took it); the waits inside
# Condition.wait are not held time.
def __init__(self):
super().__init__()
self._hdepth = 0
self._hsince = 0.0
self._hholder = None
def __enter__(self):
r = super().__enter__()
self._hdepth += 1
if self._hdepth == 1:
f = _hsys._getframe(1)
self._hholder = "%s:%d" % (f.f_code.co_qualname, f.f_lineno)
self._hsince = _htime.time()
return r
def __exit__(self, *a):
self._hdepth -= 1
if self._hdepth == 0:
_hunt_record(self._hholder, _htime.time() - self._hsince)
return super().__exit__(*a)
def wait(self, timeout=None):
holder = self._hholder
_hunt_record(holder, _htime.time() - self._hsince)
depth = self._hdepth
try:
return super().wait(timeout)
finally:
self._hdepth = depth
self._hholder = holder
self._hsince = _htime.time()
"""
io.open(path, "w", encoding="utf-8", newline=chr(10)).write(s)
print("patched", path)
+52
View File
@@ -0,0 +1,52 @@
"""HUNT SCAFFOLDING, NEVER MERGED: patch the installed invisible_core lifecycle to trace what decides networkidle.
Every event the lifecycle applies (Page.* and Network.*) and every networkidle it gives is written as a JSON line, with time.time(),
to the file named by $HUNT_LC_TRACE. Run once after the install: python scripts/hunt_trace_lifecycle.py
"""
import importlib.util
import io
path = importlib.util.find_spec("invisible_core.juggler.lifecycle").origin
s = io.open(path, encoding="utf-8").read()
old = """ def _on_event(self, method: str, p: dict) -> None:
with self._cv:
"""
new = """ def _on_event(self, method: str, p: dict) -> None:
with self._cv:
if method.startswith(("Page.", "Network.")):
_hunt_lc(ev=method, frame=p.get("frameId"), nav=p.get("navigationId"), url=(p.get("url") or "")[:90],
rid=p.get("requestId"), name=p.get("name"), open=len(self._open),
states={k: sorted(v.states) for k, v in self.frames.items()})
"""
assert s.count(old) == 1, "_on_event"
s = s.replace(old, new, 1)
old = """ for f in waiting:
f.states.add(state)
self._tell(state, f.id)
"""
new = """ for f in waiting:
if state == "networkidle":
_hunt_lc(ev="GIVE networkidle", frame=f.id, nav=f.navigation, url=(f.url or "")[:90], open=len(self._open),
quiet=round(quiet_for, 3))
f.states.add(state)
self._tell(state, f.id)
"""
assert s.count(old) == 1, "_settle"
s = s.replace(old, new, 1)
s = s.rstrip(chr(10)) + '''
def _hunt_lc(**row):
import json as _j, os as _o, time as _t
path = _o.environ.get("HUNT_LC_TRACE")
if not path:
return
row["t"] = round(_t.time(), 4)
try:
with open(path, "a", encoding="utf-8") as fh:
print(_j.dumps(row, default=str), file=fh)
except Exception:
pass
'''
io.open(path, "w", encoding="utf-8", newline=chr(10)).write(s)
print("patched", path)
+42
View File
@@ -0,0 +1,42 @@
"""HUNT SCAFFOLDING, NEVER MERGED: stamp the moment the browser pipe delivers a /landed request, in the core and in stock Playwright.
Ours: invisible_core.juggler.connection _read_loop, on every chunk read from the browser. Stock: Playwright's PipeTransport2._dispatch in
the driver's coreBundle.js, on every chunk. A chunk that carries "requestWillBeSent" and "/landed" writes a wall-clock time (seconds) to the
file named by $HUNT_PIPE_TRACE. Run once after the install: python scripts/hunt_trace_pipes.py
"""
import importlib.util
import io
import os
path = importlib.util.find_spec("invisible_core.juggler.connection").origin
s = io.open(path, encoding="utf-8").read()
old = """ chunk = os.read(self._from_browser, 65536)
if not chunk:
break
"""
new = """ chunk = os.read(self._from_browser, 65536)
if not chunk:
break
if b"requestWillBeSent" in chunk and b"/landed" in chunk and os.environ.get("HUNT_PIPE_TRACE"):
import time as _ht
with open(os.environ["HUNT_PIPE_TRACE"], "a") as _hf:
print("%.4f" % _ht.time(), file=_hf)
"""
assert s.count(old) == 1, "core _read_loop"
io.open(path, "w", encoding="utf-8", newline=chr(10)).write(s.replace(old, new, 1))
print("patched", path)
pw = os.path.dirname(importlib.util.find_spec("playwright").origin)
bundle = os.path.join(pw, "driver", "package", "lib", "coreBundle.js")
s = io.open(bundle, encoding="utf-8").read()
old = r""" _dispatch(buffer) {
let end = buffer.indexOf("\0");
"""
new = r""" _dispatch(buffer) {
if (process.env.HUNT_PIPE_TRACE && buffer.includes("requestWillBeSent") && buffer.includes("/landed"))
require("fs").appendFileSync(process.env.HUNT_PIPE_TRACE, (Date.now() / 1000).toFixed(4) + "\n");
let end = buffer.indexOf("\0");
"""
assert s.count(old) >= 1, "stock _dispatch" # two NUL-delimited transports in the bundle: both stamped
io.open(bundle, "w", encoding="utf-8", newline=chr(10)).write(s.replace(old, new))
print("patched", bundle)
+97
View File
@@ -0,0 +1,97 @@
"""HUNT SCAFFOLDING, NEVER MERGED: one typed address, three times per key: planned, sent (before the keydown command), seen by the page.
Usage: python scripts/hunt_typing.py ours|stock [binary]. Both type the same plan (persona of seed 2, typing nonce 1, the plan the core's
keyboard draws for a session's first field): ours through press_sequentially (the core keyboard), stock as down / sleep(dwell) / up /
sleep(gap) through stock Playwright's keyboard. One JSON line per run with the three series in wall-clock milliseconds.
"""
import http.server
import json
import sys
import threading
import time
from invisible_core.juggler._behaviour import TypingPersona, plan_typing
ENGINE = sys.argv[1]
TEXT = "someone@example.com"
PLAN = plan_typing(TEXT, TypingPersona.from_seed(2), nonce=1)
SENT = []
PAGE = (b"<!doctype html><html><body><input id=f><script>window.__k=[];document.addEventListener('keydown',"
b"e=>__k.push([e.key, performance.timeOrigin + performance.now()]),true);</script></body></html>")
class H(http.server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header("Content-Type", "text/html")
self.send_header("Content-Length", str(len(PAGE)))
self.end_headers()
self.wfile.write(PAGE)
def log_message(self, *a):
pass
srv = http.server.ThreadingHTTPServer(("127.0.0.1", 0), H)
srv.daemon_threads = True
threading.Thread(target=srv.serve_forever, daemon=True).start()
url = "http://127.0.0.1:%d/" % srv.server_address[1]
def report(page, t_start):
keys = page.evaluate("__k")
planned, t = [], 0.0
for dwell, gap in PLAN:
planned.append(round(t))
t += dwell + gap
print("HUNT-TYPING " + json.dumps({
"engine": ENGINE, "planned_ms": planned,
"sent_ms": [round(x * 1000 - SENT[0] * 1000) for x in SENT if True],
"page_ms": [round(v - keys[0][1]) for k, v in keys if k != "Shift"],
"page_keys": [k for k, v in keys], "send_offset_ms": round((SENT[0] - t_start) * 1000) if SENT else None,
}), flush=True)
if ENGINE == "stock":
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
b = p.firefox.launch(headless=True)
page = b.new_page()
for _ in range(5):
SENT.clear()
page.goto(url)
page.click("#f")
t_start = time.time()
for (dwell, gap), ch in zip(PLAN, TEXT):
SENT.append(time.time())
if ch == "@":
page.keyboard.down("Shift")
page.keyboard.down(ch)
time.sleep(dwell / 1000)
page.keyboard.up(ch)
if ch == "@":
page.keyboard.up("Shift")
time.sleep(gap / 1000)
report(page, t_start)
b.close()
else:
from invisible_core.juggler import keyboard as kb
real_down = kb.Keyboard.down
def down(self, key, *a, **k):
if key != "Shift":
SENT.append(time.time())
return real_down(self, key, *a, **k)
kb.Keyboard.down = down
from invisible_playwright import InvisiblePlaywright
for _ in range(5):
# a fresh browser per run: the plan is the one of the session's first field (typing nonce 1)
with InvisiblePlaywright(seed=2, binary_path=sys.argv[2], headless=True) as browser:
SENT.clear()
page = browser.new_page()
page.goto(url)
t_start = time.time()
page.locator("#f").press_sequentially(TEXT)
report(page, t_start)
srv.shutdown()
+8
View File
@@ -161,6 +161,14 @@ def test_networkidle_is_reached_on_the_page_that_replaced_ours(page, site, path)
for i in range(ROUNDS):
_goto(page, "%s%s?n=%d" % (site, path, i), wait_until="networkidle",
timeout=15_000)
if not page.url.endswith("/landed"):
u1 = page.url
try:
href = page.evaluate("location.href")
except Exception as e:
href = "ERR " + str(e)[:120]
time.sleep(2)
print("HUNT-NETIDLE round=%d url=%s href=%s url_after_2s=%s" % (i, u1, href, page.url), flush=True)
assert page.url.endswith("/landed"), page.url