Skip to content

fix(video): don't leave a stale test annotation overlay in the page - #42797

Open
Denis (someden) wants to merge 2 commits into
microsoft:mainfrom
someden:fix-42796
Open

Denis (someden) wants to merge 2 commits into
microsoft:mainfrom
someden:fix-42796

Conversation

@someden

@someden Denis (someden) commented Sep 19, 2026

Copy link
Copy Markdown

installScreencastTitleUpdater() updates the caption from two places: the test.step callbacks and the 'page' event. The page handler is fire-and-forget, and an update reads overlays.get(page) before awaiting showOverlay(), so a step that begins while a page-event update is in flight finds nothing to remove and adds a second overlay. The reference to the first one is lost and it stays in the page for the rest of the recording.

Both overlays are anchored to the same edge and differ by one line, so the previous caption line is drawn over the current one — a ghost that shows wherever it is longer than the text on top of it. With the default top-left position the two line up and the duplicate goes unnoticed; with a bottom position it is plainly visible in the video.

Serialize the updates into a promise chain so removing the previous overlay and adding the next one cannot interleave.

The page list each update works from is a snapshot, so a page that closes while its overlay is being updated rejects the call and aborts the loop — and because the step callbacks await it, that surfaces as the user's test failing with screencast.showOverlay: Target page, context or browser has been closed. The annotation is cosmetic, so each page is now updated on its own and failures go to the debug log instead of the test.

fixes #42796

installScreencastTitleUpdater() updates the caption from two places: the
test.step callbacks and the 'page' event. The page handler is fire-and-forget,
and an update reads overlays.get(page) before awaiting showOverlay(), so a step
that begins while a page-event update is in flight finds nothing to remove and
adds a second overlay. The reference to the first one is lost and it stays in
the page for the rest of the recording.

Both overlays are anchored to the same edge and differ by one line, so the
previous caption line is drawn over the current one — a ghost that shows
wherever it is longer than the text on top of it. With the default top-left
position the two line up and the duplicate goes unnoticed; with a bottom
position it is plainly visible in the video.

Serialize the updates into a promise chain so removing the previous overlay
and adding the next one cannot interleave. A failed update no longer breaks
the chain, but is still reported to whoever awaited it.
@someden

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: video show.test leaves a stale overlay behind, duplicating caption lines in the recording

1 participant