feat: expose deviceDetails in healthcheck endpoint for responsive capture#2112
Merged
bhokaremoin merged 3 commits intomasterfrom Feb 24, 2026
Merged
feat: expose deviceDetails in healthcheck endpoint for responsive capture#2112bhokaremoin merged 3 commits intomasterfrom
bhokaremoin merged 3 commits intomasterfrom
Conversation
- Export complete deviceDetails object from /percy/healthcheck endpoint - Store deviceDetails in percy object in sdk-utils for easy access - Previously only device widths were available, now full device info is accessible
- Add deviceDetails to expected healthcheck response validation - Test deviceDetails is properly stored in percy object after isPercyEnabled - Add test cases for both empty and populated deviceDetails scenarios - Validate deviceDetails integration in /test/api/config test
rahulXbrowserstack
approved these changes
Feb 24, 2026
| percy.config.snapshot.widths = body.config; | ||
| percy.deviceDetails = body.mobile?.map((w) => { return { width: w }; }); | ||
| // Support setting deviceDetails directly or deriving from mobile widths | ||
| percy.deviceDetails = body.deviceDetails || body.mobile?.map((w) => { return { width: w }; }); |
Contributor
There was a problem hiding this comment.
Here we will get height also right ? because if mobile devices are enabled then we will capture DOM at device height- like below
[{width: , height:, devicePixelRatio: }]
Contributor
Author
There was a problem hiding this comment.
deviceDetails will return [{width: , height:, devicePixelRatio: }] only.
|| body.mobile?.map((w) => { return { width: w }; }); - this is a fallback if deviceDetails for some reason comes as undefined,
It can be removed if required
Contributor
There was a problem hiding this comment.
yes, that second part can be removed, but its on you whether to keep it or not
Contributor
Author
There was a problem hiding this comment.
actually this is /test endpoint it used only in our sdk test so no worries on it.
rahulXbrowserstack
approved these changes
Feb 24, 2026
prklm10
approved these changes
Feb 24, 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.
Jira: https://browserstack.atlassian.net/browse/PPLT-4949
Overview
This PR adds the complete
deviceDetailsobject to the/percy/healthcheckendpoint response and stores it in the SDK's percy object for easy access across all SDKs.Problem
Currently, the healthcheck endpoint only exposes device widths via
widths.mobile, which limits SDKs to accessing partial device information. For responsive capture, we need the complete device details (including height, devicePixelRatio, etc.) to properly resize the browser viewport to match mobile browser dimensions during snapshot capture.Solution
deviceDetailsfield to/percy/healthcheckendpoint response containing the complete device configuration arraydeviceDetailsfrom healthcheck response in the percy object for SDK consumptionpercy.deviceDetails.map(d => d.width)percy.deviceDetailsUse Case
This enables responsive capture functionality to:
Changes
Code
packages/core/src/api.js: ExportdeviceDetailsin healthcheck responsepackages/sdk-utils/src/percy-enabled.js: StoredeviceDetailsfrom healthcheckTests
deviceDetailsin responsedeviceDetailsis properly stored afterisPercyEnabled()deviceDetailsscenariosTesting