
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
playwright-har
Advanced tools
playwright-har is capturing HAR files from browser network traffic and saves them to simplify debugging of failed tests.
This is a port of puppeteer-har that was adjusted to work with Playwright.
npm i --save playwright-har
import { chromium } from 'playwright'
import { PlaywrightHar } from 'playwright-har'
(async () => {
const browser = await chromium.launch();
const context = await browser.newContext();
const page = await context.newPage();
const playwrightHar = new PlaywrightHar(page);
await playwrightHar.start();
await page.goto('http://whatsmyuseragent.org/');
// ... other actions ...
await playwrightHar.stop('./example.har');
await browser.close();
})();
In CustomEnvironment.js :
const PlaywrightEnvironment = require('jest-playwright-preset/lib/PlaywrightEnvironment').default
const { PlaywrightHar } = require('playwright-har');
class CustomEnvironment extends PlaywrightEnvironment {
constructor(config, context) {
super(config, context);
this.playwrightHar;
}
async handleTestEvent(event) {
if (event.name == 'test_start') {
if (this.global.browserName === 'chromium') {
this.playwrightHar = new PlaywrightHar(this.global.page);
await this.playwrightHar.start();
}
}
if (event.name == 'test_done') {
if (this.global.browserName === 'chromium') {
const parentName = event.test.parent.name.replace(/\W/g, '-');
const specName = event.test.name.replace(/\W/g, '-');
await this.playwrightHar.stop(`./${parentName}_${specName}.har`);
}
}
}
}
module.exports = CustomEnvironment;
This setup will create PlaywrightHar
instance for each test
statement in describe
statement in spec file. Browser network traffic will be collected from this step execution and save it in .har
file with name corresponding to describe
name followed by test
name.
stop()
has an optional argument path
- when specified, generated HAR file will be saved into provided path, otherwise it will be returned as an objectFAQs
Generate HAR files from Playwright test execution
We found that playwright-har 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.