import type { BrowserContext, Page } from "puppeteer-core"; import { ScrapeResult } from "../scraper"; export declare class Addon { name: string; when: WhenToRun; run: RunFunction; twice: boolean; constructor(options?: IAddon); setName(name: string): this; setWhen(when: WhenToRun): this; setTwice(twice: boolean): this; setRun(run: RunFunction): this; } export declare type WhenToRun = "before" | "after"; export declare type RunFunction = T extends "before" ? (browser: BrowserContext, page: Page, URL: string) => Promise | any : (browser: BrowserContext, page: Page, URL: string, result: ScrapeResult) => Promise | any; export interface IAddon { /** * Unique name for this addon */ name: string; /** * Whether the test should be ran with and without this addon * @default false */ twice?: boolean; /** * When to run the addon * @default "before" */ when?: T; run: RunFunction; }