Gathering detailed insights and metrics for @percy/selenium-webdriver
Gathering detailed insights and metrics for @percy/selenium-webdriver
Gathering detailed insights and metrics for @percy/selenium-webdriver
Gathering detailed insights and metrics for @percy/selenium-webdriver
npm install @percy/selenium-webdriver
Typescript
Module System
Min. Node Version
Node Version
NPM Version
93.4
Supply Chain
97.8
Quality
92.5
Maintenance
100
Vulnerability
100
License
JavaScript (98.05%)
TypeScript (1.95%)
Total Downloads
5,360,409
Last Day
15,205
Last Week
135,224
Last Month
631,844
Last Year
5,123,276
2 Stars
327 Commits
2 Forks
9 Watching
30 Branches
39 Contributors
Latest Version
2.1.0
Package Id
@percy/selenium-webdriver@2.1.0
Unpacked Size
23.14 kB
Size
7.32 kB
File Count
8
NPM Version
6.14.18
Node Version
14.21.3
Publised On
07 Oct 2024
Cumulative downloads
Total Downloads
Last day
-43.9%
15,205
Compared to previous day
Last week
-11.4%
135,224
Compared to previous week
Last month
8.1%
631,844
Compared to previous month
Last year
3,085.4%
5,123,276
Compared to previous year
2
Percy visual testing for Selenium.js.
1$ npm install --save-dev @percy/cli @percy/selenium-webdriver
This is an example using the percySnapshot
function. For other examples of selenium-webdriver
usage, see the Selenium JS docs.
1const { Builder } = require('selenium-webdriver'); 2const percySnapshot = require('@percy/selenium-webdriver'); 3 4(async function example() { 5 let driver = await new Builder().forBrowser('firefox').build(); 6 7 try { 8 await driver.get('http://google.com/'); 9 await percySnapshot(driver, 'Google Homepage'); 10 11 await driver.get('http://example.com/'); 12 await percySnapshot(driver, 'Example Site'); 13 } finally { 14 await driver.quit(); 15 } 16})();
Running the code above directly will result in the following logs:
1$ node script.js 2[percy] Percy is not running, disabling snapshots
When running with percy exec
, and your project's
PERCY_TOKEN
, a new Percy build will be created and snapshots will be uploaded to your project.
1$ export PERCY_TOKEN=[your-project-token] 2$ percy exec -- node script.js 3[percy] Percy has started! 4[percy] Created build #1: https://percy.io/[your-project] 5[percy] Running "node script.js" 6[percy] Snapshot taken "Google Homepage" 7[percy] Snapshot taken "Example Site" 8[percy] Stopping percy... 9[percy] Finalized build #1: https://percy.io/[your-project] 10[percy] Done!
percySnapshot(driver, name[, options])
driver
(required) - A selenium-webdriver
driver instancename
(required) - The snapshot name; must be unique to each snapshotoptions
- See per-snapshot configuration options@percy/migrate
We built a tool to help automate migrating to the new CLI toolchain! Migrating can be done by running the following commands and following the prompts:
1$ npx @percy/migrate 2? Are you currently using @percy/selenium-webdriver (@percy/seleniumjs)? Yes 3? Install @percy/cli (required to run percy)? Yes 4? Migrate Percy config file? Yes 5? Upgrade SDK to @percy/selenium-webdriver@1.0.0? Yes
This will automatically run the changes described below for you.
@percy/seleniumjs
If you're coming from the @percy/seleniumjs
package, make sure to uninstall that package first
before installing this one.
1$ npm uninstall @percy/seleniumjs
Now you can safely install @percy/selenium-webdriver
and @percy/cli
.
@percy/cli
If you're coming from a pre-1.0 version of this package, make sure to install @percy/cli
after
upgrading to retain any existing scripts that reference the Percy CLI command.
1$ npm install --save-dev @percy/cli
If you have a previous Percy configuration file, migrate it to the newest version with the
config:migrate
command:
1$ percy config:migrate
percyScreenshot(driver, name, options)
[ needs @percy/cli 1.27.0-beta.0+ ];
This is an example test using the percyScreenshot
method.
1const { Builder } = require('selenium-webdriver'); 2const { percyScreenshot } = require('@percy/selenium-webdriver'); // both for selenium-webdriver/wdio 3 4(async function example() { 5const driver = new webdriver.Builder().usingServer('https://hub-cloud.browserstack.com/wd/hub').withCapabilities(capabilities).build(); // pass automate capabilities 6 7 try { 8 await driver.get('http://google.com/'); 9 await percyScreenshot(driver, 'Screenshot 1'); 10 11 await driver.get('http://example.com/'); 12 await percyScreenshot(driver, 'Screenshot 2'); 13 } finally { 14 await driver.quit(); 15 } 16})();
driver
(required) - A Selenium driver instancename
(required) - The screenshot name; must be unique to each screenshotoptions
(optional) - There are various options supported by percyScreenshot to server further functionality.
sync
- Boolean value by default it falls back to false
, Gives the processed result around screenshot [From CLI v1.28.0-beta.0+]fullPage
- Boolean value by default it falls back to false
, Takes full page screenshot [From CLI v1.27.6+]freezeAnimatedImage
- Boolean value by default it falls back to false
, you can pass true
and percy will freeze image based animations.freezeImageBySelectors
- List of selectors. Images will be freezed which are passed using selectors. For this to work freezeAnimatedImage
must be set to true.freezeImageByXpaths
- List of xpaths. Images will be freezed which are passed using xpaths. For this to work freezeAnimatedImage
must be set to true.percyCSS
- Custom CSS to be added to DOM before the screenshot being taken. Note: This gets removed once the screenshot is taken.ignoreRegionXpaths
- List of xpaths. elements in the DOM can be ignored using xpathignoreRegionSelectors
- List of selectors. elements in the DOM can be ignored using selectors.ignoreRegionSeleniumElements
- List of selenium web-element. elements can be ignored using selenium_elements.customIgnoreRegions
- List of custom objects. elements can be ignored using custom boundaries. Just passing a simple object for it like below.
{top: 10, right: 10, bottom: 120, left: 10}
top
(int): Top coordinate of the ignore region.bottom
(int): Bottom coordinate of the ignore region.left
(int): Left coordinate of the ignore region.right
(int): Right coordinate of the ignore region.considerRegionXpaths
- List of xpaths. elements in the DOM can be considered for diffing and will be ignored by Intelli Ignore using xpaths.considerRegionSelectors
- List of selectors. elements in the DOM can be considered for diffing and will be ignored by Intelli Ignore using selectors.considerRegionSeleniumElements
- List of selenium web-element. elements can be considered for diffing and will be ignored by Intelli Ignore using selenium_elements.customConsiderRegions
- List of custom objects. elements can be considered for diffing and will be ignored by Intelli Ignore using custom boundaries
{top: 10, right: 10, bottom: 120, left: 10}
top
(int): Top coordinate of the consider region.bottom
(int): Bottom coordinate of the consider region.left
(int): Left coordinate of the consider region.right
(int): Right coordinate of the consider region.Note: Automate Percy Token starts with auto
keyword. The command can be triggered using exec
keyword.
1$ export PERCY_TOKEN=[your-project-token] 2$ percy exec -- [js test command] 3[percy] Percy has started! 4[percy] [Javascript example] : Starting automate screenshot ... 5[percy] Screenshot taken "Javascript example" 6[percy] Stopping percy... 7[percy] Finalized build #1: https://percy.io/[your-project] 8[percy] Done!
Refer to docs here: Percy on Automate
No vulnerabilities found.
Reason
14 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
Found 24/25 approved changesets -- score normalized to 9
Reason
SAST tool is not run on all commits -- score normalized to 8
Details
Reason
8 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More