Skip to content

The agent that grows with you

test(browser): the killed-launcher test kills only once the starting Chromium's record exists

Tekniumbc7b9c39788d
diff --git a/tests/tools/test_browser_launcher.py b/tests/tools/test_browser_launcher.py
index 4ddaf0cb86b..4c6b26d42ce 100644
--- a/tests/tools/test_browser_launcher.py
+++ b/tests/tools/test_browser_launcher.py
@@ -460,6 +460,10 @@ def test_a_launcher_killed_during_the_readiness_wait_leaves_its_chromium_to_the_
udd = Path(hermes.stdout.readline().strip())
pid = int(wait_until(lambda: (udd / "pid").exists() and (udd / "pid").read_text(), timeout=30,
what="the launched Chromium to start"))
+ # The record is written right after the spawn returns, which can be after the browser's first output:
+ # the kill lands in the readiness wait, the window this test is about.
+ wait_until(lambda: any((launcher._load_record(p) or {}).get("pid") == pid for p in _records().glob("*.json")),
+ timeout=30, what="the starting Chromium's launch record")
hermes.kill()
hermes.wait(timeout=10)
assert launcher._pid_alive(pid)