function setup
setup(
config: Config,
existingBrowser?: Browser | null,
sharedServer?: HTTPServer | null
): Promise<Connections>

Launches a Playwright browser (or reuses an existing one), starts the web server, and returns the page/server/browser connection object.

import * as Browser from './browser.ts';

import type { Config } from '../types.ts';

// Defined, not invoked: starts a real server, browser and page.
async function example(config: Config) {
  const { page } = await Browser.setup(config); // server is bound, console/pageerror wired
  return page.goto(`http://localhost:${config.port}`);
}

Parameters

config: Config
optional
existingBrowser: Browser | null = null
optional
sharedServer: HTTPServer | null = null

Return Type

Promise<Connections>

Usage

import { setup } from "lib/setup/browser.ts";