Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
intern-visual
Advanced tools
This project adds support for visual regression testing in Intern.
A visual regression test compares a screenshot of a webpage with a previously generated baseline providing the ability to make automated comparisons against a known-good version to ensure nothing has changed.
These tests can help engineers
The intern-visual
package should be installed as a peer of Intern
$ npm install intern intern-visual
Ok! You want to see all the great things Visual Regression Testing can do and how to do it! See real test code by
looking in the tests/visual
directory.
To run our visual regression tests
npm install -g grunt-cli
npm install
grunt test
This Intern plugin can be broken down into three main pieces of functionality. The assertion layer is made up of
assert
and test
; they provide a programmatic and configuration based approach, respectively. The comparison layer
is used by the assertion layer to identify differences between the baseline and snapshot images. And the reporting
layer is used by Intern to generate HTML reports.
assert
is a module that allows you to compare two sets of images (a baseline and snapshot). It is also responsible
for generating baselines as necessary for future test runs. The method is called during functional testing like this:
import assertVisuals from 'visual/assert';
registerSuite({
test() {
this.remote()
.get('https://sitepen.com')
.setWindowSize(1024, 768) // set the window size
.takeScreenshot()
.then(assertVisuals(this, {
missingBaseline: 'snapshot'
}));
}
})
There are a number of options that can be passed to assert
or set globally. The complete list of options can be
seen in the module.
baseline: explicitly point to a baseline png to use. When this is not defined the test name is used to generate a path to a baseline
regenerateBaselines: when set to true, a new baseline will be automatically generated
test
provides a wrapper around the assert
module that will create a visual regression test from configuration.
import visualTest from 'visual/test';
registerSuite({
test: visualTest({
url: 'https://sitepen.com',
width: 1024,
height: 768,
missingBaseline: 'snapshot',
});
});
The VisualRegression
reporter is responsible for creating a HTML report that reports (only) on the visual
regression tests. It can be used in combination with other Intern reporters.
export reporters = [
'Runner',
{ id: 'visual/reporters/VisualRegression', baselineLocation: './baselines', reportLocation: './reports' }
]
We would love to hear your feedback and welcome PRs. Please take a look at Intern's Contribution Guidelines for some info and tips. Thanks!
FAQs
Visual regression testing plugin for Intern
We found that intern-visual demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.