tests: the two white-box fixtures that build a PageDispatcher by hand get the attributes the hand-over now keeps

test_navigation_response.py and test_same_document_navigation.py build a PageDispatcher with object.__new__ and set by hand the
attributes the code under test touches; the hook of the lifecycle (_on_lifecycle commit, _hear_lifecycle) now reads _announce_lock,
_announced, _said_before_announcement, _frames and _told_attached, and the frame stubs need frame_id and told_states. They are not marked
unit, so the first full run (-m unit) did not reach them; the run without the e2e marker does. No assertion is touched.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
feder-crandClaude Sonnet 5.5 committed 2026-11-12 15:33:31 +01:00
1 parent 7d4c21ba76
commit 7d934a642a
2 files changed
+12 -1

No files matched your search

+6
View File
@@ -71,6 +71,11 @@ def _bare_page():
page._request_log = []
page._navigation_requests = {}
page._announced_closed = False
page._frames = {}
page._told_attached = set()
page._announce_lock = threading.RLock()
page._announced = True
page._said_before_announcement = []
# The network branches ask the session's lifecycle which requests are the
# favicon; an empty memory answers "none", as for a page without one.
page.lifecycle = SimpleNamespace(favicons=FaviconRequests())
@@ -96,6 +101,7 @@ def test_new_document_request_is_a_channel_or_omitted(has_request, source):
frame.disposed = False
frame.page = page
frame.frame_id = "F1"
frame.told_states = {"commit"}
page.frame_for = lambda fid: frame
def committed():
+6 -1
View File
@@ -55,7 +55,7 @@ def _page_with_one_frame():
up: list = []
server.attach(type("R", (), {"emit_message": lambda self, m: up.append(m)})())
frame = SimpleNamespace(url="http://127.0.0.1/", name="", emitted=[])
frame = SimpleNamespace(url="http://127.0.0.1/", name="", emitted=[], frame_id="F1", told_states={"commit"})
frame.emit = lambda method, params=None: frame.emitted.append((method, params))
page = object.__new__(PageDispatcher)
@@ -68,6 +68,11 @@ def _page_with_one_frame():
page._request_log = []
page._navigation_requests = {}
page._announced_closed = False
page._frames = {}
page._told_attached = set()
page._announce_lock = threading.RLock()
page._announced = True
page._said_before_announcement = []
page.context = SimpleNamespace(emit=lambda *a, **k: None, intercepting=False)
page.frame = frame
page.frame_for = lambda fid: frame