fix(app): fit a DOM-less capture by both axes - #364
Merged
Conversation
Greptile SummaryThe PR fixes display of DOM-less screenshots and filmstrip thumbnails by fitting captures along both axes and deriving thumbnail proportions from image headers.
Confidence Score: 5/5The PR appears safe to merge, with no actionable correctness, security, or repository-rule issues identified. The latest change makes the malformed-image fixture valid base64 in the browser environment, avoiding an unrelated resource-loading error while preserving coverage of the 16:9 fallback. The complete implementation consistently shares image parsing across packages, contains captures without cropping, and covers the relevant image formats and layout directions.
|
| Filename | Overview |
|---|---|
| packages/shared/src/image.ts | Adds bounded PNG and JPEG header parsing for shared MIME and intrinsic-dimension detection. |
| packages/app/src/components/browser/trace-timeline.ts | Shapes filmstrip thumbnails from capture dimensions and contains images without cropping. |
| packages/app/src/components/browser/snapshot-styles.ts | Fits DOM-less screenshots within both dimensions of the available pane. |
| packages/trace/src/trace-frame-snapshots.ts | Replaces local screenshot MIME detection with the shared helper. |
| packages/shared/tests/image.test.ts | Covers PNG and JPEG dimensions, metadata traversal, malformed input, and zero-sized headers. |
| packages/app/test-ui/workbench/player/snapshot.test.ts | Verifies portrait and landscape DOM-less captures remain within the clipping pane. |
| packages/app/test-ui/workbench/player/trace-timeline.test.ts | Verifies intrinsic thumbnail shape, non-cropping behavior, and the sizeless-image fallback. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Capture[Base64 screenshot] --> Dimensions[Shared imageDimensions helper]
Capture --> Mime[Shared imageMime helper]
Dimensions -->|Valid dimensions| Ratio[Capture aspect ratio]
Dimensions -->|No dimensions| Fallback[16:9 fallback]
Ratio --> Filmstrip[Contained filmstrip thumbnail]
Fallback --> Filmstrip
Mime --> ImageURL[Image data URL]
ImageURL --> MainPane[Contained DOM-less screenshot]
ImageURL --> Filmstrip
Reviews (3): Last reviewed commit: "test(app): give the sizeless filmstrip f..." | Re-trigger Greptile
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.
What & why
Type of change
Packages touched
shared(types and contracts)core(framework-agnostic capture/reporting)elements(published element/snapshot API —@wdio/elements)service(WebdriverIO adapter)nightwatch-devtools(Nightwatch adapter)selenium-devtools(Selenium adapter)selenium-devtools-py(Selenium Python adapter)backend(server)app(UI)script(page-injected runtime)trace(Trace mode)Notes for reviewers
Screenshots / recordings