
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
playwright-record-and-mock
Advanced tools
Why not use playwright native recordHar
option?
The recordHar
function of playwright use exact match of url,body,headers content for mock data.
This tool will record api data by request order, and replay them with the same order.
⚠️ Must install @playwright/test
.
yarn add -D @playwright/test playwright-record-and-mock
After install it, the pram
cli is avalable, it is the shortcase of playwright-record-and-mock
.
Create playwright
ts format config, content like below.
import type { PlaywrightTestConfig } from '@playwright/test'
const config: PlaywrightTestConfig = {
projects: [
{
name: 'Chrome Stable',
testDir: 'e2e',
use: {
headless: false,
browserName: 'chromium',
channel: 'chrome',
viewport: { width: 1920, height: 1080 },
},
},
],
}
export default config
run pram
command for configure.
pram init
The command will change playwright.config.ts
content.
Then the playwright.config.ts
should like below.
import type { PlaywrightTestConfig } from '@playwright/test'
import type { PramConfig } from 'playwright-record-and-mock'
const config: PlaywrightTestConfig & PramConfig = {
projects: [
{
name: 'Chrome Stable',
testDir: 'e2e',
use: {
headless: false,
browserName: 'chromium',
channel: 'chrome',
viewport: { width: 1920, height: 1080 },
},
},
],
pram: {
outDir: 'e2e',
site: 'https://your.host/',
urlFilter: /\/api\//,
},
}
export default config
Or else you can copy the pram
part into playwright.config.ts
by yourself.
run record by pram
command.
Record your test case in the browser by your own.
yarn pram mytest1
After record some browser acitons, close the browser and it will create dir e2e/mytest1
, which contains the test case files.
The test case file will looks like below.
import { test, expect } from '@playwright/test'
import { mock } from "playwright-record-and-mock"
test('test', async ({ page }) => {
mock(page, __dirname)
...
})
For now, pram
finishes its work, the next is all the work of playwright
.
run playwright test
.
yarn playwright test
json
text
FAQs
## a playwright tool for record api and replay
The npm package playwright-record-and-mock receives a total of 1 weekly downloads. As such, playwright-record-and-mock popularity was classified as not popular.
We found that playwright-record-and-mock 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.