🐛 Fix enableJavaScript default for snapshot discovery#453
Merged
Conversation
Robdel12
approved these changes
Jul 29, 2021
Lazy images only work when JS is enabled. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-loading
samarsault
pushed a commit
that referenced
this pull request
Mar 3, 2023
Bumps [@percy/sdk-utils](https://github.com/percy/cli/tree/HEAD/packages/sdk-utils) from 1.0.0-beta.71 to 1.0.0-beta.73. - [Release notes](https://github.com/percy/cli/releases) - [Commits](https://github.com/percy/cli/commits/v1.0.0-beta.73/packages/sdk-utils) --- updated-dependencies: - dependency-name: "@percy/sdk-utils" dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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 is this?
During the recent discovery/snapshot refactors, the
Pageclass was updated to defaultenableJavaScripttotruefor other packages to borrow a page without explicitly enabling it. However, sinceenableJavaScriptdid not have a default configuration value for dom snapshots in thePercyclass, that resulted in all snapshots defaulting to have javascript enabled during asset discovery (this does not affect the API default).I also noticed that for snapshot captures, JavaScript is always enabled, even if the config option is
false.I updated this line to always prefer the
enableJavaScriptoption and default based on the presence ofdomSnapshot. When there is no dom provided, the default should betrue, otherwise it should befalse. I also added a test so this can be caught in the future if it regresses again.