Skip to content

🐛 Fix enableJavaScript default for snapshot discovery#453

Merged
wwilsman merged 2 commits intomasterfrom
ww/fix-js-discovery-default
Jul 29, 2021
Merged

🐛 Fix enableJavaScript default for snapshot discovery#453
wwilsman merged 2 commits intomasterfrom
ww/fix-js-discovery-default

Conversation

@wwilsman
Copy link
Copy Markdown
Contributor

@wwilsman wwilsman commented Jul 29, 2021

What is this?

During the recent discovery/snapshot refactors, the Page class was updated to default enableJavaScript to true for other packages to borrow a page without explicitly enabling it. However, since enableJavaScript did not have a default configuration value for dom snapshots in the Percy class, 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 enableJavaScript option and default based on the presence of domSnapshot. When there is no dom provided, the default should be true, otherwise it should be false. I also added a test so this can be caught in the future if it regresses again.

@wwilsman wwilsman added the 🐛 bug Something isn't working label Jul 29, 2021
@wwilsman wwilsman requested a review from Robdel12 July 29, 2021 16:43
@wwilsman wwilsman enabled auto-merge (squash) July 29, 2021 16:45
Copy link
Copy Markdown
Contributor

@Robdel12 Robdel12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wwilsman wwilsman disabled auto-merge July 29, 2021 16:48
@wwilsman wwilsman enabled auto-merge (squash) July 29, 2021 17:02
@wwilsman wwilsman merged commit f873ad3 into master Jul 29, 2021
@wwilsman wwilsman deleted the ww/fix-js-discovery-default branch July 29, 2021 17:05
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants