fix(web-integration): handle serialized static screenshots#2684
Merged
Conversation
Deploying midscene with
|
| Latest commit: |
cd7de56
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://bc223085.midscene.pages.dev |
| Branch Preview URL: | https://fix-static-page-serialized-s.midscene.pages.dev |
EAGzzyCSL
approved these changes
Jun 23, 2026
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.
Summary
StaticPagescreenshots that arrive as JSON-serializedScreenshotItemobjects from Playground Server mode.ScreenshotIteminstances and string/base64 screenshots, while throwing a clearer error for screenshot refs without inline base64 data.StaticPagecoverage and a Playground Server regression test for JSON-serialized screenshots.Root Cause
The first introducing change was
8e02e9a292db73c2b9c29f24ffff9b1580433f11(refactor(core): replace StorageProvider with ReportGenerator protocol, #1823) on 2026-02-03. That refactor removed theScreenshotItem.toJSON()path that serialized screenshots as{ base64 }. In report Playground Server mode,UIContextis sent through JSON to/execute; the server middleware then updates the static page context with a plain object containing internal screenshot fields such as_base64.StaticPage.screenshotBase64()only recognized a publicbase64property and otherwise returned the whole object, which later reachedimageInfoOfBase64()and producedimageBase64.replace is not a function.9a84b5bfd6e8b8dee8c5f5f965453bf6c166fdfe(#1994) later kept the same fallback while removing legacy context compatibility, but it was not the first introducing commit for this error shape.Validation
pnpm --dir packages/web-integration exec vitest --run tests/unit-test/static-page.test.ts tests/unit-test/playground-server.test.tsnpx nx test @midscene/web -- tests/unit-test/static-page.test.ts tests/unit-test/playground-server.test.tsnpx nx build @midscene/webpnpm run lintgit diff --check