Feat : Capture Cross Origin Iframe and new responsive capture features#407
Open
yashmahamulkar-bs wants to merge 9 commits intomasterfrom
Open
Feat : Capture Cross Origin Iframe and new responsive capture features#407yashmahamulkar-bs wants to merge 9 commits intomasterfrom
yashmahamulkar-bs wants to merge 9 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the Percy Selenium .NET SDK’s DOM snapshotting to better support responsive captures (width/height pairs, optional page reloads between captures, and min-height handling) and adds logic intended to serialize cross-origin iframe DOMs.
Changes:
- Add cross-origin iframe processing during DOM serialization by injecting PercyDOM in frame contexts and attaching frame snapshots to the main snapshot payload.
- Replace width-only responsive capture logic with a width/height-aware configuration fetched from the Percy CLI, plus optional page reload and min-height computation.
- Update test expectations for new logged options and adjust test project configuration.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| package.json | Bumps @percy/cli version for new responsive width/height config endpoint support. |
| Percy/Percy.cs | Adds CORS iframe processing and refactors responsive capture to use width/height pairs, reload, and min-height logic. |
| Percy.Test/Percy.Test.csproj | Updates test target framework/lang version and adds content copy for xUnit runner config. |
| Percy.Test/Percy.Test.cs | Updates expected log output and removes responsive snapshot capture test coverage. |
Comments suppressed due to low confidence (1)
Percy.Test/Percy.Test.csproj:27
- The project now targets
net10.0and bumps several PackageReference versions, butPercy.Test/packages.lock.jsonstill contains the oldnet6.0lock data and older resolved versions. If lock files are enforced in CI, restore/build may fail. Please update the lock file to match the new target framework and dependencies (or adjust restore settings accordingly).
<TargetFrameworks>net10.0</TargetFrameworks>
<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Percy\Percy.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="17.11.1"
Condition="$(TargetFramework.StartsWith('net4')) AND '$(OS)' == 'Unix'" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Selenium.WebDriver" Version="4.27" />
<PackageReference Include="WebDriverManager" Version="2.16.3" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="RichardSzalay.MockHttp" Version="6.0.0" />
<PackageReference Include="Faker.Net" Version="2.0.154" />
<PackageReference Include="NSubstitute" Version="5.0.0" />
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request introduces significant enhancements to the responsive DOM capture logic in the
Percyclass, improving flexibility and configurability for responsive snapshot testing. The main changes include support for per-width height configuration, new environment variable controls, and improved error handling during responsive capture.Responsive capture improvements:
GetResponsiveWidthsmethod, which fetches width/height pairs from the Percy CLI and replaces the previous width-only logic. (Percy/Percy.cs, Percy/Percy.csR361-R507)PERCY_RESPONSIVE_CAPTURE_RELOAD_PAGEenvironment variable is set, ensuring a fresh DOM state for each snapshot. (Percy/Percy.cs, Percy/Percy.csR517-R554)PERCY_RESPONSIVE_CAPTURE_MIN_HEIGHTenvironment variable and configuration, with fallback logic and error handling for invalid values. (Percy/Percy.cs, [1] [2]Configuration and environment variable changes:
PERCY_RESPONSIVE_CAPTURE_RELOAD_PAGEandPERCY_RESPONSIVE_CAPTURE_MIN_HEIGHT, to control page reload and minimum height behavior during responsive capture. (Percy/Percy.cs, Percy/Percy.csR31-R39)Codebase cleanup and refactoring:
GetWidthsForMultiDommethod and updated all usages to the new width/height-aware logic. (Percy/Percy.cs, Percy/Percy.csL309-L330)ResponsiveWidthclass and handle height per width, including fallback and error handling. (Percy/Percy.cs, Percy/Percy.csR517-R554)