![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
screenshot-test-react
Advanced tools
The most straightforward UI testing library for react. Just wrap your UI component/widget inside `useScreenshotTest` and render it on your browser.
The most straightforward UI testing library for react.
Just wrap your UI component/widget inside useScreenshotTest
and render it on your browser.
The browser will render your component/widget along with a button named Capture and Compare
Hit the button and the tests will run and a report will be generated in test.html
file.
npm i screenshot-test-react
package.json
, under scripts, add-"scripts": {
...
...
"ss-test": "cd ./node_modules/screenshot-test-server/dist && node server.js" // add this
}
import Component1 from '/path-to-component-1';
import Component2 from '/path-to-component-2';
import { useScreenShotTest } from 'screenshot-test-react';
const App = () => {
const testComponents = [
{
component: Component1,
title: 'Component 1 details to be observed',
id: 'c1',
},
{
component: Component2,
title: 'Component 2 details to be observed',
id: 'c2',
},
...
];
const screenshotConfig = {
/* properties path, localhostUrl, port, quality etc (all optional) */
};
return useScreenShotTest(testComponents, screenshotConfig);
}
npm run ss-test
This will start the test server.
Render your test component in your browser and press the "Capture and Compare" button. This will generate a folder named ss-test
(or the path you provided in config) in your project's root directory.
Navigate to ss-test or (or the path you provided in config) folder and open the file named test.html
in your browser.
useScreenShotTest
receives 2 parameters- Components array and ScreenshotConfig.
interface ScreenshotConfig {
path?: string; // path where screenshots should be saved, default: ss-test
localhostUrl?: string; // for web & iOS emulator it is http://127.0.0.1, for Android emulator it is http://10.0.2.2
port?: string; // port where test server should run, default: 8080
batchSize?: number; // number of tests to be processed at a time, default: 10
maxWidth?: number; // maxWidth to be used in html while rendering the captured screenshot, default: 500
backgroundColor?: string; // backgroundColor to be used in html while rendering the captured screenshot, default: transparent
showDiffInGrayScale?: boolean; // show diff image in grayScale? default: false
quality?: number; // quality (0 to 1) while capturing the screenshot, default: 0.9
}
Note: all these properties are optional. In fact the second parameter to useScreenShotTest
is entirely optional. When omitted, the library assigns the default values to each property.
interface Components {
component: (props?: any) => ReactElement;
title: string;
id: string;
description?: string;
showDiffInGrayScale?: boolean;
maxWidth?: number;
backgroundColor?: string;
quality?: number;
}
Note: only the first 3 properties- component
, title
and id
are required, rest are optional.
FAQs
The most straightforward UI testing library for react. Just wrap your UI component/widget inside `useScreenshotTest` and render it on your browser.
The npm package screenshot-test-react receives a total of 2 weekly downloads. As such, screenshot-test-react popularity was classified as not popular.
We found that screenshot-test-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.