These are the main public types exposed through @qawolf/testkit and @qawolf/testkit/client.
MountCifsShareOptions
type MountCifsShareOptions = {
mountPoint: string;
password: string;
share: string;
username: string;
};
Used by:
mountCifsShare(...)
TestkitPorts["mountCifsShare"]
Example:
const options: MountCifsShareOptions = {
mountPoint: "/Volumes/shared",
password: "secret",
share: "//server/share",
username: "wolf",
};
StartOpenVpnOptions
type StartOpenVpnOptions = {
configPath: string;
routeHosts?: string[];
routeIps?: string[];
routeNoPull?: boolean;
};
Used by:
startOpenVpn(...)
TestkitPorts["startOpenVpn"]
Example:
const options: StartOpenVpnOptions = {
configPath: "/tmp/test.ovpn",
routeHosts: ["internal.example.com"],
};
StartWireGuardOptions
type StartWireGuardOptions = {
configPath: string;
};
Used by:
TestkitPorts["startWireGuard"]
The current code exposes this through the client ports, but there is no top-level startWireGuard(...) helper export today.
Example:
const options: StartWireGuardOptions = {
configPath: "/tmp/test.conf",
};
Screenshotable
type Screenshotable = {
screenshot: (screenshotOptions?: unknown) => Promise<Buffer>;
};
Used by saveBaselineScreenshot(...). Any page or locator-like object that supports this screenshot method shape can be used.
Example:
const pageLike: Screenshotable = {
screenshot: async () => Buffer.from("image"),
};
SaveBaselineScreenshot
type SaveBaselineScreenshot = (
pageOrLocator: Screenshotable,
name: string,
screenshotOptions?: unknown,
) => Promise<void>;
Example:
await saveBaselineScreenshot(page, "login-page");
await saveBaselineScreenshot(locator, "login-form", {
animations: "disabled",
});
SaveSnapshot
type SaveSnapshot = (name: string, bytes: Buffer) => Promise<void>;
This is the lower-level runner port used to implement saveBaselineScreenshot(...).
Example:
const saveSnapshot: SaveSnapshot = async (name, bytes) => {
console.log(name, bytes.length);
};
TestkitPorts
type TestkitPorts = {
mountCifsShare: (options: MountCifsShareOptions) => Promise<string>;
saveSnapshot?: SaveSnapshot;
startOpenVpn: (options: StartOpenVpnOptions) => Promise<string>;
startWireGuard: (options: StartWireGuardOptions) => Promise<string>;
};
These are the environment-specific ports that runners pass to createTestkitClient(...).
Example:
const ports: TestkitPorts = {
mountCifsShare: async ({ mountPoint }) => mountPoint,
saveSnapshot: async (name, bytes) => {
console.log(name, bytes.length);
},
startOpenVpn: async ({ configPath }) => configPath,
startWireGuard: async ({ configPath }) => configPath,
};
TestkitClient
TestkitClient is a union of:
- a client with baseline screenshot support
- a client without baseline screenshot support
If saveSnapshot is provided, the created client exposes saveBaselineScreenshot(...). Otherwise that method is absent.
Example:
import { createTestkitClient } from "@qawolf/testkit/client";
const client = createTestkitClient({
mountCifsShare: async ({ mountPoint }) => mountPoint,
startOpenVpn: async ({ configPath }) => configPath,
startWireGuard: async ({ configPath }) => configPath,
});
console.log(client.saveBaselineScreenshot); // undefined without saveSnapshot
Last modified on April 24, 2026