Repository navigation
flow: count a self-closing popup click as delivered only when the step expects it - #1321
Merged
Merged
Conversation
A popup can close itself from the click that finishes it (an approval or sign-in window). Playwright may then report "Target page, context or browser has been closed" after delivering the click. The recorder raised, and replay recorded the step's delivery as uncertain. - The recorder marks a click that left its popup surface closed as Step.closes_surface (driven and observed recordings), and expects that close while delivering a click on a popup. - The replayer arms PlaywrightBackend.expect_page_close() for that step only (new PageCloseExpectationBackend seam), and cancels it afterwards. - PlaywrightBackend.click, act_structural and act_guarded_coordinate count a TargetClosedError as delivered only when the close was expected, the page is a popup surface (closed_page_frame), it was open when the click started, and it reads as closed within a second. Any other TargetClosedError is ActionDeliveryUncertain; other errors are unchanged. - closes_surface is valid only on a click on a page a step opened; a false value is omitted from the sealed v2 digest, so existing bundles keep their digests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A popup can close itself from the click that finishes it, such as an approval or sign-in window. Playwright can report "Target page, context or browser has been closed" after it delivered that click. Before this change:
test_scripted_recorder_switches_back_from_a_self_closed_popupfailure on flow: keep pixel-path replays running across display scaling and ClearType #1286;Now that report counts as a delivered click only when the step expects its popup to close. Every other "page closed" report stays uncertain.
Rule
PlaywrightBackend(click,act_structural,act_guarded_coordinate) treats aTargetClosedErroras delivered only when all of these hold:expect_page_close(), one-shot);closed_page_frame=True, a page a step opened, per feat: multi-tab, popup, and backend-switching surfaces (carry-over of openadapt-flow#533) #1197);Otherwise it raises
ActionDeliveryUncertain. Other errors are unchanged.Where the expectation comes from
closes_surface: true. This covers driven and observed (interactive) recordings, and is checked after the settle wait because the close is asynchronous. While delivering a click on a popup, the recorder arms the expectation, so recording continues past the report.Step.closes_surface. It is valid only on a click or double-click that runs on a page a step opened. AFalsevalue is omitted from the sealed v2 digest (same rule asopensanddialog), so existing bundles keep their digests._actarms the backend for acloses_surfacestep only, and cancels the expectation afterwards. The new seam isPageCloseExpectationBackendinbackend.py.Tests
tests/test_page_close_delivery.py(13 tests):tests/test_multi_surface_selfclose_delivery.py(2 tests, real Playwright on the fixture's self-closing sign-in popup): every popup click is forced to raiseTargetClosedErrorafter it is delivered.closes_surfacecleared recordsdelivery_uncertaintywith causeTargetClosedError.tests/test_bundle_schema_v2.py: pre-field digests are preserved.This is a new file, so it doesn't conflict with #1283's changes to
test_multi_surface_selfclose.py, which cover the test's directpopup.click.🤖 Generated with Claude Code