page-with
Version:
A library for usage example-driven in-browser testing of your own libraries.
29 lines (28 loc) • 929 B
TypeScript
import { Express } from 'express';
import { ChromiumBrowserContext, Page } from 'playwright';
import { PreviewServer, ServerOptions } from './server/PreviewServer';
import { RequestHelperFn } from './utils/request';
import { ConsoleMessages } from './utils/spyOnConsole';
export interface PageWithOptions {
example: string;
markup?: string;
contentBase?: string;
routes?(app: Express): void;
title?: string;
env?: Record<string, string | number | boolean>;
serverOptions?: ServerOptions;
}
export interface ScenarioApi {
page: Page;
origin: string;
makeUrl(chunk: string): string;
debug(page?: Page): Promise<void>;
request: RequestHelperFn;
context: ChromiumBrowserContext;
consoleSpy: ConsoleMessages;
server: PreviewServer;
}
/**
* Open a new page with the given usage scenario.
*/
export declare function pageWith(options: PageWithOptions): Promise<ScenarioApi>;