Skip to content

screenshot

const screenshot: Screenshot

Defined in: screenshot.ts:605

ScreenCI screenshot test fixture.

Extended Playwright test that captures a branded still image of the final page state. Configure Playwright options (colorScheme, …) with screenshot.use() and capture options with screenshot.recordOptions(...).

import { screenshot, createOverlays } from 'screenci'
const overlays = createOverlays({
badge: { path: '../assets/new-badge.png', x: 0.72, y: 0.06, width: 0.2 },
})
screenshot.use({ colorScheme: 'dark' })
screenshot.recordOptions({ quality: '1440p', deviceScaleFactor: 2 })(
'Dashboard hero',
async ({ page, clip }) => {
await page.goto('https://app.example.com/dashboard')
await overlays.badge()
await clip(page.getByTestId('revenue-card'), { padding: 0.06 })
}
)