Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
playwrigth-ws-inspector
Advanced tools
A playwright extension to inspect and validate websocket traffic
npm install playwright-ws-inspector --save-dev
// Fixture file...
import { intercepWsTraffic, PageWithWsInspector } from 'playwrigth-ws-inspector'
const test = baseTest.extend<CustomFixture>({
createCustomPage: async ({ context }, use) => {
const maker = async (options: { name: string }): Promise<PageWithWsInspector<CustomPage>> => {
let page = await context.newPage()
await intercepWsTraffic(page)
return page
}
await use(maker)
})
// Test file
test.describe('Test with WS interceptor', () => {
const page = await createCustomPage({ name: '[page]' })
await page.goto(SERVER_URL)
// reset the traffic data (required for ordered tests, but always a good pratice to reduce the test load)
page.resetWsTraffic()
//execute any playwright stuff...
//Test ws traffic on the page
page.expectWsTraffic({
assertations: [
{
type: "send",
name: "connect",
expect: {
type: "connect",
"message.version.major": 4,
},
}
]
})
})
import { intercepWsTraffic, PageWithWsInspector } from 'playwrigth-ws-inspector'
const test = baseTest.extend<CustomFixture>({
createCustomPage: async ({ context }, use) => {
const maker = async (options: { name: string }): Promise<PageWithWsInspector<CustomPage>> => {
let page = await context.newPage()
await intercepWsTraffic(page)
return page
}
await use(maker)
})
// Test file
test.describe('Test with WS interceptor', async ({ page }) => {
// call `intercepWsTraffic` before calling `page.goto`
await intercepWsTraffic(page)
await page.goto(SERVER_URL)
// reset the traffic data (required for ordered tests, but always a good pratice to reduce the test load)
page.resetWsTraffic()
//execute any playwright stuff...
//Test ws traffic on the page
page.expectWsTraffic({
assertations: [
{
type: "send",
name: "connect",
expect: {
type: "connect",
"message.version.major": 4,
},
}
]
})
})
Property | Descripton |
---|---|
type | 'send' or 'recv' |
name | Optional name to help indentify test failures |
expect | Optional record describing the expected payload |
expectNot | Optional record describing the not expected payload |
A payload description is a Record entry with "<json.path>: <number> | <string> | Object(deep equals) | RegEx"
FAQs
A playwright extension to inspect and validate websocket traffic
We found that playwrigth-ws-inspector 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
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.