
Research
Security News
Malicious npm Package Wipes Codebases with Remote Trigger
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
react-testid-generator
Advanced tools
React Test Id Generator is a package that can auto generate test attributes for testing tools used by QA automatically. The attribute name required can be passed into a function and the package handles everything else.
React Test Id Generator is a package that can auto generate test attributes for testing tools used by QA automatically. The attribute name required can be passed into a function and the package handles everything else.
npm i react-testid-generator --save
import tagAttributes from 'react-testid-generator';
useEffect(()=>{
tagAttributes('data-test-id','',2000,[]);
})
In the above code the first parameter is the attribute name to be added to the html element, second parameter is the prefix if needed for the attribute value (can be left blank if not needed) passign 'pre-' for example would generate attributes like data-test-id = "pre-7a61787824", the third parameter is the delay before executing the function in milliseconds (if your application takes longer to load all the elements on the screen pass a higher delay), the fourth paramter is an array of text that can be passed in case there are custom html elements in the application like for the input would be ['hashif','dev'] (pass an empty array [] in case there are no custom elements)
import logo from './logo.svg';
import './App.css';
import { useState, useEffect } from 'react';
import tagAttributes from 'react-testid-generator';
function App() {
useEffect(()=>{
tagAttributes('data-test-id','',2000,[]);
})
return (
<div className="App">
.
.
.
</div>
);
}
export default App;
This package can be used with JS frameworks like Angular or in any JS application. Please remember to call the function from an appropriate lifecycle hook equivalent depeneding on the stack.
In case of any doubts please contact me via mail hashif360@gmail.com or via LinkedIn www.linkedin.com/in/hashif-habeeb-a82064162
In case you are feeling down today here is an inspiring quote -
“Do what you can, with what you have, where you are.” ―Theodore Roosevelt.
FAQs
React Test Id Generator is a package that can auto generate test attributes for testing tools used by QA automatically. The attribute name required can be passed into a function and the package handles everything else.
The npm package react-testid-generator receives a total of 17 weekly downloads. As such, react-testid-generator popularity was classified as not popular.
We found that react-testid-generator 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
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.
Security News
New CNA status enables OpenJS Foundation to assign CVEs for security vulnerabilities in projects like ESLint, Fastify, Electron, and others, while leaving disclosure responsibility with individual maintainers.