Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@percy/sdk-utils

Package Overview
Dependencies
Maintainers
1
Versions
236
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@percy/sdk-utils

Common JavaScript SDK utils

  • 1.30.5-beta.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
497K
decreased by-9.23%
Maintainers
1
Weekly downloads
 
Created

What is @percy/sdk-utils?

@percy/sdk-utils is a utility package designed to assist with the integration of Percy visual testing into various SDKs. It provides common functionality and helpers that can be used to simplify the process of capturing and managing visual snapshots.

What are @percy/sdk-utils's main functionalities?

Snapshot Creation

This feature allows you to create visual snapshots of web pages. The `createSnapshot` function is used to capture the current state of a page and save it as a snapshot for visual comparison.

const { createSnapshot } = require('@percy/sdk-utils');

async function takeSnapshot(page, name) {
  await createSnapshot(page, name);
}

takeSnapshot(page, 'Home Page');

DOM Manipulation

This feature provides a way to serialize the DOM of a web page. The `serializeDOM` function can be used to capture the HTML structure of a page, which can then be used for visual testing or other purposes.

const { serializeDOM } = require('@percy/sdk-utils');

async function getSerializedDOM(page) {
  const dom = await page.evaluate(() => serializeDOM());
  return dom;
}

getSerializedDOM(page).then(dom => console.log(dom));

Asset Discovery

This feature helps in discovering assets on a web page. The `discoverAssets` function can be used to identify and list all the assets (like images, stylesheets, etc.) that are part of a page, which is useful for ensuring all necessary resources are captured during visual testing.

const { discoverAssets } = require('@percy/sdk-utils');

async function findAssets(page) {
  const assets = await discoverAssets(page);
  return assets;
}

findAssets(page).then(assets => console.log(assets));

Other packages similar to @percy/sdk-utils

FAQs

Package last updated on 04 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc