Hook Categories
Vulcn provides hooks for different lifecycle phases:| Category | Hooks | When Called |
|---|---|---|
| Initialization | onInit, onDestroy | Plugin setup/teardown |
| Recording | onRecordStart, onRecordStep, onRecordEnd | During session recording |
| Running | onRunStart, onBeforePayload, onAfterPayload, onRunEnd | During test execution |
| Browser Events | onDialog, onConsoleMessage, onPageLoad | Browser activity |
Initialization Hooks
onInit
Called when the plugin is initialized.- Load configuration
- Set up resources
- Register payloads
onDestroy
Called when the plugin is destroyed.- Clean up resources
- Save state
- Close connections
Recording Hooks
onRecordStart
Called when recording begins.startUrl- Initial URLbrowser- Browser typepage- Playwright page object
onRecordStep
Called after each step is recorded. Can modify or filter steps.Step- Modified step to recordnull- Skip this step
onRecordEnd
Called when recording ends. Can modify the final session.Running Hooks
onRunStart
Called when test execution begins.session- Session being executedpage- Playwright page objectheadless- Whether running headless
onBeforePayload
Called before each payload is injected. Can modify the payload.onAfterPayload
Called after each payload is injected. Can return findings.step- Current steppayloadValue- Injected payloadpage- Current page state
onRunEnd
Called when test execution completes. Can modify the result.Browser Event Hooks
onDialog
Called when a dialog (alert/confirm/prompt) appears.type()- “alert” | “confirm” | “prompt” | “beforeunload”message()- Dialog message
onConsoleMessage
Called when console.log/warn/error is called.text()- Message texttype()- “log” | “warn” | “error” | etc.
