Skip to content

redact

redact(locator, options?): Promise<RedactHandle>

Defined in: redact.ts:225

Mask the element(s) matched by locator so the content never enters the recording. The mask is applied client side in the live DOM, so the obscured pixels are never captured and never uploaded to screenci. This is true redaction, unlike cover, which only hides content in the exported output.

To hide a secret that is already on screen without a visible flash, register the mask before revealing it (inside hide() or via the recordOptions.redact config for always-secret elements).

Locator

RedactOptions

Promise<RedactHandle>

Persistent

const handle = await redact(page.getByTestId('api-key'))
// ... later
await handle.unredact()

Scoped

await redact(page.getByTestId('balance'), async () => {
await page.getByRole('button', { name: 'Reveal' }).click()
})

redact(locator, fn, options?): Promise<void>

Defined in: redact.ts:229

Mask the element(s) matched by locator so the content never enters the recording. The mask is applied client side in the live DOM, so the obscured pixels are never captured and never uploaded to screenci. This is true redaction, unlike cover, which only hides content in the exported output.

To hide a secret that is already on screen without a visible flash, register the mask before revealing it (inside hide() or via the recordOptions.redact config for always-secret elements).

Locator

() => void | Promise<void>

RedactOptions

Promise<void>

Persistent

const handle = await redact(page.getByTestId('api-key'))
// ... later
await handle.unredact()

Scoped

await redact(page.getByTestId('balance'), async () => {
await page.getByRole('button', { name: 'Reveal' }).click()
})