@vishot/source-electron
v0.2.0
Published
Playwright Electron source capture adapter for Vishot.
Readme
@vishot/source-electron
Playwright Electron source capture adapter for Vishot.
What it does
This package runs Electron capture scenarios and writes raw application screenshots through the shared Vishot artifact protocol. It provides:
defineScenario()for scenario modulesloadScenarioModule()for loading scenario filescreateScenarioContext()for capture helpers bound to an Electron appcapturePage()for page screenshotsfindWindow()for generic title/URL-based window discovery
How to use
import { defineScenario } from '@vishot/source-electron'
export default defineScenario({
id: 'main-window',
async run(ctx) {
const page = await ctx.electronApp.firstWindow()
await ctx.capture('main-window', page)
},
})Run the scenario through the CLI:
pnpm exec vishot capture \
--target electron \
./capture/scenario.ts \
--app-entrypoint ./dist/main.js \
--output-dir ./screenshots/rawFor a direct window capture without a scenario module:
pnpm exec vishot capture \
--target electron \
--app-entrypoint ./dist/main.js \
--window-url '#/' \
--settle-ms 1000 \
--output-dir ./screenshots/mainPass --electron-executable when the package manager layout prevents Playwright from discovering the consumer project's Electron binary.
When to use
- You need to capture screenshots from an Electron application.
- You want scenario code to emit Vishot artifacts.
When not to use
- Do not put product-specific routes, selectors, or window names in this package.
- Use
@vishot/renderer-browserwhen the input is a browser-rendered capture scene.
