Skip to content

redact

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

Defined in: redact.ts:166

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 published 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>

const handle = await redact(page.getByTestId('api-key'))
// ... later
await handle.unredact()
await redact(page.getByTestId('balance'), async () => {
await page.getByRole('button', { name: 'Reveal' }).click()
})

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

Defined in: redact.ts:170

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 published 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>

const handle = await redact(page.getByTestId('api-key'))
// ... later
await handle.unredact()
await redact(page.getByTestId('balance'), async () => {
await page.getByRole('button', { name: 'Reveal' }).click()
})